Exemple #1
0
 /**
  * 
  * Checks if an entry has expired (is past its lifetime) or not.
  * 
  * If lifetime is empty (zero), then the entry never expires.
  * 
  * @param string $key The entry key with prefix already added.
  * 
  * @return bool
  * 
  */
 protected function _isExpired($key)
 {
     // is life set as "forever?"
     if (!$this->_life) {
         return false;
     }
     // is it past its expiration date?
     if (time() >= $this->_expires->get($key)) {
         return true;
     }
     // not expired yet
     return false;
 }
Exemple #2
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // only set up the handler if it doesn't exist yet.
     if (!self::$_handler) {
         self::$_handler = Solar::dependency('Solar_Session_Handler', $this->_config['handler']);
     }
     // only set up the request if it doesn't exist yet.
     if (!self::$_request) {
         self::$_request = Solar_Registry::get('request');
     }
     // determine the storage segment; use trim() and strict-equals to
     // allow for string zero segment names.
     $this->_class = trim($this->_config['class']);
     if ($this->_class === '') {
         $this->_class = 'Solar';
     }
     // set the class
     $this->setClass($this->_class);
     // lazy-start any existing session
     $this->lazyStart();
 }
Exemple #3
0
 /**
  * 
  * Is there a token value in the session already?
  * 
  * @return string
  * 
  */
 public function hasToken()
 {
     $this->_update();
     return self::$_session->has('token');
 }
Exemple #4
0
 /**
  * 
  * Post-construction tasks to complete object construction.
  * 
  * @return void
  * 
  */
 protected function _postConstruct()
 {
     parent::_postConstruct();
     // only set up the handler if it doesn't exist yet.
     if (!self::$_handler) {
         self::$_handler = Solar::dependency('Solar_Session_Handler', $this->_config['handler']);
     }
     // only set up the request if it doesn't exist yet.
     if (!self::$_request) {
         self::$_request = Solar_Registry::get('request');
     }
     // determine the storage segment; use trim() and strict-equals to
     // allow for string zero segment names.
     $this->_class = trim($this->_config['class']);
     if ($this->_class === '') {
         $this->_class = 'Solar';
     }
     // set the class
     $this->setClass($this->_class);
     // lazy start: find the cookie name and look for the session cookie
     $name = session_name();
     if (self::$_request->cookie($name)) {
         // a previous session exists, start it
         $this->start();
     }
 }
Exemple #5
0
 /**
  * 
  * Logout processing.
  * 
  * @return void
  * 
  */
 protected function _processLogout()
 {
     // change status
     $this->reset(Solar_Auth::ANON);
     // End the entire session
     $this->_session->stop();
 }