debugger = true; define('DEBUG', true); } else { define('DEBUG', false); } } else { die; define('DEBUG', false); } if(!in_array($_SERVER['REMOTE_ADDR'], $developersIps)){ die; } */ $site_config = Loader::load('site_config', 'config'); //Check for files if(is_file($site_config['base_path'].ltrim($_SERVER['REQUEST_URI'],'/'))){ $myfile = fopen($site_config['base_path'].ltrim($_SERVER['REQUEST_URI'],'/'), "r"); echo fread($myfile,filesize($site_config['base_path'].ltrim($_SERVER['REQUEST_URI'],'/'))); fclose($myfile); exit(); } // in case of connection failed, we should just ignore $memcache = new Memcache; if (@$memcache->connect($site_config['memcache']['host'], $site_config['memcache']['port'])) { Registry::set($memcache, 'memcache'); } else { Registry::set(false, 'memcache'); }; Loader::load('Smarty.class', 'lib', 'smarty'); $smarty = new Smarty; $smarty->debugging = false; $smarty->template_dir = path('templates'); $smarty->compile_dir = path('templates_c'); $smarty->assign('site_config', $site_config); $smarty->assign('session_id', session_id()); $smarty->assign('time', time()); Registry::set($smarty, 'smarty'); Registry::set($dbh, 'database'); Registry::set($site_config, 'site_config'); $detect = new Mobile_Detect; $deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 't' : 'm') : 'd'); if($_SESSION['user']['email']){ $source_address = $_SESSION['user']['email']; $processed_address = strtolower($source_address); //convert address to lower case $processed_address = trim($processed_address); //trimming leading and trailing spaces $processed_address = mb_convert_encoding($processed_address, "UTF-8", "ISO-8859-1"); //conversion from ISO-8859-1 to UTF-8 (replace "ISO-8859-1" with the source encoding of your string) $criteoEmail = md5($processed_address); $smarty->assign("criteoEmail",$criteoEmail); } $smarty->assign("deviceType",$deviceType); //Insert data for statistic /* if($_SERVER['HTTP_REFERER']){ $dataInsert['referral'] = $_SERVER['HTTP_REFERER']; $dataInsert['current_url'] = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";; $dataInsert['date'] = date('Y-m-d H:i:s'); $dbh->insert('statistic_page_from_to',$dataInsert); } */ if (DEBUG) { error_reporting(E_ALL & ~E_NOTICE); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); } Router::run();