]> git.mjollnir.org Git - moodle.git/commitdiff
Robustness for $course variable
authormoodler <moodler>
Thu, 17 Apr 2003 13:20:26 +0000 (13:20 +0000)
committermoodler <moodler>
Thu, 17 Apr 2003 13:20:26 +0000 (13:20 +0000)
course/edit.html
course/edit.php

index c1cf479fe3ba1f5895092622a028a9e5d4cf9998..ec449f003e7b35977922886952b8a686ca67fc3b 100644 (file)
        <td></td>
        <td><input type="submit" value="<? print_string("savechanges") ?>"></td>
 </TABLE>
-<INPUT type="hidden" name="id" value="<?=$course->id ?>">
+<INPUT type="hidden" name="id" value="<?=$form->id ?>">
 </FORM>
index 80cbd1043138c1e055c9b834d35b96f6f0eb16c5..695cd13b86b5b007e46f679ebbaacdb2e72eba49 100644 (file)
@@ -22,6 +22,8 @@
         if (!iscreator()) {
             error("Only administrators and teachers can use this page");
         }
+
+        $course = NULL;
     }
 
     if (! $site = get_site()) {
@@ -29,6 +31,8 @@
     }
 
 
+
+
 /// If data submitted, then process and store.
 
        if ($form = data_submitted()) {
             $form->newsitems = 5;
             $form->showrecent = 1;
             $form->category = 1;
+            $form->id = "";
         }
     }
 
     $straddnewcourse = get_string("addnewcourse");
     $stradministration = get_string("administration");
 
-    if (isset($course)) {
+    if (!empty($course)) {
            print_header($streditcoursesettings, "$course->fullname", 
                      "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> 
                       -> $streditcoursesettings", $focus);