From: moodler Date: Mon, 22 Mar 2004 01:58:40 +0000 (+0000) Subject: Better checking of admin user stuff X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=01f290001475d42eac67a3e89b8ee8afce8ed37f;p=moodle.git Better checking of admin user stuff --- diff --git a/admin/cron.php b/admin/cron.php index b582e1aa9e..3996f39f2b 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -17,7 +17,9 @@ require_once("../config.php"); - $USER = get_admin(); + if (!$alreadyadmin = isadmin()) { + $USER = get_admin(); /// Temporarily, to provide environment for this script + } echo "
\n";
 
@@ -133,7 +135,10 @@
 
     echo "Cron script completed correctly\n";
 
-    unset($USER);
+    if (!$alreadyadmin) {
+        $SESSION = NULL;
+        $USER = NULL;
+    }
 
     $difftime = microtime_diff($starttime, microtime());
     echo "Execution took ".$difftime." seconds\n"; 
diff --git a/admin/index.php b/admin/index.php
index fdee2a5980..cd9f97eb42 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -346,6 +346,8 @@
     }
 
 /// Check for valid admin user
+    require_login();
+
     if (!isadmin()) {
         error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
     }