]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8973 : Update to the require_logout function to ensure that the user's auth plugi...
authordonal72 <donal72>
Sun, 29 Apr 2007 15:01:47 +0000 (15:01 +0000)
committerdonal72 <donal72>
Sun, 29 Apr 2007 15:01:47 +0000 (15:01 +0000)
lib/moodlelib.php

index 72a5f09393ee9b90407829dd3033affe7519f19a..57892eb1bbcf74566a1cdba78af3e7aa9198d73a 100644 (file)
@@ -1828,11 +1828,11 @@ function require_logout() {
     if (isloggedin()) {
         add_to_log(SITEID, "user", "logout", "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id);
 
-        $authsequence = get_enabled_auth_plugins(); // auths, in sequence
-        foreach($authsequence as $authname) {
-            $authplugin = get_auth_plugin($authname);
-            $authplugin->prelogout_hook();
+        if (!isset($USER->auth) && empty($USER->auth)) {
+            $USER->auth = get_field('user', 'auth', 'id', $USER->id);
         }
+        $authplugin = get_auth_plugin($USER->auth);
+        $authplugin->prelogout_hook();
     }
 
     if (ini_get_bool("register_globals") and check_php_version("4.3.0")) {
@@ -1841,7 +1841,15 @@ function require_logout() {
         session_unregister("SESSION");
     }
 
-    setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath);
+    // Initialize variable to pass-by-reference to headers_sent(&$file, &$line)
+    $file = $line = null;
+    if (headers_sent($file, $line)) {
+        error_log('MoodleSessionTest cookie could not be set in moodlelib.php:'.__LINE__);
+        error_log('Headers were already sent in file: '.$file.' on line '.$line);
+    } else {
+        setcookie('MoodleSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->sessioncookiepath);
+    }
+
     unset($_SESSION['USER']);
     unset($_SESSION['SESSION']);