From 2d5b322c0f6c9edbcacd4a7ee0454eff0fb3d9ab Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 29 Oct 2005 16:45:58 +0000 Subject: [PATCH] fixed script parameters + some warnings SC#150; merged from MOODLE_15_STABLE --- mod/survey/download.php | 8 ++++---- mod/survey/graph.php | 10 +++++++--- mod/survey/index.php | 2 +- mod/survey/report.php | 7 ++++--- mod/survey/save.php | 3 ++- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/mod/survey/download.php b/mod/survey/download.php index 5b16acbfa7f..1bee0c8b386 100644 --- a/mod/survey/download.php +++ b/mod/survey/download.php @@ -4,9 +4,9 @@ // Check that all the parameters have been provided. - require_variable($id); // Course Module ID - optional_variable($type, "xls"); - optional_variable($group, 0); + $id = required_param('id', PARAM_INT); // Course Module ID + $type = optional_param('type', 'xls', PARAM_ALPHA); + $group = optional_param('group', 0, PARAM_INT); if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); @@ -106,7 +106,7 @@ foreach ($aaa as $a) { if (!$group or isset($users[$a->userid])) { - if (!$results["$a->userid"]) { // init new array + if (empty($results["$a->userid"])) { // init new array $results["$a->userid"]["time"] = $a->time; foreach ($order as $key => $qid) { $results["$a->userid"]["$qid"]["answer1"] = ""; diff --git a/mod/survey/graph.php b/mod/survey/graph.php index 8118fca5642..420ec18324e 100644 --- a/mod/survey/graph.php +++ b/mod/survey/graph.php @@ -4,10 +4,11 @@ require_once("$CFG->libdir/graphlib.php"); require_once("lib.php"); - $id = required_param('id',PARAM_INT); // Course Module ID - $type = required_param('type',PARAM_CLEAN); // Graph Type + $id = required_param('id', PARAM_INT); // Course Module ID + $type = required_param('type', PARAM_FILE); // Graph Type $group = optional_param('group', 0, PARAM_INT); // Group ID - $sid = optional_param('sid', 0, PARAM_INT); // Student ID + $sid = optional_param('sid', false, PARAM_INT); // Student ID + $qid = optional_param('qid', 0, PARAM_INT); // Group ID if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); @@ -112,6 +113,9 @@ $graph->parameter['x_axis_angle'] = 20; $graph->parameter['shadow'] = 'none'; + $graph->y_tick_labels = null; + $graph->offset_relation = null; + $graph->draw_stack(); break; diff --git a/mod/survey/index.php b/mod/survey/index.php index dbdff21a538..f2283049fb5 100644 --- a/mod/survey/index.php +++ b/mod/survey/index.php @@ -3,7 +3,7 @@ require_once("../../config.php"); require_once("lib.php"); - require_variable($id); // course + $id = required_param('id', PARAM_INT); // Course Module ID if (! $course = get_record("course", "id", $id)) { error("Course ID is incorrect"); diff --git a/mod/survey/report.php b/mod/survey/report.php index 38b7967ce1f..27178a9d54e 100644 --- a/mod/survey/report.php +++ b/mod/survey/report.php @@ -5,9 +5,10 @@ // Check that all the parameters have been provided. - $id = required_param('id', PARAM_INT); // Course Module ID - $action = optional_param('action', ''); // What to look at - $qid = optional_param('qid', 0, PARAM_INT); // Question id + $id = required_param('id', PARAM_INT); // Course Module ID + $action = optional_param('action', '', PARAM_ALPHA); // What to look at + $qid = optional_param('qid', 0, PARAM_INT); // Group ID + $student = optional_param('student', 0, PARAM_INT); // Student ID if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); diff --git a/mod/survey/save.php b/mod/survey/save.php index 73204178ec9..ac10167912a 100644 --- a/mod/survey/save.php +++ b/mod/survey/save.php @@ -3,7 +3,6 @@ require_once('../../config.php'); require_once('lib.php'); - $id = required_param( 'id', PARAM_INT ); // Make sure this is a legitimate posting @@ -15,6 +14,8 @@ error("Guests are not allowed to answer surveys", $_SERVER["HTTP_REFERER"]); } + $id = required_param('id', PARAM_INT); // Course Module ID + if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); }