forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logout.php
33 lines (24 loc) · 1001 Bytes
/
logout.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php // $Id$
// Logs the user out and sends them to the home page
require_once("../config.php");
// can be overriden by auth plugins
$redirect = $CFG->wwwroot.'/';
$sesskey = optional_param('sesskey', '__notpresent__', PARAM_RAW); // we want not null default to prevent required sesskey warning
if (!isloggedin()) {
// no confirmation, user has already logged out
require_logout();
redirect($redirect);
} else if (!confirm_sesskey($sesskey)) {
print_header($SITE->fullname, $SITE->fullname, 'home');
notice_yesno(get_string('logoutconfirm'), 'logout.php', $CFG->wwwroot.'/', array('sesskey'=>sesskey()), null, 'post', 'get');
print_footer();
die;
}
$authsequence = get_enabled_auth_plugins(); // auths, in sequence
foreach($authsequence as $authname) {
$authplugin = get_auth_plugin($authname);
$authplugin->logoutpage_hook();
}
require_logout();
redirect($redirect);
?>