Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / login / logout.php
blob0d9e4842c6b00fb211558c6c15c0f7873fb506f2
1 <?php // $Id$
2 // Logs the user out and sends them to the home page
4 require_once("../config.php");
6 // can be overriden by auth plugins
7 $redirect = $CFG->wwwroot.'/';
9 $sesskey = optional_param('sesskey', '__notpresent__', PARAM_RAW); // we want not null default to prevent required sesskey warning
11 if (!isloggedin()) {
12 // no confirmation, user has already logged out
13 require_logout();
14 redirect($redirect);
16 } else if (!confirm_sesskey($sesskey)) {
17 print_header($SITE->fullname, $SITE->fullname, 'home');
18 notice_yesno(get_string('logoutconfirm'), 'logout.php', $CFG->wwwroot.'/', array('sesskey'=>sesskey()), null, 'post', 'get');
19 print_footer();
20 die;
23 $authsequence = get_enabled_auth_plugins(); // auths, in sequence
24 foreach($authsequence as $authname) {
25 $authplugin = get_auth_plugin($authname);
26 $authplugin->logoutpage_hook();
29 require_logout();
31 redirect($redirect);