From: thepurpleblob Date: Thu, 26 Jul 2007 10:56:13 +0000 (+0000) Subject: MDL-9123: X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=978284623531ce8cb4560e7d011b6028b39367d6;p=moodle.git MDL-9123: Check that the selected category is allowed. Merged from STABLE_18 --- diff --git a/question/import.php b/question/import.php index 476f524a3d..782f0e6403 100644 --- a/question/import.php +++ b/question/import.php @@ -62,10 +62,14 @@ print_error('nocategory','quiz'); } - if (!$courseid) { // need to get the course from the chosen category - $courseid = $category->course; + // check category is valid (against THIS courseid, before we change it) + $validcats = question_category_options( $courseid, true, true ); + if (!array_key_exists( $categoryid, $validcats )) { + print_error( 'invalidcategory', 'quiz' ); } + $courseid = $category->course; + if (!$course = get_record("course", "id", $courseid)) { error("Invalid course!"); }