コード例 #1
0
 /**
  * 不做权限处理, 所有用户权限相同
  * 游客即可访问, 不需要判断登录;
  * 需要登录的控制器extends别的基类
  */
 protected function _initialize()
 {
     define('MID', is_login());
     $model = new ConfigModel();
     $model->loadConfig();
     $this->_idtoken();
     //session令牌, 用于避免页面重复生成member_id
 }
コード例 #2
0
 /**
  * 不做权限处理, 所有用户权限相同
  * 游客即可访问, 不需要判断登录;
  * 需要登录的控制器extends别的基类
  */
 protected function _initialize()
 {
     define('MID', is_login());
     if (!MID) {
         // 还没登录 跳转到登录页面
         $this->redirect(C('LOGIN_URL'));
     }
     $model = new ConfigModel();
     $model->loadConfig();
 }
コード例 #3
0
 /**
  * 不做权限处理, 所有用户权限相同
  * 游客即可访问, 不需要判断登录;
  * 需要登录的控制器extends别的基类
  */
 protected function _initialize()
 {
     defined('STID') or define('STID', is_login());
     // 		if (!defined('STID')) {
     // 			define('STID',2);
     // 			$store = M('Store')->find(STID);
     // 			$auth = array(
     // 					'id'		=> $store['id'],
     // 					'account'	=> $store['account'],
     // 					'logins'	=> $store['logins'],
     // 					'last_ip'	=> $store['last_ip']
     // 			);
     // 			session('user_auth', $auth);
     // 		}
     if (!STID) {
         // 还没登录 跳转到登录页面
         $this->redirect(C('LOGIN_URL'));
     }
     $model = new ConfigModel();
     $model->loadConfig();
 }
コード例 #4
0
 protected function _initialize()
 {
     defined('UID') or define('UID', is_login());
     //defined('UID') or define('UID',1); //调试使用
     if (!UID) {
         // 还没登录 跳转到登录页面
         $this->redirect(C('LOGIN_URL'));
     }
     $model = new ConfigModel();
     $model->loadConfig();
     defined('IS_ROOT') or define('IS_ROOT', is_administrator());
     // 检测访问权限
     $access = $this->accessControl();
     if ($access === false) {
         $this->error('403:禁止访问');
     } elseif ($access === null) {
         //检测非动态权限
         $rule = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME);
         if (!$this->checkRule($rule, array('in', '1,2'))) {
             $this->error('未授权访问!');
         }
     }
 }
コード例 #5
0
 protected function _initialize()
 {
     $model = new ConfigModel();
     $model->loadConfig();
 }