MDL-23479 scorm restore code - correct time shifting
[moodle.git] / login / logout.php
blob8ecaec7baff109ade2a3caa1a76ba54ea23e4e2f
1 <?php
3 // This file is part of Moodle - http://moodle.org/
4 //
5 // Moodle is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 //
10 // Moodle is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 /**
19 * Logs the user out and sends them to the home page
21 * @copyright 1999 Martin Dougiamas http://dougiamas.com
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 * @package login
26 require_once("../config.php");
28 // can be overriden by auth plugins
29 $redirect = $CFG->wwwroot.'/';
31 $sesskey = optional_param('sesskey', '__notpresent__', PARAM_RAW); // we want not null default to prevent required sesskey warning
33 if (!isloggedin()) {
34 // no confirmation, user has already logged out
35 require_logout();
36 redirect($redirect);
38 } else if (!confirm_sesskey($sesskey)) {
39 $url = new moodle_url('/login/logout.php');
40 if ($sesskey !== '__notpresent__') $url->param('sesskey', $sesskey);
41 $PAGE->set_url($url);
42 $PAGE->set_title($SITE->fullname);
43 $PAGE->set_heading($SITE->fullname);
44 echo $OUTPUT->header();
45 echo $OUTPUT->confirm(get_string('logoutconfirm'), 'logout.php', $CFG->wwwroot.'/');
46 echo $OUTPUT->footer();
47 die;
50 $authsequence = get_enabled_auth_plugins(); // auths, in sequence
51 foreach($authsequence as $authname) {
52 $authplugin = get_auth_plugin($authname);
53 $authplugin->logoutpage_hook();
56 require_logout();
58 redirect($redirect);