0) $_tSETTINGS[$row['id']] = stripslashes($row['value']); $_SETTINGS[$row['id']] = stripslashes($row['value']); } $sql = "SELECT `id`, `table`, `uri` FROM `".T_PAGES."` WHERE `table`<>''"; $sql = query($sql, __FILE__, __LINE__); while ($row = my_fetch_assoc($sql)) $_SETTINGS[$row['table']][$row['id']] = stripslashes($row['uri']); $sql = "SELECT `id`, `name` FROM `".T_PAGES."` WHERE `uri`='".$_SERVER['SETTINGS']['homepage']."'"; $sql = query($sql, __FILE__, __LINE__); if ($sql) { $row = my_fetch_assoc($sql); if (!empty($row)) $_SETTINGS['main'] = stripslashes($row['name']); } if (empty($_SETTINGS['main'])) $_SETTINGS['main'] = 'Main'; $_tSETTINGS['main'] = $_SETTINGS['main']; $_tSETTINGS['homepage'] = $_SERVER['SETTINGS']['homepage']; unset($row); //заголовок письма $headers = 'From: info@'.str_replace("www.", "", $_SERVER['SERVER_NAME']). "\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=windows-1251' . "\r\n"; //подготовка шаблонизаторов $smarty = new Smarty; $smarty->compile_check = true; //$smarty->cache = BASE_PATH.'templates_c/'; $smarty->debugging = false; $smarty->assign ('settings', $_tSETTINGS); $smarty->assign ('title', $_SETTINGS['sitename']); $smarty->assign ('pagename', ''); $smarty->assign ('text', ''); $smarty->assign ('copyright', $_SETTINGS['copyright']); unset($_tSETTINGS); ?> $v) { $pattent = pattentFromMask($_SETTINGS['article_url'], $v); if (preg_match($pattent, $_SERVER['REQUEST_URI'], $p)) { $child = getPageInfo(T_ARTICLES, $p[1], 'id'); $page = getPageInfo(T_PAGES, $child['root'], 'id'); if ($page['table'] == 'articles') $func404 = false; $page['СHILD'] = $child; break; } } } if (!$page) { //новости foreach ($_SETTINGS['news'] AS $k=>$v) { $pattent = pattentFromMask($_SETTINGS['news_url'], $v); if (preg_match($pattent, $_SERVER['REQUEST_URI'], $p)) { $child = getPageInfo(T_NEWS, $p[1], 'id'); $page = getPageInfo(T_PAGES, $child['root'], 'id'); if ($page['table'] == 'news') $func404 = false; $page['СHILD'] = $child; break; } } } if (!$page) { //разделы foreach ($_SETTINGS['sections'] AS $k=>$v) { $pattent = pattentFromMask($_SETTINGS['sections_url'], $v); if (preg_match($pattent, $_SERVER['REQUEST_URI'], $p)) { $child = getPageInfo(T_SECTIONS, $p[1], 'id'); $page = getPageInfo(T_PAGES, $child['root'], 'id'); if ($page['table'] == 'sections') $func404 = false; $page['СHILD'] = $child; break; } } } //проверим модули { if (!empty($_SETTINGS['REDIRECT'])) $_URL = getRegulatPartFromUrl($_SERVER['REQUEST_URI']); if (($modules = getPageInfo(T_MODULES, $_URL, 'uri'))) { $func404 = false; $file = BASE_PATH.'modules/'.$modules['id'].'.php'; if (file_exists($file)) include $file; } } if (!$page OR $func404) func404(); function getRegulatPartFromUrl($url) { $url = str_replace('//','/',$url); if (strpos($url, '?') > 0) $url = substr($url, 0, strpos($url, '?')); $url = explode ('/',$url); if (empty($url[1])) $url[1] = "/"; return correct_url($url[1]); } ?>