/** @test */ public function endShouldEmitEndEvent() { $dog = new Dog(); $session = new Session(0, $dog); $session->on('end', $this->expectCallableOnce()); $session->end(); }
public static function end($type) { if (static::get('type')) { return; } Session::end(); static::set('type', $type); static::set('duration', microtime(true) - static::get('start')); static::set('memory', memory_get_peak_usage(true)); static::set('classes', Loader::getFiles()); }
static function to($url, $permanent = false) { $_POST = null; //Generalize this if (!preg_match("/^https?:/", $url)) { $url = UrlHelper::localized($url); } if ($permanent) { header("HTTP/1.1 301 Moved Permanently"); } PluginManager::getInstance()->onRedirect($url); Session::end(true); header('Location: ' . $url); exit; }
echo file_get_contents(PATH . 'system/admin/theme/error_config.php'); exit(1); } // Register the default timezone for the application. date_default_timezone_set(Config::get('application.timezone')); // set locale if (setlocale(LC_ALL, Config::get('application.language') . '.utf8') === false) { Log::warning('setlocate failed, please check your system has ' . Config::get('application.language') . ' installed.'); } // Register the PHP exception handler. set_exception_handler(array('Error', 'exception')); // Register the PHP error handler. set_error_handler(array('Error', 'native')); // Register the shutdown handler. register_shutdown_function(array('Error', 'shutdown')); /** Start session handler */ Session::start(); /** Handle routing */ Anchor::run(); /** Close and end session */ Session::end(); /** Output awesomeness! */ Response::send();
/** * Sets a session variable. * The function will temporarily reopen the session for the duration * of the call if it is closed. * * @param string $name The name of the variable to set. * @param mixed $value The value to set the variable to. * @return void */ public static function set($name, $value) { if (self::$opened) { $_SESSION[$name] = $value; } else { Session::start(); $_SESSION[$name] = $value; Session::end(); } }
<?php /** * ============================== * Aegis Framework | MIT License * http://www.aegisframework.com/ * ============================== */ $session = new Session(); $session->end(); header("location:/");
<?php require 'Models/Session.php'; $S = new Session(); $S->end(); header('Location: /#loggedout' . session_id()); die;