function system_handle_logout
Search API
6.x system.module | system_handle_logout() |
4.x system.module | system_handle_logout() |
5.x system.module | system_handle_logout() |
File
- modules/
system/ system.module, line 2343
Code
function system_handle_logout() {
global $user;
$name = $user->name;
$uid = $user->id;
// Check for hook_user_logout
$modules = modules_implement_hook("user_logout");
foreach ($modules as $module) {
call_user_func($module . '_user_logout');
}
// Finish up logging out.
watchdog("logout", "@user has logged out", array("@user" => "$name ($uid)"));
// In an effort to mimimize a bug in Safari, we will
// overwrite the SESSION variables, then perform a few other operations,
// to make sure they are well and truly destroyed.
foreach ($_SESSION as $key => $val) {
$_SESSION [$key] = "x";
}
foreach ($_SESSION as $key => $val) {
$_SESSION [$key] = FALSE;
}
$_SESSION = array();
if (isset($_COOKIE [session_name()])) // remove cookie by setting it to expire, if it's there.
{
$cookie_expires = time() - date('Z') - 3600;
setcookie(session_name(), '', $cookie_expires, '/');
}
// I know this is repetitive, but I want to make ABSOLUTELY SURE
// I am removing the session by removing it, creating a new one, then killing that one too.
session_destroy();
session_commit();
session_start();
session_destroy();
session_commit();
fp_goto("<front>", "logout=true");
}