-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDNS_Controller.php
executable file
·59 lines (47 loc) · 1.84 KB
/
DNS_Controller.php
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
<?php
class DNS_Controller extends CI_Controller{
protected $account_list = NULL;
protected $account_id = 0;
public function __construct() {
parent::__construct();
$this->load->model('user');
if ( ! $this->user->is_login()) {
$this->output->set_header('Location:/login');
}
$this->account_list = $this->daccount->get_list($this->user->id);
if (empty($this->account_list)) {
return;
}
$account_id = $this->session->userdata('account_id');
if ( ! isset($this->account_list[$account_id])) {
$account_id = key($this->account_list);
$this->session->set_userdata('account_id', $account_id);
}
$this->account_id = $account_id;
}
/**
* 封装视图加载函数
* @param string $name 视图名称
* @param array $param 参数
* @param string $active_menu 当前活跃菜单
*/
protected function load_view($name = NULL, $param = array(), $active_menu = 'domain')
{
$this->load->config('web');
$web_config_array = array(
'title' => $this->config->item('web_title'),
'keywords' => $this->config->item('web_keywords'),
'description' => $this->config->item('web_description'),
'base_url' => $this->config->item('web_baseurl'),
'nickname' => $this->user->nickname,
'active_menu' => $active_menu,
'account_list' => $this->account_list,
'account_id' => $this->account_id
);
$this->load->view('header', $web_config_array);
if ($name) {
$this->load->view($name, $param);
}
$this->load->view('footer');
}
}