Beispiel #1
0
 /**
  * Loads the selected Session Handler from the config and starts the actual session
  *
  * @param string $name Name of the session
  */
 private function startSession($name)
 {
     if (!isset($_SESSION)) {
         if (headers_sent()) {
             throw new \Exception('headers already sent by');
         }
         if ($this->config->has('sessions')) {
             $session = $this->config->get('session');
             if (array_key_exists('type', $session)) {
                 $sessionClass = 'Aliegon\\Session\\Handler\\' . ucfirst($session['type']) . 'SessionHandler';
                 $sessionHandler = new $sessionClass($this->getConfig());
                 session_set_save_handler(array(&$sessionHandler, "open"), array(&$sessionHandler, "close"), array(&$sessionHandler, "read"), array(&$sessionHandler, "write"), array(&$sessionHandler, "destroy"), array(&$sessionHandler, "gc"));
             }
             if (array_key_exists('lifetime', $session)) {
                 ini_set("session.gc_maxlifetime", $session['maxlifetime']);
             }
         }
         session_name($name);
         session_start();
     }
 }