|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00027 require_once('../config.php'); 00028 00029 $PAGE->set_url('/login/logout.php'); 00030 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); 00031 00032 $sesskey = optional_param('sesskey', '__notpresent__', PARAM_RAW); // we want not null default to prevent required sesskey warning 00033 $login = optional_param('loginpage', 0, PARAM_BOOL); 00034 00035 // can be overridden by auth plugins 00036 if ($login) { 00037 $redirect = get_login_url(); 00038 } else { 00039 $redirect = $CFG->wwwroot.'/'; 00040 } 00041 00042 if (!isloggedin()) { 00043 // no confirmation, user has already logged out 00044 require_logout(); 00045 redirect($redirect); 00046 00047 } else if (!confirm_sesskey($sesskey)) { 00048 $PAGE->set_title($SITE->fullname); 00049 $PAGE->set_heading($SITE->fullname); 00050 echo $OUTPUT->header(); 00051 echo $OUTPUT->confirm(get_string('logoutconfirm'), new moodle_url($PAGE->url, array('sesskey'=>sesskey())), $CFG->wwwroot.'/'); 00052 echo $OUTPUT->footer(); 00053 die; 00054 } 00055 00056 $authsequence = get_enabled_auth_plugins(); // auths, in sequence 00057 foreach($authsequence as $authname) { 00058 $authplugin = get_auth_plugin($authname); 00059 $authplugin->logoutpage_hook(); 00060 } 00061 00062 require_logout(); 00063 00064 redirect($redirect);