chengkun
2025-05-26 8f3df543230cd4403368b39b9bbe5726d11a0284
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
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
 
class index_controller extends siteadmin_controller{
    function index_action($set=''){
        
        global $db_config;
        $this->yunset("db_config",$db_config);
        $_POST=$this->post_trim($_POST);    
        if (!empty ($_POST['username']) && !empty ($_POST['password'])){
            if(strpos($this->config['code_web'],'后台登录')!==false){
                if ($this->config['code_kind']==1){
                    if(md5(strtolower($_POST['authcode']))===$_SESSION['authcode']){
                        unset($_SESSION['authcode']);
                        $this->admin_get_user_login($_POST['username'], $_POST['password']);
                    }else{
                        unset($_SESSION['authcode']);
                        $this->ACT_layer_msg("验证码错误!",8,"index.php");
                    }
                }elseif ($this -> config['code_kind'] > 2) {
                    
                    $check    =    verifytoken($this->config);
                    // 极验验证
                    if ($check['code'] != '200') {
                        $this -> ACT_layer_msg($check['msg'], 8, 'index.php');
                    } else {
                        $this -> admin_get_user_login($_POST['username'], $_POST['password']);
                    }
                    
                }
            }else{
                $this->admin_get_user_login($_POST['username'], $_POST['password']);
            }
        } 
        $tpname=$this->admin_get_user_shell($_SESSION['auid'],$_SESSION['ashell'])? 'index':'login'; 
        if($tpname=="login"){
 
            $this->siteadmin_tpl(array($tpname));
            die;
        }
 
        //权限配置
        $adminM    =  $this -> MODEL('admin');
        
        $power     =  $adminM -> getPower(array('uid'=>$_SESSION['auid']));
        
        $this -> yunset('power', $power['power']);
        
        $nav_user  =  array(
            'name'        =>  $power['name'],
            'group_name'  =>  $power['group_name']
        );
        //查询最近登录时间
        $logM  =  $this->MODEL('log');
 
        $adminLog  =  $logM -> getAdminLog(array('uid' => $_SESSION['auid'],'content' => '登录成功','orderby' => 'ctime'));
        //导航配置,$config['did']当前分站的编号,dids包含s或$config['did']的导航栏为当前分站可访问的
        $navM        =    $this -> MODEL('navigation');
        
        $navList    =    $navM -> getAdminNavList(array('dids'=>1,'display'=>array('<>',1),'id'=>array('in', pylode(',', $power['power'])),'orderby'=>'sort,ASC'),array('utype'=>'power'));
        
        $setarr        =    array(
            'one_menu'        =>  $navList['one_menu'],
            'two_menu'        =>  $navList['two_menu'],
            'navigation'      =>  $navList['navigation'],
            'menu'            =>  $navList['menu'],
            'nav_user'        =>  $nav_user,
            'admin_lasttime'  =>  $adminLog['ctime'] ? $adminLog['ctime'] : time()
        );
        
        $this -> yunset($setarr);
        
        //获取默认页面
        if(is_array($navList['navigation'])){
            foreach($navList['navigation'] as $v){
                $navigation_url_id[]=$v['id'];
            } 
            $navigation_url=$this->GET_web_default($navigation_url_id,$power['power']);
        }
        if($set == ''){
            $this->siteadmin_tpl(array($tpname));
        }
    }
    function logout_action()
    {
        $this -> adminlogout();
        
        $this->layer_msg("您已成功退出!",9,0,"index.php");
    }
    function del_cache_action(){
        $cache=$this->del_dir("../data/templates_c",1);
        $cache=$this->del_dir("../data/cache",1);
        if($cache==true){
            $this->layer_msg("更新成功!",9,0,"index.php");
        }else{
            $this->layer_msg("更新失败,请检查是否有权限!",8,0,"index.php");
        }
    }
    //后台地图
    function map_action(){
        
        $this->index_action(1);
        
        $this->siteadmin_tpl(array('admin_map'));
    }
    //后台地图
    function topmenu_action(){
        
        $id    =    (int)$_GET['id'];
        //解决ie9 $.get $.post 回调函数的返回值为undefine
        header("Content-Type: text/html; charset=UTF-8");
        
        if($id=="1000"){
            echo  "管理首页";
        }else{
            $arr    =    $this->GET_web_check($id);
            
            $n        =    explode("-",$arr);
            
            unset($n[count($n)-1]);
            
            echo implode("-",$n);
        }
    }
    function shortcut_menu_action(){
        
        $tpname    =    $this->admin_get_user_shell($_SESSION['auid'],$_SESSION['ashell']);
        
        if($_POST['chk_value'] && is_array($tpname)){
            
            $navM    =  $this -> MODEL('navigation');
            
            $navM -> upAdminNav(array('menu'=>1),array('menu'=>2));
            
            $navM -> upAdminNav(array('menu'=>2),array('id'=>array('in',@implode(',', $_POST['chk_value']))));
            
            echo 1;die;
        }else{
            $this->ACT_layer_msg("无权操作!",8,$this->config['sy_weburl'],2,1);
        }
    }
    function msgNum_action(){
        
        $MsgNum    =    $this -> MODEL('msgNum');
        
        echo $MsgNum->msgNum();
    }
}
?>