MDL-17050 excorising $_POST - thanks to mikec for patch - also check groupmode before bothering to get groupstuff to save some trees. merged from HEAD

This commit is contained in:
danmarsden
2008-10-31 00:56:05 +00:00
parent 0105dfc1f3
commit 5123fa76c8
+9 -7
View File
@@ -3,10 +3,11 @@
require_once("../../config.php");
require_once("lib.php");
$id = required_param('id', PARAM_INT); //moduleid
$format = optional_param('format', CHOICE_PUBLISH_NAMES, PARAM_INT);
$download = optional_param('download', '', PARAM_ALPHA);
$action = optional_param('action', '', PARAM_ALPHA);
$id = required_param('id', PARAM_INT); //moduleid
$format = optional_param('format', CHOICE_PUBLISH_NAMES, PARAM_INT);
$download = optional_param('download', '', PARAM_ALPHA);
$action = optional_param('action', '', PARAM_ALPHA);
$attemptids = optional_param('attemptid', array(), PARAM_INT); //get array of responses to delete.
if (! $cm = get_coursemodule_from_id('choice', $id)) {
error("Course Module ID was incorrect");
@@ -33,7 +34,6 @@
add_to_log($course->id, "choice", "report", "report.php?id=$cm->id", "$choice->id",$cm->id);
if ($action == 'delete' && has_capability('mod/choice:deleteresponses',$context)) {
$attemptids = isset($_POST['attemptid']) ? $_POST['attemptid'] : array(); //get array of repsonses to delete.
choice_delete_responses($attemptids, $choice->id); //delete responses.
redirect("report.php?id=$cm->id");
}
@@ -45,8 +45,10 @@
update_module_button($cm->id, $course->id, $strchoice), navmenu($course, $cm));
/// Check to see if groups are being used in this choice
$groupmode = groups_get_activity_groupmode($cm);
groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, 'report.php?id='.$id);
if ($groupmode) {
groups_get_activity_group($cm, true);
groups_print_activity_menu($cm, 'report.php?id='.$id);
}
} else {
$groupmode = groups_get_activity_groupmode($cm);
}