0){ $slug = implode("/-",$tmp); if(substr($slug,(strlen($slug)-1),1) == "/"){ $slug= substr_replace($slug ,"",-1); } } if(substr($page_location,(strlen($page_location)-1),1) != "/") $page_location .= "/"; /** * Instantiate and configure smarty */ $smarty = new Smarty; $smarty->setTemplateDir(SMARTY_TPL_DIR); //$smarty->addTemplateDir(WEB_PATH_MODULES); //$smarty->template_dir = array(SMARTY_TPL_DIR); $smarty->compile_dir = SMARTY_COMPILE_DIR; $smarty->plugins_dir = array(SMARTY_PLUGINS_DIR); $smarty->cache_dir = SMARTY_CACHE_DIR; $smarty->config_dir = SMARTY_CONFIG_DIR; $smarty->debug_tpl = SMARTY_DEBUG_TPL; $smarty->force_compile = FORCE_COMPILE; $smarty->debugging = DEBUGGING; $smarty->caching = SMARTY_CACHE; $smarty->cache_lifetime = CACHE_LIFETIME; $smarty->assign("PHP_SELF", $page_location); $smarty->assign("IS_MOBILE", $browser->isMobile()); $smarty->assign("BROWSER", $browser->getBrowser()); $current_user = user::getLoggedInUser(); if($current_user) { $smarty->assign("current_user", $current_user); $smarty->assign("current_user_id", $current_user->id); }elseif (isset($_COOKIE["login_username"]) && isset($_COOKIE["login_pass"])){ $smarty->assign("login_username", $_COOKIE["login_username"]); $smarty->assign("login_pass", $_COOKIE["login_pass"]); } /*TEMP CODE*/ // if($_COOKIE["oc_live_hash"] != "0c_l1V3_h@sh"){ // if($page_location != "/home/"){ // header("Location: /"); //redirect all lower pages to home // exit(); // } // }else{ // $smarty->assign("cookie_bypass", true); // } /*TEMP CODE*/ /** * Construct and build global module hooks * Dont think there is apc cache use session??? */ $apc_prefix = defined('APC_CACHE_PREFIX') ? APC_CACHE_PREFIX : ""; $modulehooks = apc_fetch($apc_prefix.'modulehooks'); if ($modulehooks === false || !($modulehooks->getHookCount() > 0)) { $modulehooks = new ModuleHooks(); apc_store($apc_prefix.'modulehooks', $modulehooks,600); } /** * Check if it must execute the Ajax function */ $obj_module = null; if (preg_match('/^\/_ajax\//', $page_location)){ /** * have to switch cahcking off else we need to build it into the module itself */ $smarty->caching = false; if(isset($_GET["module"])){ $content_module_name = $_GET["module"]; }else{ $content_module_name = str_replace("/_ajax/","/",$page_location); $content_module_name = str_replace("/","_", substr($content_module_name, 1, strlen($content_module_name)-2)); } $module_location = WEB_PATH_MODULES."/" . $content_module_name . "/" . $content_module_name . ".php"; if(file_exists($module_location)){ require_once($module_location); $constructor = $content_module_name; $obj_module = new $constructor(); $obj_module->doAjaxCall(); exit(); } } /** * Check if it must execute the pdf function of a specific module */ if (preg_match('/^\/pdf\//', $page_location)){ if(isset($_GET["module"])){ $content_module_name = $_GET["module"]; }else{ $content_module_name = str_replace("/pdf/","/",$page_location); $content_module_name = str_replace("/","_", substr($content_module_name, 1, strlen($content_module_name)-2)); } $module_location = WEB_PATH_MODULES."/" . $content_module_name . "/" . $content_module_name . ".php"; if(file_exists($module_location)){ require_once($module_location); $constructor = $content_module_name; $obj_module = new $constructor(); $obj_module->doPDF(); exit(); } } /** * Construct the page using the construct page controller */ $obj = new construct_page(); // main template constructor ?>