]> git.sur5r.net Git - contagged/blob - init.php
added default escaping for smarty
[contagged] / init.php
1 <?
2   require_once('config.php');
3   require_once('fields.php');
4   require_once('lang/'.$conf['lang'].'.php');
5   require_once('functions.php');
6   require_once('template.php');
7   require_once('smarty/Smarty.class.php');
8
9   //init session
10   session_name("ldapab");
11   session_start();
12
13   //kill magic quotes
14   if (get_magic_quotes_gpc()) {
15     if (!empty($_GET))    remove_magic_quotes($_GET);
16     if (!empty($_POST))   remove_magic_quotes($_POST);
17     if (!empty($_COOKIE)) remove_magic_quotes($_COOKIE);
18     if (!empty($_REQUEST)) remove_magic_quotes($_REQUEST);
19     if (!empty($_SESSION)) remove_magic_quotes($_SESSION);
20     ini_set('magic_quotes_gpc', 0);
21   }
22   set_magic_quotes_runtime(0);
23
24   function remove_magic_quotes(&$array) {
25     foreach (array_keys($array) as $key) {
26       if (is_array($array[$key])) {
27         remove_magic_quotes($array[$key]);
28       }else {
29         $array[$key] = stripslashes($array[$key]);
30       }
31     }
32   }
33
34   //prepare SMARTY object
35   $smarty = new Smarty;
36   $smarty->compile_dir   = './cache';
37   $smarty->use_sub_dirs  = 0;
38   $smarty->template_dir  = './templates';
39   $smarty->force_compile = $conf['smartycompile'];
40   $smarty->default_modifiers = 'escape:"htmlall":"UTF-8"';
41 ?>