quiz editing: MDL-19199 since Moodle 1.9 DB can only store integer question max grades, we should be cleaning input with PARAM_INT!

This commit is contained in:
tjhunt
2009-06-05 09:18:35 +00:00
parent cb06574d5b
commit dbbb455677
+3 -2
View File
@@ -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');