Followup to MDL-8994 - validate the category id we got from the form. Merged from...
authortjhunt <tjhunt>
Thu, 22 Mar 2007 22:02:14 +0000 (22:02 +0000)
committertjhunt <tjhunt>
Thu, 22 Mar 2007 22:02:14 +0000 (22:02 +0000)
question/type/questiontype.php

index fa481e93a1462a1d11e4076e888196cd3b56084c..dfa507e5b4fdeaac92fab2ee87cc4613d4d8c7c5 100644 (file)
@@ -150,6 +150,9 @@ class default_questiontype {
         // question types.
 
         // First, save the basic question itself
+        if (!record_exists('question_categories', 'id', $form->category)) {
+            print_error('categorydoesnotexist', 'question');
+        }
         $question->category           = $form->category;
         $question->name               = trim($form->name);
         $question->questiontext       = trim($form->questiontext);