getController(); $file = $controller; $requestUri = str_replace('.php', '', $seo->requestUri); if ($controller == 'buy' && isset($_GET['group_id']) && !array_key_exists($_GET['group_id'], $_itemsGroup)){ $file = $controller = 'error404'; } elseif (!in_array($controller, array('index', 'buy', 'item', 'contact', 'price', 'forgot', 'login', 'members','members_orders','members_profile','order','basket','search')) && file_exists("templates/".TPL_ID."/".$requestUri.".tpl")){ $controller = 'custom'; $file = $requestUri; } if (file_exists("controllers/$file.php")) include_once "controllers/$file.php"; if (in_array($controller, array('sitemap', 'yml'))) exit; ob_start(); #template if (file_exists("templates/".TPL_ID."/is_landing")){ include_once "templates/".TPL_ID."/$file.tpl"; } else{ include_once "templates/header.tpl"; include_once "templates/".TPL_ID."/header.tpl"; if (file_exists("templates/".TPL_ID."/left.tpl")) include_once "templates/".TPL_ID."/left.tpl"; include_once "templates/".TPL_ID."/$file.tpl"; if (file_exists("templates/".TPL_ID."/right.tpl")) include_once "templates/".TPL_ID."/right.tpl"; include_once "templates/".TPL_ID."/footer.tpl"; include_once "templates/footer.tpl"; } $html = ob_get_contents(); ob_end_clean(); #modules if (strpos($html, '[module')>0){ $m = array(); preg_match_all('/\[module .+?\]/si', $html, $m); foreach ($m[0] as $moduleSource){ $m2 = array(); $module = html_entity_decode($moduleSource); preg_match_all('/([a-z_][a-z_0-9]+)\s*=\s*"([^"]+)"/si', $module, $m2); $_params = array(); foreach ($m2[0] as $k=>$row){ $_params[$m2[1][$k]] = $m2[2][$k]; } $moduleName = $_params['name']; ob_start(); if (file_exists("modules/".$moduleName.'.php')) include "modules/".$moduleName.'.php'; if (file_exists("templates/".TPL_ID."/module.$moduleName.tpl")) include "templates/".TPL_ID."/module.$moduleName.tpl"; $moduleHtml = ob_get_contents(); ob_end_clean(); $html = str_replace($moduleSource, $moduleHtml, $html); } } $html = preg_replace("/\s*$/m","", $html); echo $html; if ($controller != 'error404'){ $result = PutStat($_stat); if (!isset($_SESSION["inst"])) $_SESSION["inst"] = $result; } exit;