]> git.sur5r.net Git - contagged/blob - inc/init.php
supress errors on set_magic_quotes
[contagged] / inc / init.php
1 <?php
2   require_once(dirname(__FILE__).'/config.php');
3   require_once(dirname(__FILE__).'/fields.php');
4   require_once(dirname(__FILE__).'/lang/en.php');
5   require_once(dirname(__FILE__).'/lang/'.$conf['lang'].'.php');
6   require_once(dirname(__FILE__).'/functions.php');
7   require_once(dirname(__FILE__).'/template.php');
8   require_once(dirname(__FILE__).'/smarty/Smarty.class.php');
9
10   define('NL',"\n");
11
12   //init session
13   @ini_set('arg_separator.output', '&amp;');
14   session_name("ldapab");
15   session_start();
16
17   //kill magic quotes
18   if (get_magic_quotes_gpc()) {
19     if (!empty($_GET))    remove_magic_quotes($_GET);
20     if (!empty($_POST))   remove_magic_quotes($_POST);
21     if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
22     if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
23     if (!empty($_SESSION)) remove_magic_quotes($_SESSION);
24     ini_set('magic_quotes_gpc', 0);
25   }
26   @set_magic_quotes_runtime(0);
27
28   function remove_magic_quotes(&$array) {
29     foreach (array_keys($array) as $key) {
30       if (is_array($array[$key])) {
31         remove_magic_quotes($array[$key]);
32       }else {
33         $array[$key] = stripslashes($array[$key]);
34       }
35     }
36   }
37
38   //prepare SMARTY object
39   $smarty = new Smarty;
40   $smarty->compile_dir   = dirname(__FILE__).'/../cache';
41   $smarty->use_sub_dirs  = 0;
42   $smarty->template_dir  = dirname(__FILE__).'/../templates';
43   $smarty->force_compile = $conf['smartycompile'];
44
45   // select the correct google api key
46   $conf['gmapkey'] = $conf['gmaps'][$_SERVER['HTTP_HOST']];
47
48 ?>