]> git.sur5r.net Git - contagged/blob - inc/init.php
6d16606874342a75773063bb01f0e6e40015a5d6
[contagged] / inc / init.php
1 <?
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   session_name("ldapab");
14   session_start();
15
16   //kill magic quotes
17   if (get_magic_quotes_gpc()) {
18     if (!empty($_GET))    remove_magic_quotes($_GET);
19     if (!empty($_POST))   remove_magic_quotes($_POST);
20     if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
21     if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
22     if (!empty($_SESSION)) remove_magic_quotes($_SESSION);
23     ini_set('magic_quotes_gpc', 0);
24   }
25   set_magic_quotes_runtime(0);
26
27   function remove_magic_quotes(&$array) {
28     foreach (array_keys($array) as $key) {
29       if (is_array($array[$key])) {
30         remove_magic_quotes($array[$key]);
31       }else {
32         $array[$key] = stripslashes($array[$key]);
33       }
34     }
35   }
36
37   //prepare SMARTY object
38   $smarty = new Smarty;
39   $smarty->compile_dir   = dirname(__FILE__).'/../cache';
40   $smarty->use_sub_dirs  = 0;
41   $smarty->template_dir  = dirname(__FILE__).'/../templates';
42   $smarty->force_compile = $conf['smartycompile'];
43
44   // select the correct google api key
45   $conf['gmapkey'] = $conf['gmaps'][$_SERVER['HTTP_HOST']];
46
47 ?>