1<?php
2/********************************
3OSBib:
4A collection of PHP classes to create and manage bibliographic formatting for OS bibliography software
5using the OSBib standard.
6
7Released through http://bibliophile.sourceforge.net under the GPL licence.
8Do whatever you like with this -- some credit to the author(s) would be appreciated.
9
10If you make improvements, please consider contacting the administrators at bibliophile.sourceforge.net
11so that your improvements can be added to the release package.
12
13Adapted from WIKINDX: http://wikindx.sourceforge.net
14
15Mark Grimshaw 2005
16http://bibliophile.sourceforge.net
17********************************/
18/*****
19*	Initialize a few default variables before we truly enter the system.
20*
21*
22*	$Header: /cvsroot/bibliophile/OSBib/create/INIT.php,v 1.1 2005/06/20 22:26:51 sirfragalot Exp $
23*****/
24class INIT
25{
26// Constructor
27	function INIT()
28	{
29// Set to error_reporting(0) before release!!!!!!!!!
30// For debugging, set to E_ALL
31		error_reporting(E_ALL);
32//		error_reporting(0);
33// buffer printing to browser
34		ob_start();
35// make sure that Session output is XHTML conform ('&amp;' instead of '&')
36		ini_set('arg_separator.output', '&amp;');
37		set_magic_quotes_runtime(0);
38// Check we have PHP 4.3 and above.
39		if(($PHP_VERSION = phpversion()) < '4.3')
40			die("OSBib requires PHP 4.3 or greater.  Your PHP version is $PHP_VERSION. Please upgrade.");
41	}
42// Make sure we get HTTP VARS in whatever format they come in
43	function getVars()
44	{
45		if(!empty($_POST))
46			$vars = $_POST;
47		else if(!empty($_GET))
48			$vars = $_GET;
49		else
50			return FALSE;
51		if(!get_magic_quotes_gpc())
52			$vars = array_map(array("INIT", "magicSlashes"), $vars);
53		return $vars;
54	}
55// start the SESSION
56	function startSession()
57	{
58// start session
59		session_start();
60	}
61// Add slashes to all incoming GET/POST data.  We now know what we're dealing with and can code accordingly.
62	function magicSlashes($element)
63	{
64		if(is_array($element))
65			return array_map(array("INIT", "magicSlashes"), $element);
66		else
67			return addslashes($element);
68	}
69}
70