Пример #1
0
 /**
  * Respect session configuration (default driver)
  */
 public static function instance($type = NULL, $id = NULL)
 {
     if (is_null($type)) {
         $type = Kohana::config('session')->driver;
     }
     return Kohana_Session::instance($type, $id);
 }
Пример #2
0
 /**
  * Completes the authorisation process
  *
  * @param   Model_User $user 
  * @return  boolean
  */
 protected function _complete_login($user)
 {
     // Regenerate session_id
     $this->_session->regenerate();
     // Store username in session
     $this->_session->set($this->_config['session_key'], $user);
     return TRUE;
 }
Пример #3
0
 /**
  * Loads existing session data.
  *
  *     $session->read();
  *
  * @param   string   session id
  * @return  void
  */
 public function read($id = NULL)
 {
     try {
         parent::read($id);
     } catch (Session_Exception $e) {
         @header('Location: ' . $_SERVER['REQUEST_URI']);
         die('Error. Please try again.');
     }
 }
Пример #4
0
 /**
  * Override's Kohana's default session adapter with the adapter provided
  * in the site'
  * 
  * @param   string   type of session (native, cookie, etc)
  * @param   string   session identifier
  * @return  Session
  * @uses    Kohana::$config
  */
 public static function instance($type = NULL, $id = NULL)
 {
     // Load the configuration for this type
     $default_session_adapter = Kohana::$config->load('site')->get('default_session_adapter');
     if ($default_session_adapter) {
         $type = $default_session_adapter;
     }
     return parent::instance($type, $id);
 }
Пример #5
0
 /**
  * Clear stored authenticated session data.
  * Clears all data unless a $strategy_url_name is passed.
  * @param string $strategy_url_name
  */
 public function clear_authenticated($strategy_url_name = NULL)
 {
     $auth_session = $this->session->get($this->session_key);
     $valid_provider = isset($this->strategyMap[$strategy_url_name]['name']);
     if ($strategy_url_name and $valid_provider) {
         unset($auth_session[$this->strategyMap[$strategy_url_name]['name']]);
     } else {
         if (!$strategy_url_name) {
             $auth_session = array();
         }
     }
     $this->session->set($this->session_key, $auth_session);
 }