mirror of
https://github.com/moodle/moodle.git
synced 2025-06-02 06:05:31 +02:00
adding a require_logout() function =)
This commit is contained in:
parent
3b32165cc7
commit
0302c52fd2
@ -1482,6 +1482,32 @@ function sesskey() {
|
||||
return $USER->sesskey;
|
||||
}
|
||||
|
||||
/* this function forces a user to log out */
|
||||
|
||||
function require_logout() {
|
||||
|
||||
if (isset($USER) and isset($USER->id)) {
|
||||
add_to_log(SITEID, "user", "logout", "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id);
|
||||
|
||||
if ($USER->auth == 'cas' && !empty($CFG->cas_enabled)) {
|
||||
require($CFG->dirroot.'/auth/cas/logout.php');
|
||||
}
|
||||
}
|
||||
|
||||
if (ini_get_bool("register_globals") and check_php_version("4.3.0")) {
|
||||
// This method is just to try to avoid silly warnings from PHP 4.3.0
|
||||
session_unregister("USER");
|
||||
session_unregister("SESSION");
|
||||
}
|
||||
|
||||
setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/');
|
||||
unset($_SESSION['USER']);
|
||||
unset($_SESSION['SESSION']);
|
||||
|
||||
unset($SESSION);
|
||||
unset($USER);
|
||||
|
||||
}
|
||||
/**
|
||||
* This function checks that the current user is logged in and has the
|
||||
* required privileges
|
||||
@ -6907,7 +6933,5 @@ function custom_script_path($urlpath='') {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user