getLanguage(); C8_Common_Share::set('language_id', $lang); //------ Cache $path=Config::$cache_dir.'/pages/page_'.$lang.'_'.$_SERVER['SERVER_NAME'].'_'; $path.=$controller->urlArray[0]?implode('_',$controller->urlArray):'index'; C8_Common_Share::set('_cache_path',$path); if ((!C8_Common_Cache::is_correct($path.'.cache'))||(isset($_POST['ignore_cache'])) || isset($_GET['ignore_cache'])) { $_cache_dynamic_exists=C8_Common_Cache::is_correct($path.'.nocache'); C8_Common_Share::set('_cache_dynamic_exists',$_cache_dynamic_exists); $locale = Config::$languages[$lang]['locale']; putenv("LANG=$locale"); setlocale(LC_ALL, $locale); $domain = 'messages'; bindtextdomain($domain, "./langs"); bind_textdomain_codeset ($domain, Config::$encoding['output']); textdomain($domain); C8_Common_Share::set('pages', $controller->getPagesStruct()); $tpl = C8_Site_TPL::getInstance(Config::$template); $tpl->security_settings['MODIFIER_FUNCS'][] = 'stripslashes'; $tpl->security_settings['MODIFIER_FUNCS'][] = 'strip_tags'; $tpl->assign("_LANGS_CONF", Config::$languages); $content=$controller->getHTML(); if (!config::$debug&&$controller->module->useCache) { $path.=($controller->module->cacheType==1)?'.nocache':'.cache'; if (C8_Common_Share::get('_cache_dynamic_exists')) { $content=C8_Common_Cache::getFromCache($path); } else { if (!isset($_POST['ignore_cache'])){ file_put_contents($path,$content);} } } echo $content; } else { echo C8_Common_Cache::getFromCache($path.'.cache'); } } /** * @todo should be moved inside controller with some default error reporting (IN DEVELOPMENT MODE ONLY!!!) page */ catch (Exception $e) { $tpl = C8_Site_TPL::getInstance(Config::$template); if(Config::$debug) { $tpl->assign('message',$e->getMessage()); $tpl->assign('code',$e->getCode()); $tpl->assign('trace',print_r($e->getTrace(),1)); $tpl->display('error.tpl'); } else { $tpl->display('404.tpl'); } } ?>