MDL-51569 mod_choice: Prevent users from updating choices with curl

This commit is contained in:
John Okely
2015-11-06 14:53:06 +08:00
committed by Andrew Nicols
parent 8f75fc3657
commit 6283c33979
+5
View File
@@ -935,6 +935,7 @@ function choice_print_overview($courses, &$htmlarray) {
* @return array status (available or not and possible warnings)
*/
function choice_get_availability_status($choice) {
global $DB, $USER;
$available = true;
$warnings = array();
@@ -949,6 +950,10 @@ function choice_get_availability_status($choice) {
$warnings['expired'] = userdate($choice->timeclose);
}
}
if (!$choice->allowupdate && $DB->get_records('choice_answers', array('choiceid' => $choice->id, 'userid' => $USER->id))) {
$available = false;
$warnings['choicesaved'] = '';
}
// Choice is available.
return array($available, $warnings);