From af834f3e7c0ea241d96b2aa4423f7629a04d47a3 Mon Sep 17 00:00:00 2001 From: danmarsden Date: Mon, 27 Jun 2005 00:58:24 +0000 Subject: [PATCH] Bug #3623 - doesn't like when $value = 0 --- mod/choice/lib.php | 6 +++--- mod/choice/view.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mod/choice/lib.php b/mod/choice/lib.php index 55acee6e8ea..5d2a86927db 100644 --- a/mod/choice/lib.php +++ b/mod/choice/lib.php @@ -70,7 +70,7 @@ function choice_add_instance($choice) { foreach ($choice as $name => $value) { if (strstr($name, "newoption")) { /// New option $value = trim($value); - if ($value) { + if (isset($value) && $value <> '') { $option = NULL; $option->text = $value; $option->choiceid = $choice->id; @@ -110,7 +110,7 @@ function choice_update_instance($choice) { $value = trim($value); if (strstr($name, "oldoption")) { // Old option - if ($value) { + if (isset($value) && $value <> '') { $option = NULL; $option->id = substr($name, 9); // Get the ID of the answer that needs to be updated. $option->text = $value; @@ -122,7 +122,7 @@ function choice_update_instance($choice) { delete_records("choice_options", "id", substr($name, 9)); } } else if (strstr($name, "newoption")) { /// New option - if ($value) { + if (isset($value)&& $value <> '') { $option = NULL; $option->text = $value; $option->choiceid = $choice->id; diff --git a/mod/choice/view.php b/mod/choice/view.php index 26c095313a3..03f7741f071 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -3,7 +3,7 @@ require_once("../../config.php"); require_once("lib.php"); - $id = required_param('id',0,PARAM_INT); // Course Module ID + require_variable($id); // Course Module ID if (! $cm = get_record("course_modules", "id", $id)) { error("Course Module ID was incorrect"); @@ -147,7 +147,7 @@ } $maxans = $choice->maxanswers[$optionid]; - if ($text) { + if (isset($text)) { echo ""; echo "limitanswers && ($countanswers >= $maxans) && !($answerchecked[$optionid]) ) {