* @copyright: Copyright (c) 2010, Bunzia Alexander * @version: 1.0 * @license: http://www.gnu.org/copyleft/gpl.html GNU/GPL * @package: HiLo CMS */ class admin_stat_pages_view{ private $error = false; private $act = 'index'; private $JsHttpRequest = false; public function __construct(){ global $MAIN_PAGE; define('M_PATH',MAIN_SOURCE_PATH.'/modules/'.$MAIN_PAGE -> dirname() ); define('M_URL',MAIN_SOURCE_URL.'/modules/'.$MAIN_PAGE -> dirname() ); define('A_CHARSET', $MAIN_PAGE -> charset() ); //include_once(M_PATH.'/inc/url.php'); //include_once(M_PATH.'/lang/ru/lang.php'); include_once(M_PATH.'/inc/class.staticPages.php'); //include_once(M_PATH.'/inc/class.modules.php'); //include_once(M_PATH.'/inc/class.blocks.php'); //include_once(MAIN_SOURCE_PATH.'/inc/class.html.php'); include(MAIN_SOURCE_PATH.'/ext/ajax/JsHttpRequest.php'); $this -> JsHttpRequest = new JsHttpRequest( A_CHARSET ); $this -> act = !empty($_REQUEST['act']) ? $_REQUEST['act'] : $this -> act; $GLOBALS['_RESULT']['id_request'] = !empty($_REQUEST['id_request']) ? $_REQUEST['id_request'] : 0; $MAIN_PAGE -> set_key($this -> act); } public function get(){ //sleep(2); $func = $this -> act; if ( !method_exists($this ,$func) ){ sys_error(ERROR_404); } return $this -> $func(); } private function ajax_view(){ /*sys_block_disable(); $p = new staticPagesQuery('f'); $p -> include_tmpl('t','t.t_path'); $url = preg_replace('#^/#','',$_REQUEST['url']); if (! $p -> where_url($url) ){ sys_error(ERROR_404); } //$p -> set_debug(1); $p -> get('f.*,f.p_id as check_access',false); $row = $p -> row(); if ( !is_array($row)){ exit(); } if ( !$row['check_access'] ){ exit(); } // меняем вывод блоков //$MAIN_PAGE -> set_tmpl_id($row['t_id']); // меняем вывод шаблона //$MAIN_PAGE -> set_tmpl($row['t_path']); $GLOBALS['_RESULT']['content'] = $row['p_content']; $GLOBALS['_RESULT']['title'] =$row['p_meta_title']; exit();*/ } // выводим заданную страницу private function view(){ global $MAIN_PAGE,$MAIN_TMPL; $p = new staticPagesQuery('f'); $p -> include_tmpl('t','t.t_content,t.t_page_content_var,t.t_url'); $url = preg_replace('#^/#','',$_REQUEST['url']); if (! $p -> where_url($url) ){ sys_error(ERROR_404); } //$p -> set_debug(1); $p -> get('f.*,f.p_id as check_access',false); $row = $p -> row(); if ( !is_array($row)){ sys_error(ERROR_404); } if ( !$row['check_access'] ){ sys_error(ERROR_403); } //$MAIN_TMPL -> page_title = $row['p_title']; $MAIN_PAGE -> set_title(false,$row['p_meta_title'],MAIN_URL.'/'.$url); $MAIN_PAGE -> set_page_content_var($row['t_page_content_var']); // меняем вывод блоков $MAIN_PAGE -> set_tmpl_id($row['t_id']); // меняем вывод шаблона //$MAIN_PAGE -> set_tmpl($row['t_path']); if ( empty($row['t_url']) ) { $MAIN_PAGE -> set_content($row['t_content']); } else { $MAIN_PAGE -> info['t_url'] = $row['t_url']; } //$MAIN_PAGE -> set_meta_title($row['p_meta_title']); HL::set_meta('desc',$row['p_meta_desc']); HL::set_meta('keywords',$row['p_meta_keywords']); //$MAIN_PAGE -> set_meta_keywords($row['p_meta_desc']); // $MAIN_PAGE -> set_meta_description($row['p_meta_keywords']); // выдаём контент if( $row['p_type_content']=='HTML' ){ return $row['p_content']; }elseif( $row['p_type_content']=='PHP' ){ return eval($row['p_type_content']); }elseif( $row['p_type_content']=='TMPL'){ // блоки генерим заранее, чтобы на них можно было ссылаться в шаблоне sys_blocks_enable(); $t = new PHPTAL(); $t -> setSource($row['p_content']); return $t -> execute(); } } } ?>