Blame view

mobile/source/modules/admin/admin_control_plugins.php 2.2 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
78
79
80
81
82
83
84
85
86
  <?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_control_plugins{
  	private $error = false;
  	private $act = 'index';
  	private $JsHttpRequest = false;
  	private $table = 'system_plugins';
  	  
  	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.'/inc/class.plugins.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;
  		
  		preg_match('#^'.$MAIN_PAGE -> dirname().'_(.*)$#iUs',$_REQUEST['p_name'],$res);
  		$this -> path =$res[1];
  		$this -> path_tmpl = M_PATH.'/tmpl/'.$this -> path;
  	}
  	
  	public function get(){
  		$func = $this -> act;
  		if ( !method_exists($this ,$func) ){
  			sys_error(ERROR_404);
  		}
  		return $this -> $func();
  	}
  	
  
  	private function index(){
  		$t = new PHPTAL( $this -> path_tmpl.'/main.html' );
  		$p = new pluginsQuery('f');
  		//$p -> set_debug(1);
  		//$p -> include_module('m','m.m_name');
  		$p -> orderby_id('DESC');
  		$p -> get('f.* ',false);
  		$t -> rows = $p -> rows();
  		return $t -> execute();
  	}
  	
  
  	private function ajax_reload(){
  		sys_block_disable();
  		$t = new PHPTAL(  $this -> path_tmpl.'/inc/tmpl_row.html' );
  		$t -> execute = true;
  		$p = new pluginsQuery('f');;
  		//$p -> include_module('m','m.m_name');
  		$p -> orderby_id('DESC');
  		$p -> get('f.*',false);
  		$t -> rows = $p -> rows();
  		$GLOBALS['_RESULT']['content'] = $t -> execute();
  		exit();
  	}
  
  
  	
  
  
  	
  	
  	
  	
  	private function ajax_active(){
  		sys_block_disable();
  		$p = plugins::load_id($_POST['id']);
  	  $p -> set('active',$_POST['active']);
      $p -> update();
  		exit();
  	}
  
  }
  
  ?>