Permalink
Browse files

Better checking of admin user stuff

  • Loading branch information...
1 parent cae86de commit 01f290001475d42eac67a3e89b8ee8afce8ed37f moodler committed Mar 22, 2004
Showing with 9 additions and 2 deletions.
  1. +7 −2 admin/cron.php
  2. +2 −0 admin/index.php
View
@@ -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 "<pre>\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";
View
@@ -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");
}

0 comments on commit 01f2900

Please sign in to comment.