Blame view

mobile/source/modules/admin/stat_pages.php 2.32 KB
a1684257   Administrator   first commit
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
  <?php
  
  	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');
  		$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(2,$row['p_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']);
  		 $MAIN_PAGE -> set_content($row['t_content']);
  		 $MAIN_PAGE -> set_meta_title($row['p_meta_title']);
  		
  		 $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();
      }
  	}
  ?>