original_string: final public function read($id = Null)
      {
  
          $self = $this;
  
          $input = $this->input;
          $uri = $this->uri;
          //$dbo = Database::getInstance();
  
          $splash = $self->getSplash();
  
          //Do we have a cookie?
          $sessCookie = md5($self->cookie . $splash['agent'] . $splash['ip'] . $splash['domain']);
  
          $sessId = $input->getCookie($sessCookie);
  
          if (empty($sessId) || !$sessId) {
              //we will have to create a new session
              return false;
          }
  
          $userIp = md5($input->serialize($input->getVar('REMOTE_ADDR', \IS\STRING, '', 'server')));
          $userAgent = md5($input->serialize($input->getVar('HTTP_USER_AGENT', \IS\STRING, '', 'server')));
          $userDomain = md5($input->serialize((string)$uri->getHost()));
  
          //Read the session
          //$_handler = ucfirst($self->store);
          $handler = $this->handler;
          $object = $handler->read($splash, $self, $sessId);
  
          //If this is not an object then we have a problem
          if (!is_object($object)) return false;
  
          //Redecorate
          $splash = array(
              "ip" => $userIp,
              "agent" => $userAgent,
              "domain" => $userDomain,
              "token" => $object->session_token
          );
  
          $testId = $self->generateId($splash);
  
          if ($testId <> $sessId) {
              $this->destroy($sessId);
              return false; //will lead to re-creation
          }
  
          //check if expired
          $now = time();
          if ($object->session_expires < $now) {
              $this->destroy($sessId);
              return false; //Will lead to re-creation of a new one
          }
  
          $self->ip = $object->session_ip;
          $self->agent = $object->session_agent;
          $self->token = $object->session_token;
          $self->id = $sessId;
  
          //@TODO Restore the registry
          //which hopefully should contain auth and other serialized info in namespsaces
          $registry = new Registry("default");
  
          //Validate?
          if (!empty($object->session_registry)) {
              //First get an instance of the registry, just to be sure its loaded
              $registry = $input->unserialize($object->session_registry);
              $self->registry = $registry;
              $_SESSION = $self->getNamespace("default")->getAllData();
          } else {
              //just re-create a default registry
              $_SESSION = array(); //Session is array;
              //Because we can't restore
              $self->registry['default'] = $registry;
          }
          //Update total requests in the default namespace;
          $reqCount = $self->get("totalRequests");
          $newCount = $reqCount + 1;
  
          //Set a total Requests Count
          $self->set("totalRequests", $newCount);
  
          //Return the session Id, to pass to self::update
          return $sessId;
      }
code: final public function read($id = Null)
      {
  
          $self = $this;
  
          $input = $this->input;
          $uri = $this->uri;
          //$dbo = Database::getInstance();
  
          $splash = $self->getSplash();
  
          //Do we have a cookie?
          $sessCookie = md5($self->cookie . $splash['agent'] . $splash['ip'] . $splash['domain']);
  
          $sessId = $input->getCookie($sessCookie);
  
          if (empty($sessId) || !$sessId) {
              //we will have to create a new session
              return false;
          }
  
          $userIp = md5($input->serialize($input->getVar('REMOTE_ADDR', \IS\STRING, '', 'server')));
          $userAgent = md5($input->serialize($input->getVar('HTTP_USER_AGENT', \IS\STRING, '', 'server')));
          $userDomain = md5($input->serialize((string)$uri->getHost()));
  
          //Read the session
          //$_handler = ucfirst($self->store);
          $handler = $this->handler;
          $object = $handler->read($splash, $self, $sessId);
  
          //If this is not an object then we have a problem
          if (!is_object($object)) return false;
  
          //Redecorate
          $splash = array(
              "ip" => $userIp,
              "agent" => $userAgent,
              "domain" => $userDomain,
              "token" => $object->session_token
          );
  
          $testId = $self->generateId($splash);
  
          if ($testId <> $sessId) {
              $this->destroy($sessId);
              return false; //will lead to re-creation
          }
  
          //check if expired
          $now = time();
          if ($object->session_expires < $now) {
              $this->destroy($sessId);
              return false; //Will lead to re-creation of a new one
          }
  
          $self->ip = $object->session_ip;
          $self->agent = $object->session_agent;
          $self->token = $object->session_token;
          $self->id = $sessId;
  
          //@TODO Restore the registry
          //which hopefully should contain auth and other serialized info in namespsaces
          $registry = new Registry("default");
  
          //Validate?
          if (!empty($object->session_registry)) {
              //First get an instance of the registry, just to be sure its loaded
              $registry = $input->unserialize($object->session_registry);
              $self->registry = $registry;
              $_SESSION = $self->getNamespace("default")->getAllData();
          } else {
              //just re-create a default registry
              $_SESSION = array(); //Session is array;
              //Because we can't restore
              $self->registry['default'] = $registry;
          }
          //Update total requests in the default namespace;
          $reqCount = $self->get("totalRequests");
          $newCount = $reqCount + 1;
  
          //Set a total Requests Count
          $self->set("totalRequests", $newCount);
  
          //Return the session Id, to pass to self::update
          return $sessId;
      }
code_tokens: final public function read ( $ id = Null ) { $ self = $ this ; $ input = $ this -> input ; $ uri = $ this -> uri ; //$dbo = Database::getInstance(); $ splash = $ self -> getSplash ( ) ; //Do we have a cookie? $ sessCookie = md5 ( $ self -> cookie . $ splash [ 'agent' ] . $ splash [ 'ip' ] . $ splash [ 'domain' ] ) ; $ sessId = $ input -> getCookie ( $ sessCookie ) ; if ( empty ( $ sessId ) || ! $ sessId ) { //we will have to create a new session return false ; } $ userIp = md5 ( $ input -> serialize ( $ input -> getVar ( 'REMOTE_ADDR' , \ IS \ STRING , '' , 'server' ) ) ) ; $ userAgent = md5 ( $ input -> serialize ( $ input -> getVar ( 'HTTP_USER_AGENT' , \ IS \ STRING , '' , 'server' ) ) ) ; $ userDomain = md5 ( $ input -> serialize ( ( string ) $ uri -> getHost ( ) ) ) ; //Read the session //$_handler = ucfirst($self->store); $ handler = $ this -> handler ; $ object = $ handler -> read ( $ splash , $ self , $ sessId ) ; //If this is not an object then we have a problem if ( ! is_object ( $ object ) ) return false ; //Redecorate $ splash = array ( "ip" => $ userIp , "agent" => $ userAgent , "domain" => $ userDomain , "token" => $ object -> session_token ) ; $ testId = $ self -> generateId ( $ splash ) ; if ( $ testId <> $ sessId ) { $ this -> destroy ( $ sessId ) ; return false ; //will lead to re-creation } //check if expired $ now = time ( ) ; if ( $ object -> session_expires < $ now ) { $ this -> destroy ( $ sessId ) ; return false ; //Will lead to re-creation of a new one } $ self -> ip = $ object -> session_ip ; $ self -> agent = $ object -> session_agent ; $ self -> token = $ object -> session_token ; $ self -> id = $ sessId ; //@TODO Restore the registry //which hopefully should contain auth and other serialized info in namespsaces $ registry = new Registry ( "default" ) ; //Validate? if ( ! empty ( $ object -> session_registry ) ) { //First get an instance of the registry, just to be sure its loaded $ registry = $ input -> unserialize ( $ object -> session_registry ) ; $ self -> registry = $ registry ; $ _SESSION = $ self -> getNamespace ( "default" ) -> getAllData ( ) ; } else { //just re-create a default registry $ _SESSION = array ( ) ; //Session is array; //Because we can't restore $ self -> registry [ 'default' ] = $ registry ; } //Update total requests in the default namespace; $ reqCount = $ self -> get ( "totalRequests" ) ; $ newCount = $ reqCount + 1 ; //Set a total Requests Count $ self -> set ( "totalRequests" , $ newCount ) ; //Return the session Id, to pass to self::update return $ sessId ; }
docstring: Reads session data from session stores
  
  @param string $id
  @return Boolean False on failed and session ID on success
docstring_tokens: Reads session data from session stores