3 // This file is part of Moodle - http://moodle.org/
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.
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/>.
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
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
34 // no confirmation, user has already logged out
38 } else if (!confirm_sesskey($sesskey)) {
39 $url = new moodle_url('/login/logout.php');
40 if ($sesskey !== '__notpresent__') $url->param('sesskey', $sesskey);
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();
50 $authsequence = get_enabled_auth_plugins(); // auths, in sequence
51 foreach($authsequence as $authname) {
52 $authplugin = get_auth_plugin($authname);
53 $authplugin->logoutpage_hook();