]> git.mjollnir.org Git - moodle.git/commitdiff
YES!!! FINALLY fixed that damn bug that was causing the admin user
authormoodler <moodler>
Thu, 24 Jul 2003 08:36:43 +0000 (08:36 +0000)
committermoodler <moodler>
Thu, 24 Jul 2003 08:36:43 +0000 (08:36 +0000)
to be skipped during installation!

Bug 565 has the details, but basically it was caused by not initialising
the variable $user before using it.  Some people probably had a cookie
called "user" that was polluting the variable.

YAY!

admin/user.php

index c563aa95285f609de0d16e5a53ebf83a103dbab7..0a6614f1c890409c0433a65f820be6e1874bde73 100644 (file)
@@ -1,7 +1,7 @@
 <?PHP // $Id$
 
-       require_once("../config.php");
-       require_once("../user/lib.php");
+    require_once("../config.php");
+    require_once("../user/lib.php");
     require_once("../lib/countries.php");
 
     $recordsperpage = 30;
@@ -15,6 +15,8 @@
     optional_variable($search, "");
 
     if (! record_exists("user_admins")) {   // No admin user yet
+
+        unset($user);
         $user->firstname = get_string("admin");
         $user->lastname  = get_string("user");
         $user->username  = "admin";
@@ -29,6 +31,7 @@
             error("SERIOUS ERROR: Could not create admin user record !!!");
         }
 
+        unset($admin);
         $admin->userid = $user->id;
 
         if (! insert_record("user_admins", $admin)) {
@@ -43,6 +46,7 @@
             error("Could not find site-level course");
         }
 
+        unset($teacher);
         $teacher->userid = $user->id;
         $teacher->course = $site->id;
         $teacher->authority = 1;
         }
 
         echo "<TABLE align=center cellpadding=10><TR><TD>";
-           echo "<FORM ACTION=user.php METHOD=POST>";
-           echo "<INPUT TYPE=text NAME=search VALUE=\"$search\" SIZE=20>";
-           echo "<INPUT TYPE=submit VALUE=\"$strsearch\">";
+        echo "<FORM ACTION=user.php METHOD=POST>";
+        echo "<INPUT TYPE=text NAME=search VALUE=\"$search\" SIZE=20>";
+        echo "<INPUT TYPE=submit VALUE=\"$strsearch\">";
         if ($search) {
             echo "<INPUT type=\"button\" onClick=\"document.location='user.php';\" value=\"$strshowallusers\">";
         }
-           echo "</FORM>";     
+        echo "</FORM>";    
         echo "</TD></TR></TABLE>";
 
         print_table($table);