<?php
// +-----------------------------------------------------------------------------------
// | Software: [ThinkPHP framework]
// | Version: V4.0
// | Site: http://www.czreg.com
// +-----------------------------------------------------------------------------------
// | Author: 飘叶 <cds425@163.com>
// | Copyright (c) 2012-2014, http://www.czreg.com All Rights Reserved.
// | time:2014.10.25
// | explain:管理员权限验证类
// +-----------------------------------------------------------------------------------

namespace Admin\Controller;
use Think\Controller;
/**

 * 后台公共控制器

 */
class AdminController extends Controller {
    /**

     * 后台控制器初始化

     */
    public function _initialize () {

        $auth=session(user_auth);
        $AUTH = new \Think\Auth();
        $auth=session(user_auth);
        if($auth['id']==''){
            $this->redirect('Public/login');
        }
        if(!$AUTH->check(MODULE_NAME.'/'.CONTROLLER_NAME, $auth['status'])){
                $this->error('没有权限',U('Index/index'));
        }

        //输出管理员信息

        $this->admininfo    = M('Admin')->where(array('id'=>$auth['id']))->find();
        $configset          = M('Config')->limit(1)->find();//网站配置输出
        $this->configset    = $configset;//网站配置输出
        if($configset['upimg']==1){
            $this->IMGURL   =$configset['imgurl'];//图片远程地址
        }else{
            $this->IMGURL   ='/Uploads/';//图片本地地址
        }
    }
}  