HEX
Server: Apache/2.4.6 (CentOS) PHP/5.6.39
System: Linux izj6c6ukj0hyugxsgmuxz3z 3.10.0-514.6.2.el7.x86_64 #1 SMP Thu Feb 23 03:04:39 UTC 2017 x86_64
User: root (0)
PHP: 5.6.39
Disabled: NONE
Upload Files
File: /web/data/www.tbbprovision.com/application/admin/controllers/IndexController.class.php
<?php
/**
 *  author      : liaoyaping
 *  createTime  : 2017/3/5 14:57
 *  description :
 */
class IndexController extends Controller
{
    public function __construct($controller, $action, $module)
    {
        parent::__construct($controller, $action, $module);
        $this->check_manage_login();
        $this->check_permission();
        $this->manage_init();
    }

    public function index_action()
    {
        //验证是否登录
        global $configs;

        $group_list = $this->model('manage')->table('manage_group')->where(array("gid in(0,".f::get_session('manage_user.group_id')."-1)"))->selectAll();

        $menu_id = array();
        foreach((array)$group_list as $v){
            $menu_id = array_merge($menu_id,@explode('#',trim($v['menu_list'],'#')));
        }
        $where_ext = " and mid in(0,".(implode(',',$menu_id)?trim(implode(',',$menu_id),','):'-1').")";
        if(f::get_session('manage_user.user_name')=='liaoyaping'){
            $where_ext='';
        }
        $menu = $this->_get_all_menu(0, $where_ext ,3);
        $this->assign('menu',$menu);
        $this->assign('open_sound',$configs['open_sound']);
        $this->render();

    }

    public function default_info_action()
    {
        $access = $this->model('index')->table('access')->where('1')->order('aid desc')->limit(0,30)->selectAll();
        $data = array();
        foreach((array)$access as $k=>$v){
            array_unshift($data,array($v['day'],$v['num']));
        }
        $this->assign('data',$data);
        $this->render();
    }

    public function change_access_type_action($parame=array())
    {
        $parame = str::strtoparames($parame);
        $type = (int)$parame['type'];
        $data = array();
        if($type==3){
            $access = $this->model('index')->table('access')->where('1 group by(year)')->field("*,sum(num) as num")->order('aid desc')->limit(0,30)->selectAll();
            foreach((array)$access as $k=>$v){
                array_unshift($data,array($v['year'],$v['num']));
            }
        }elseif($type==2){
            $access = $this->model('index')->table('access')->where('1 group by(month)')->field("*,sum(num)  as num")->order('aid desc')->limit(0,30)->selectAll();
            foreach((array)$access as $k=>$v){
                array_unshift($data,array($v['month'],$v['num']));
            }
        }else{
            $access = $this->model('index')->table('access')->where('1')->order('aid desc')->limit(0,30)->selectAll();
            foreach((array)$access as $k=>$v){
                array_unshift($data,array($v['day'],$v['num']));
            }
        }
        f::e_json($data);
    }

    /**
     * 提示用户浏览器版本
     */
    public function ie_action()
    {
        $this->render();
    }

    /**
     * 按照层级关系输出所有菜单栏目
     * @param int $parent_id    上级ID
     * @param int $dept         当前层级
     * @param int $max_dept     最大层级
     * @return mixed
     */
    private function _get_all_menu($parent_id=0,$where_ext='',$max_dept=2,$dept=1){

        $result = $this->model('menuConfig')->get_open_menu_by_parent_id($parent_id,$where_ext);
        if($dept==$max_dept){
            return $result;
        }
        $dept++;
        foreach((array)$result as $k=>$v){
            $result[$k]['child_list'] = $this->_get_all_menu($v['mid'],$where_ext,$max_dept,$dept);
        }
        return $result;
    }

    /**
     * 错误日志清空
     */
    public function clear_runtime_error_action()
    {
        file::write_file('/runtime/logs/','error.log','');
        $this->model('manage')->add_log('清空网站运行错误日志');
        echo "<h5 style='text-align: center;color:red;'>文件已经清空</h5>";
    }

    /**
     * 清空临时文件夹
     */
    public function clear_tmp_action()
    {
        ob_end_clean();
        echo "<style>body{padding:0;margin:2px;}p{background:#ddd;margin:0 0 2px 0;padding:5px;transition:all .3s ease-out;}#body p:first-child{background:green;font-weight: bold;font-size: 1em;color:#fff;}</style>";
        echo "<div id='body'></div>";
        flush();
        file::del_dir_ext(APP_PATH."/tmp/",0);
        //清除全局缓存文件
        file::del_file('/config/global_set.php');
        //清除前端缓存文件
        file::del_file('/config/site_config.php');
        echo "<h3>清除缓存完成</h3>";
    }

    /**
     * 检测新系统消息
     */
    public function get_new_info_action()
    {
        f::e_json("有新的文章待审核<a href='/?admin/news/list/' target='right-body'>点击去审核</a>".WEB_TIME);
    }
}