include("start.php"); if (!isset($_SESSION['loginAdmin'])) { header("Location: /simple"); exit; } $linkPage = $link->view(); if (strpos($linkPage, "?") !== false) { $str = strpos($linkPage, "?"); $linkPage = mb_substr($linkPage, 0, $str, "UTF-8"); $linkPage = trim($linkPage); } $linkArr = explode("/", $linkPage); $pages = ["news"=>"new", "tovars"=>"tovar", "section"=>"catalog", "pages"=>"page"]; $return = false; foreach (tablesPages as $key=>$table) { if ($meta->checkPage(end($linkArr), $table)) { $idPage = $meta->idPage(end($linkArr), $table); $info = $db->view(false, $idPage, $table); $title = $info['title']; $description = $info['description']; if (!empty($info['sysFile'])) $pageView = $info['sysFile']; else $pageView = $pages[$table]; $return = true; break; } } if (isset($_GET['text'])) { $title = str_replace("{search}", $_GET['text'], $title); $info['titleTeg'] = str_replace("{search}", $_GET['text'], $info['titleTeg']); } if (isset($info['titleTeg'])) define("titleTeg", $info['titleTeg']); else define("titleTeg", "Неизвестная страница"); if (isset($info['metaDescription'])) define("metaDescription", $info['metaDescription']); else define("metaDescription", "Неизвестная страница"); if (isset($info['metaKeywords'])) define("metaKeywords", $info['metaKeywords']); else define("metaKeywords", ""); if ($return == false) { if (end($linkArr) == "exit") { unset($_SESSION['login']); unset($_SESSION['idUser']); header("Location: /".linkLogin); exit; } } if ($return == false) { header("HTTP/1.0 404 Not Found"); include("pages/404.php"); } else { include("header.php"); include("pages/{$pageView}.php"); include("footer.php"); } ?>