$v) { if (is_array($v)) { strip_slashes_from_user_data($array[$k]); continue; } $array[$k] = stripslashes($v); } } strip_slashes_from_user_data($_GET); strip_slashes_from_user_data($_POST); strip_slashes_from_user_data($_COOKIE); } function unregister_globals() { if (!ini_get('register_globals')) { return false; } foreach (func_get_args() as $name) { foreach ($GLOBALS[$name] as $key=>$value) { if (isset($GLOBALS[$key])) unset($GLOBALS[$key]); } } } unregister_globals('_POST', '_GET', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES'); function __autoload($classname) { if (!preg_match('/^[a-z0-9A-Z_]+$/', $classname)) throw new fatalException("Classname invalid."); if (file_exists(LENCRIER_ROOT . '/include/class.'.$classname.'.php')) require_once LENCRIER_ROOT . '/include/class.'.$classname.'.php'; elseif (file_exists(LENCRIER_ROOT . '/include/class.'.strtolower($classname).'.php')) require_once LENCRIER_ROOT . '/include/class.'.strtolower($classname).'.php'; else throw new fatalException("Class $classname doesn't exists."); } function loadLib($libname) { if (!preg_match('/^[a-z0-9A-Z_]+$/', $libname)) throw new fatalException("Lib name invalid."); if ($libname == 'image') require_once LENCRIER_ROOT . '/include/image/lib.'.$libname.'.php'; else require_once LENCRIER_ROOT . '/include/lib.'.$libname.'.php'; } loadLib('utils'); // FIXME: mettre la bonne timezone date_default_timezone_set('Europe/Paris'); require_once(LENCRIER_ROOT . '/include/db/class.mysql.php'); DB::addConnection(42, MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_BASE); DB::setEncoding(42, 'utf8'); DB::setDefaultConnection(42); $protocol = !empty($_SERVER['HTTPS']) ? 'https' : 'http'; define('LENCRIER_DATA_URL', $protocol . '://' . LENCRIER_ADMIN_HOST . '/datas/'); ?>