MDL-9123:

Check that the selected category is allowed.

Merged from STABLE_18
This commit is contained in:
thepurpleblob 2007-07-26 10:56:13 +00:00
parent e96cb4feaa
commit 9782846235

View File

@ -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!");
}