60*30) { if((time() - $_SESSION['sf']) > 60*30) unset($_SESSION['sf']); if(!isset($_POST['asdf'])) { include'underconstruction.html'; exit(); } else if($_POST['asdf'] === '123') $_SESSION['sf'] = time(); else { exit('Неверный пароль'); } } */ @error_reporting(error_reporting() ^ E_DEPRECATED); if (isset($_SESSION['login']) && $_SESSION['login']) { $MODE = 'be'; } else { $MODE = 'fe'; } include './config/conf.php'; include SMS_PATH.'/includes/smarty.inc.php'; include SMS_PATH.'/includes/adodb.inc.php'; include SMS_PATH.'/includes/validator.inc.php'; include SMS_PATH.'/fe.modules.init.php'; include SMS_PATH.'/be.modules.conf.init.php'; include SYSTEM_MODULES_PATH.'/access/fe_access.class.php'; $smarty->template_dir = SITE_PATH.'/templates/'; $smarty->compile_dir = SITE_PATH.'/templates_c/'; $fe_access = new fe_Access(); if (isset($_SESSION['fe_login']) && $_SESSION['fe_login'] == true) { $fe_user_id = intval($_SESSION['fe_user_id']); $fe_user = $fe_access->getUserInfo($fe_user_id); } $page_404_tpl = '404.tpl'; $under_constraction_tpl = 'under_constraction.tpl'; $url = trim($_SERVER['REQUEST_URI']); $lang = new Languages(); if ($lang->state == 0) { $smarty->display($under_constraction_tpl); exit; } $page = new Pages(); if ($page->params['state'] == 0) { $smarty->display($under_constraction_tpl); exit; } if ($page->ok == false) { $smarty->display($page_404_tpl); exit; } //if ($page->param) { // if ($page->checkParam() == false) { // $smarty->display($page_404_tpl); // exit; // } //} if ($page->params['fe_login_mode'] == '1') { if ($lang->is_main) { $login_page = '/login.html'; } else { $login_page = '/'.$page->key.'/login.html'; } if (isset($_SESSION['fe_login']) && $_SESSION['fe_login'] == true) { if (!in_array($fe_user['group_id'], $page->params['fe_perms'])) { // regirect to login page; header('location:'.$login_page); exit; } } else { // regirect to login page; header('location:'.$login_page); exit; } } $contents = new Contents; $temp_file = $contents->getTempFileName($page->params['template_id']); if ($temp_file == false) { $smarty->display('under_constr.tpl'); exit; } if ($MODE == 'be') { $_SESSION['url'] = $url; include SMS_PATH.'/main/backend.class.php'; include SYSTEM_MODULES_PATH.'/access/access.class.php'; include SYSTEM_MODULES_PATH.'/access/access.auth.php'; $backend = new Backend; include SYSTEM_MODULES_PATH."/contents/be_contents.init.php"; include SYSTEM_MODULES_PATH."/languages/be_languages.class.php"; $be_contents = new be_Contents; $be_lang = new be_Languages; $actions = $backend->getUserSysModuleObjectActions('contents', 'content'); if ($page->params['id']) { $blocks = array(); $smarty->template_dir = SITE_PATH.'/templates/'; $smarty->compile_dir = SITE_PATH.'/templates_c/'; $tags = $smarty->get_template_tags($temp_file); foreach($tags as $tag) { if (isset($tag['type']) && ($tag['type'] == 'static' || $tag['type'] == 'dynamic')) switch ($tag['owner']) { case "page":{ $content = $be_contents->getPageContent($tag['id'], $page->params['id']); if (@$content->fe_login_mode == '2') { if (!$in_array($fe_user['group_id'], $content->fe_perms)) { continue; } } if ($content == false) { $content['id'] = 0; $content['page_id'] = $page->params['id']; $content['block_id'] = $tag['id']; $content['type'] = 'page'; } else { if ($content['fe_login_mode'] == '1' && (isset($_SESSION['fe_login']) && $_SESSION['fe_login'] == true)) { continue; } if ($content['generator'] != 'none') { if (file_exists(SMS_PATH.'/generators/'.$content['generator'])) { $smarty->template_dir = SITE_PATH.'/templates_gen/'; $smarty->compile_dir = SITE_PATH.'/templates_c/'; include_once SMS_PATH.'/generators/'.$content['generator']; $smarty->template_dir = SITE_PATH.'/templates/'; $smarty->compile_dir = SITE_PATH.'/templates_c/'; } $content['body'] = $body; } } $smarty->assign('content', $content); $smarty->assign('actions', $actions); $smarty->template_dir = SYSTEM_MODULES_PATH.'/contents/data/templates'; $smarty->compile_dir = SYSTEM_MODULES_PATH.'/contents/data/templates_c'; $blocks[$tag['id']] = $smarty->fetch('block.tpl'); };break; case "pages":{ $content = $be_contents->getPagesContent($tag['id']); if ($content == false) { $content['id'] = 0; $content['page_id'] = $page->params['id']; $content['block_id'] = $tag['id']; } else { if ($content['fe_login_mode'] == '1' && (isset($_SESSION['fe_login']) && $_SESSION['fe_login'] == true)) { continue; } if ($content['generator'] != 'none') { if (file_exists(SMS_PATH.'/generators/'.$content['generator'])) { $smarty->template_dir = SITE_PATH.'/templates_gen/'; $smarty->compile_dir = SITE_PATH.'/templates_c/'; include_once SMS_PATH.'/generators/'.$content['generator']; $smarty->template_dir = SITE_PATH.'/templates/'; $smarty->compile_dir = SITE_PATH.'/templates_c/'; } $content['body'] = $body; } if (in_array($page->params['id'], $content['hide_in_pages'])) { $content['hidden'] = true; $content['shown'] = false; } else { $content['hidden'] = false; $content['shown'] = true; } } $smarty->assign('page_id', $page->params['id']); $smarty->assign('content', $content); $smarty->assign('actions', $actions); $smarty->template_dir = SYSTEM_MODULES_PATH.'/contents/data/templates'; $smarty->compile_dir = SYSTEM_MODULES_PATH.'/contents/data/templates_c'; $blocks[$tag['id']] = $smarty->fetch('block.tpl'); };break; } } $smarty->template_dir = SITE_PATH.'/templates/'; $smarty->compile_dir = SITE_PATH.'/templates_c/'; $smarty->assign('page', $page->params); $smarty->display($temp_file); exit; } } else { $temp_blocks = $smarty->get_template_tags($temp_file); $upload_cache = $page->getCachingState(); if ($upload_cache) { $i = 0; foreach ($temp_blocks as $temp_block) { if ($temp_block['type'] == 'static' || $temp_block['type'] == 'dynamic') { $body = ''; if ($temp_block['owner'] == 'page') { $content = $contents->getPageContent($temp_block['id'], $page->params['id']); } elseif($temp_block['owner'] == 'pages') { $content = $contents->getPagesContent($temp_block['id']); if (@in_array($page->params['id'], $content['hide_in_pages'])){ $content = false; //echo "false"; } if ($content['state'] == '0') $content = false; if($i == 0){ //print_r($content); //echo "/r/n"; //print_r($page); } $i = 1; } if ($content && $content['fe_login_mode'] == '2') { if (!@in_array($fe_user['group_id'], $content['fe_perms'])) { continue; } } if ($content == false) continue; if ($content['fe_login_mode'] == '1' && (isset($_SESSION['fe_login']) && $_SESSION['fe_login'] == true)) { continue; } if ($content['generator'] == 'none') { $body = $content['body']; } else { $body = ""; if (file_exists(SMS_PATH.'/generators/'.$content['generator'])) { $smarty->template_dir = SITE_PATH.'/templates_gen/'; include_once SMS_PATH.'/generators/'.$content['generator']; $smarty->template_dir = SITE_PATH.'/templates/'; } } $blocks[$temp_block['id']] = $body; } } } else { foreach ($temp_blocks as $temp_block) { $body = ''; if ($temp_block['type'] == 'dynamic') { if ($temp_block['owner'] == 'page') { $content = $contents->getPageContent($temp_block['id'], $page->id); if ($content['state'] == '0') $content = false; } elseif($temp_block['owner'] == 'pages') { $content = $contents->getPageContent($temp_block['id']); if (in_array($page->id, $content['hide_in_pages'])) $content = false; if ($content['state'] == 'none') $content = false; } if ($content && $content['fe_login_mode'] == '1') { if (!$in_array($fe_user['group_id'], $content['fe_perms'])) { continue; } } if ($content == false) continue; if ($content['fe_login_mode'] == '2' && (isset($_SESSION['fe_login']) && $_SESSION['fe_login'] == true)) { continue; } if ($content['generator'] == '') { $body = $content['body']; } else { if (file_exists(SMS_PATH.'/generators/'.$content['generator'])) { $smarty->template_dir = SITE_PATH.'/templates_gen/'; include_once SMS_PATH.'/generators/'.$content['generator']; $smarty->template_dir = SITE_PATH.'/templates/'; } $body = $body; } $blocks[$temp_block['id']] = $body; } } } //$cach_id = $Page->options['id'].$url; //$smarty->caching = true; //$smarty->cache_lifetime = 60*60*24*7; $smarty->assign('page', $page->params); $smarty->assign('lang', $lang->key); $page_urlll = @explode('/', $_SERVER['REQUEST_URI']); $smarty->assign('page_urlll', $page_urlll[1]); //$smarty->display($temp_file, $cach_id); $smarty->display($temp_file); } ?>