]> git.mjollnir.org Git - moodle.git/commitdiff
Add check for admin to isteacher() rather than doing checks everywhere else
authormartin <martin>
Wed, 3 Apr 2002 06:30:09 +0000 (06:30 +0000)
committermartin <martin>
Wed, 3 Apr 2002 06:30:09 +0000 (06:30 +0000)
lib/moodlelib.php

index 19ec0442f839f5706e48da7455e72db4963d91c5..729ba863b1ddfa0d4bd47cedb3745bf0049c49ba 100644 (file)
@@ -713,6 +713,10 @@ function isadmin($userid=0) {
 function isteacher($course, $userid=0) {
     global $USER;
 
+    if (isadmin($userid)) {  // admins can do anything the teacher can
+        return true;
+    }
+
     if (!$userid) {
         return $USER->teacher[$course];
     }
@@ -746,7 +750,7 @@ function set_moodle_cookie($thing) {
     $days = 60;
     $seconds = 60*60*24*$days;
 
-    setCookie ('MOODLEID');
+    setCookie ('MOODLEID', "", time() - 3600, "/");
     setCookie ('MOODLEID', rc4encrypt($thing), time()+$seconds, "/");
 }