]> git.mjollnir.org Git - moodle.git/commitdiff
Check that glossary is correct before edit categories.
authorstronk7 <stronk7>
Sun, 29 Aug 2004 23:28:57 +0000 (23:28 +0000)
committerstronk7 <stronk7>
Sun, 29 Aug 2004 23:28:57 +0000 (23:28 +0000)
Bug 1838
(http://moodle.org/bugs/bug.php?op=show&bugid=1838)

Merged from MOODLE_14_STABLE

mod/glossary/editcategories.php

index 3dd0c09403d4bc179f5ca2db842de307d37d0b85..95476f48bc1810d047097c5650e16da56512b382 100644 (file)
         error("Course module is incorrect");
     }
 
+    if ($hook) {
+          if ($category = get_record("glossary_categories","id",$hook)) {
+              //Check it belongs to the same glossary
+              if ($category->glossaryid != $glossary->id) {
+                  error("Glossary is incorrect");
+              }
+          } else {
+              error("Category is incorrect");
+          }
+    }
+
     require_login($course->id);
 
      if ( !isteacher($course->id) ) {
@@ -49,7 +60,6 @@
                   navmenu($course, $cm));
 
      if ( $hook ) {
-          $category = get_record("glossary_categories","id",$hook);
 
           if ( $action == "edit" ) {
                if ( $confirm ) {