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