]> git.mjollnir.org Git - moodle.git/commitdiff
Parameter consistency check
authorDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:15:24 +0000 (18:15 +0000)
committerDavid Mudrak <david.mudrak@gmail.com>
Mon, 4 Jan 2010 18:15:24 +0000 (18:15 +0000)
mod/workshop/editform.php

index b211f8afb2ab049e34360988567008e9be5c942f..dc7b0ffc0bf7d0483b80e8fc50e5c1460c1725a2 100644 (file)
@@ -54,6 +54,11 @@ $mform = $strategy->get_edit_strategy_form($PAGE->url);
 if ($mform->is_cancelled()) {
     redirect($workshop->view_url());
 } elseif ($data = $mform->get_data()) {
+    if (($data->workshopid != $workshop->id) or ($data->strategy != $workshop->strategy)) {
+        // this may happen if someone changes the workshop setting while the user had the
+        // editing form opened
+        throw new invalid_parameter_exception('Invalid workshop ID or the grading strategy has changed.');
+    }
     $strategy->save_edit_strategy_form($data);
     if (isset($data->saveandclose)) {
         redirect($workshop->view_url());