From: tjhunt Date: Thu, 26 Feb 2009 06:06:18 +0000 (+0000) Subject: qtype admin: MDL-16412 Enforce the allowed question types when a user tries to create... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=8ed358dbca9f2b934bdcb23238e88db73447f12e;p=moodle.git qtype admin: MDL-16412 Enforce the allowed question types when a user tries to create a question. --- diff --git a/question/question.php b/question/question.php index 5f0ee6d809..7bb670fc0c 100644 --- a/question/question.php +++ b/question/question.php @@ -61,6 +61,12 @@ if ($id) { $question = new stdClass; $question->category = $categoryid; $question->qtype = $qtype; + + // Check that users are allowed to create this question type at the moment. + $allowedtypes = question_type_menu(); + if (!isset($allowedtypes[$qtype])) { + print_error('cannotenable', 'question', $returnurl, $qtype); + } } else { print_error('notenoughdatatoeditaquestion', 'question', $returnurl); }