admin_stat_pages_view.php
3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/**
* @author: Bunzia Alexander <nifus@mail.ru> <http://www.weblancer.net/users/nifus/>
* @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();
}
}
}
?>