예제 #1
0
파일: Admin.php 프로젝트: bjtenao/tudu-web
 /**
  *
  * 初始化Session
  */
 public function initUser()
 {
     if (null === $this->_session) {
         $this->_session = new Zend_Session_Namespace(self::SESSION_NAMESPACE, true);
     }
     // 登陆信息验证
     $names = $this->_options['cookies'];
     if (!isset($this->_session->auth) || !$this->_request->getCookie($names['username'])) {
         $this->destroySession();
         return;
     }
     if (isset($this->_session->auth['referer'])) {
         $this->_refererUrl = $this->_session->auth['referer'];
     }
     //var_dump($this->_request->getCookie($names['email']));exit();
     if ($this->_session->auth['username'] != $this->_request->getCookie($names['username'])) {
         $this->destroySession();
         return;
     }
     $this->_session->auth['lasttime'] = $this->_timestamp;
     $this->_user->init($this->_session->auth);
     if (!$this->_user->isLogined()) {
         $this->destroySession();
     }
     if (isset($this->_session->admin)) {
         $this->_user->initAdmin($this->_session->admin);
     }
     if (!$this->_user->isAdminLogined()) {
         $this->destroySession();
     }
     $this->org = $this->getOrg($this->_user->orgId);
     $this->_user->setOptions(array('timezone' => !empty($this->org['timezone']) ? $this->org['timezone'] : 'Etc/GMT-8', 'dateformat' => !empty($this->org['dateformat']) ? $this->org['dateformat'] : '%Y-%m-%d %H:%M:%S', 'passwordlevel' => $this->org['passwordlevel'], 'skin' => $this->org['skin']));
     $this->_sessionId = Zend_Session::getId();
     $this->_orgId = $this->_user->orgId;
 }