]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-9055 wrong creation of mnet auth object in require_logout() + minor cleanup;...
authorskodak <skodak>
Mon, 26 Mar 2007 20:35:04 +0000 (20:35 +0000)
committerskodak <skodak>
Mon, 26 Mar 2007 20:35:04 +0000 (20:35 +0000)
lib/moodlelib.php

index 4dee21541bc9dd9c1943a848d15c40efde007761..d7c1f0884a68897a6f9d53db142b85243e60c436 100644 (file)
@@ -1825,16 +1825,18 @@ function require_logout() {
 
     global $USER, $CFG, $SESSION;
 
-    if (isset($USER) and isset($USER->id)) {
+    if (isloggedin()) {
         add_to_log(SITEID, "user", "logout", "view.php?id=$USER->id&course=".SITEID, $USER->id, 0, $USER->id);
 
-        if ($USER->auth == 'cas' && !empty($CFG->cas_enabled)) {
+        //TODO: move following 2 ifs into auth plugins - add new logout hook
+        $authsequence = explode(',', $CFG->auth);
+
+        if (in_array('cas', $authsequence) and $USER->auth == 'cas' and !empty($CFG->cas_enabled)) {
             require($CFG->dirroot.'/auth/cas/logout.php');
         }
-        
-        if (extension_loaded('openssl')) {
-            require($CFG->dirroot.'/auth/mnet/auth.php');
-            $authplugin = new auth_plugin_mnet();
+
+        if (in_array('mnet', $authsequence) and $USER->auth == 'mnet') {
+            $authplugin = get_auth_plugin('mnet');;
             $authplugin->logout();
         }
     }