mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-9123:
Check that the selected category is allowed. Merged from STABLE_18
This commit is contained in:
parent
e96cb4feaa
commit
9782846235
@ -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!");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user