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