12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- class CommonAction extends Action {
-
-
- public function _initialize( ){
- //项目信息
- $this->project_id = C('CC_PROJECT_ID');
- if(!$this->project_id){
- echo 'project_id empty';
- return;
- }
- $this->site_title = C('SITE_TITLE') ? : '用户中心';
- $this->site_copyright = C('SITE_COPYRIGHT') ? : '版权所有';
-
- //跳过检查登录的操作
- if(in_array(ACTION_NAME,array('login','login2','register','init','set_screen_msg') ))
- return;
- if(strpos(ACTION_NAME,'api_')===0)
- return;
-
- //获取用户信息
- $this->userid = \Jiaruan\UcCookie::get();
- if(!$this->userid){
- header('Location: ?s=uc_manage/login');
- exit;
- }
- $cond = array('ID'=>$this->userid);
- $this->userinfo = M('uc_user')->where($cond)->find();
-
- //跳转到登录页面
- if(!$this->userinfo){
- header('Location: ?s=uc_manage/login');
- exit;
- }
- }
-
- }
|