exists() public method

Does session exists for the current request?
public exists ( ) : boolean
return boolean
コード例 #1
0
ファイル: SessionSection.php プロジェクト: jave007/test
 /**
  * Determines whether a variable in this session section is set.
  * @param  string    name
  * @return bool
  */
 public function __isset($name)
 {
     if ($this->session->exists()) {
         $this->start();
     }
     return isset($this->data[$name]);
 }
コード例 #2
0
 /**
  * Returns and initializes $this->sessionSection.
  *
  * @return SessionSection
  */
 protected function getSessionSection($need)
 {
     if ($this->sessionSection !== null) {
         return $this->sessionSection;
     }
     if (!$need && !$this->sessionHandler->exists()) {
         return null;
     }
     $this->sessionSection = $section = $this->sessionHandler->getSection('Nette.Http.UserStorage/' . $this->namespace);
     if (!$section->identity instanceof IIdentity || !is_bool($section->authenticated)) {
         $section->remove();
     }
     if ($section->authenticated && $section->expireBrowser && !$section->browserCheck) {
         // check if browser was closed?
         $section->reason = self::BROWSER_CLOSED;
         $section->authenticated = false;
         if ($section->expireIdentity) {
             unset($section->identity);
         }
     }
     if ($section->authenticated && $section->expireDelta > 0) {
         // check time expiration
         if ($section->expireTime < time()) {
             $section->reason = self::INACTIVITY;
             $section->authenticated = false;
             if ($section->expireIdentity) {
                 unset($section->identity);
             }
         }
         $section->expireTime = time() + $section->expireDelta;
         // sliding expiration
     }
     if (!$section->authenticated) {
         unset($section->expireTime, $section->expireDelta, $section->expireIdentity, $section->expireBrowser, $section->browserCheck, $section->authTime);
     }
     return $this->sessionSection;
 }