diff --git a/mod/quiz/edit.php b/mod/quiz/edit.php index 503a8229f9f..63b1e759e2a 100644 --- a/mod/quiz/edit.php +++ b/mod/quiz/edit.php @@ -263,7 +263,7 @@ /// Parse input for question -> grades if (preg_match('!^q([0-9]+)$!', $key, $matches)) { $key = $matches[1]; - $quiz->grades[$key] = $value; + $quiz->grades[$key] = clean_param($value, PARAM_INTEGER); quiz_update_question_instance($quiz->grades[$key], $key, $quiz->instance); /// Parse input for ordering info @@ -271,6 +271,7 @@ $key = $matches[1]; // Make sure two questions don't overwrite each other. If we get a second // question with the same position, shift the second one along to the next gap. + $value = clean_param($value, PARAM_INTEGER); while (array_key_exists($value, $questions)) { $value++; } @@ -298,7 +299,7 @@ } // If rescaling is required save the new maximum - $maxgrade = optional_param('maxgrade', -1, PARAM_NUMBER); + $maxgrade = optional_param('maxgrade', -1, PARAM_INTEGER); if ($maxgrade >= 0) { if (!quiz_set_grade($maxgrade, $quiz)) { error('Could not set a new maximum grade for the quiz');