get_tree(array('id'=>0,'var'=>'id,parent,alias')); //print_pre($sitemap->get_tree(array('id'=>0,'var'=>'id,parent,alias'))); //echo getmicrotime($timer); // Логирование //$log_access=new Log($conf->getval('/log/access','log/access.log')); //$log_access->write_string(); // Автозагрузка @mod_load('./mod/k/auto/*.php'); @mod_load('./mod/p/auto/*.php'); // Определение глобальных переменных (Уровень 1) $self=array(); //$alias=rtrim("/".let($_REQUEST['a'],''),'/'); if (!$alias) $alias='/'; $alias="/".let($_REQUEST['a'],''); //print_pre($_REQUEST); if ( !($self['row']=$sitemap->get_ref($alias)) //|| //(!in_array($self['row']['alias'],array("$alias")) && $sitemap->get_children(array("id"=>$self['row']['id'],"cols"="id"))) ) { header("HTTP/1.0 404 Not Found"); if (!($self['row']=$sitemap->get_ref('/404/'))) { $self['row']=$sitemap->get_ref('/'); } } define('CATEGORY_ID',$self['row']['id']); // устаревшее define('ID',$self['row']['id']); define('ALIAS',$self['row']['alias']); $self['path']=$sitemap->get_path(array('id'=>ID,'cols'=>'id,alias,parent,name')); $self['keywords']=$sitemap->get_meta(ID,'keywords'); $self['description']=$sitemap->get_meta(ID,'description'); for ($i=0,$keys=array_keys($self['path']); $i<4; $i++) define("LEVEL{$i}",(string)array_shift($keys)); // выбираем аргументы foreach (preg_split('{/}',str_replace(rtrim(ALIAS,'/'),'',$alias),-1,PREG_SPLIT_NO_EMPTY) as $v) { $a=explode('.',$v); if (isset($a[1])) $self['args'][$a[0]]=$a[1]; else $self['args'][]=$v; } unset($a,$alias); //print_pre($self); //print_pre($_REQUEST); //$sitemap->get_ref(ALIAS); //print_pre($sitemap->get_ref(ALIAS)); define('MODE',let($_REQUEST['mode'],'html')); $url_self=array(CID_KEY=>CATEGORY_ID); $res_dir="res"; $smarty = new Smarty; array_push($smarty->plugins_dir,"mod/p/smarty","mod/k/smarty"); $smarty->template_dir="var/t"; $smarty->compile_dir="var/tc"; $smarty->config_dir="var/conf"; $smarty->cache_dir="var/cache"; $smarty->assign('site',SITE); $smarty->assign('alias',ALIAS); $smarty->assign('title',let($self['row']['name'],'')); $smarty->assign('text',let($self['row']['text'],'')); $smarty->assign('keywords',$self['keywords']); $smarty->assign('description',$self['description']); $smarty->assign('self',$self); for ($i=0; $i<4; $i++) $smarty->assign("LEVEL{$i}",constant("LEVEL{$i}")); $text=""; ob_start(); //$template='index.tpl'; $template=$sitemap->get_template(ID); //print_pre($template); if ($smarty->template_exists($tn="file:{$template[0]}.tpl")) { $smarty->display($tn); } elseif ($smarty->template_exists($tn="db:{$template[0]}")) { $smarty->display($tn); } //else { http_redir("http://".SITE."/404/"); } //header("HTTP/1.0 404 Not Found"); $text=ob_get_contents(); ob_end_clean(); echo $text; /* // Лог в БД if (mysql_table_exists('log_access')): $a_log=array( 'sid'=>session_id(), 'id_menu'=>ID, 'datetime'=>date("Y-m-d H:i:s",time()), 'ip'=>$_SERVER['REMOTE_ADDR'], 'host'=>$_SERVER['HTTP_HOST'], 'request_uri'=>$_SERVER['REQUEST_URI'], 'referer'=>let($_SERVER['HTTP_REFERER']), 'user_agent'=>$_SERVER['HTTP_USER_AGENT'], 'gen_time'=>str_replace(",",".",getmicrotime($timer)) ); $sql="INSERT INTO log_access SET ".array_to_sql($a_log); SQL($sql); endif; */ ?>