Skip to content

Commit

Permalink
MDL-18059 database rates - secured ; merged from 19_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed May 6, 2009
1 parent c045e45 commit c11f2e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions lang/en_utf8/data.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
$string['invalidfieldtype'] = 'Field Type is incorrect';
$string['invalidid'] = 'Incorrect data ID';
$string['invalidpreset'] = '$a is not a preset.';
$string['invalidrate'] = 'Invalid database rate ($a)';
$string['invalidratedata'] = 'Incorrect submitted ratings data';
$string['invalidrecord'] = 'Incorrect record';
$string['invalidurl'] = 'The URL you just entered is not valid';
Expand Down
8 changes: 8 additions & 0 deletions mod/data/rate.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
print_error('invalidaccess', 'data');
}

/// Calculate scale values
$scale_values = make_grades_menu($data->scale);

$count = 0;

foreach ((array)$frmdata as $recordid => $rating) {
Expand All @@ -52,6 +55,11 @@
continue;
}

/// Check rate is valid for that database scale values
if (!array_key_exists($rating, $scale_values) && $rating != -999) {
print_error('invalidrate', 'data', '', $rating);
}

// input validation ok

$count++;
Expand Down

0 comments on commit c11f2e4

Please sign in to comment.