/** * * Has the user requested a prior session? * * @return bool * */ public function isContinuing() { if ($this->_stopped) { // Don't attempt to continue a session we've already destroyed return false; } $name = session_name(); return $this->_request->cookie($name); }
/** * * Lazy-start the session (i.e., only if a session cookie from the client * already exists). * * @return void * */ public function lazyStart() { // don't start more than once. if ($this->isStarted()) { // be sure the segment is loaded, though $this->load(); return; } $name = session_name(); if (self::$_request->cookie($name)) { // a previous session exists, start it $this->start(); } }
/** * * 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(); } }