From 8ac31587918cf9e59abadcf5b6f3f3d15a004986 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 1 Jan 2003 13:17:27 +0000 Subject: [PATCH] Robustness fixes --- mod/forum/mod.html | 20 ++++++++++++++++++++ mod/journal/mod.html | 15 ++++++++++++--- mod/quiz/db/mysql.php | 6 ++++++ mod/quiz/db/mysql.sql | 1 + mod/quiz/db/postgres7.php | 4 ++++ mod/quiz/db/postgres7.sql | 1 + mod/quiz/mod.html | 37 ++++++++++++++++++++++++++++++++++++- mod/quiz/version.php | 2 +- mod/resource/mod.html | 19 +++++++++++++++++++ mod/survey/mod.html | 12 ++++++++++++ 10 files changed, 112 insertions(+), 5 deletions(-) diff --git a/mod/forum/mod.html b/mod/forum/mod.html index 1d6009df84..0c8674a8b4 100644 --- a/mod/forum/mod.html +++ b/mod/forum/mod.html @@ -1,3 +1,23 @@ +name)) { + $form->name = ""; + } + if (empty($form->type)) { + $form->type = ""; + } + if (empty($form->intro)) { + $form->intro = ""; + } + if (empty($form->open)) { + $form->open = ""; + } + if (empty($form->assessed)) { + $form->assessed = ""; + } + if (empty($form->forcesubscribe)) { + $form->forcesubscribe = ""; + } +?>
diff --git a/mod/journal/mod.html b/mod/journal/mod.html index 5e5f9c5594..b62975b903 100644 --- a/mod/journal/mod.html +++ b/mod/journal/mod.html @@ -1,3 +1,15 @@ +name)) { + $form->name = ""; + } + if (empty($form->intro)) { + $form->intro = ""; + } + if (empty($form->days)) { + $form->days = "14"; + } +?> +
@@ -32,9 +44,6 @@ $options[$days] = get_string("numweeks", "", $i); } $options[365] = get_string("numweeks", "", 52); - if ($form->days == "") { - $form->days == "14"; - } choose_from_menu($options, "days", "$form->days"); ?> diff --git a/mod/quiz/db/mysql.php b/mod/quiz/db/mysql.php index e369d715bf..754eef177d 100644 --- a/mod/quiz/db/mysql.php +++ b/mod/quiz/db/mysql.php @@ -29,6 +29,12 @@ function quiz_upgrade($oldversion) { execute_sql("ALTER TABLE `quiz_attempts` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL "); } + // prefixes required from here on + + if ($oldversion < 2003010100) { + execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review TINYINT(4) UNSIGNED DEFAULT '0' NOT NULL AFTER `grademethod` "); + } + return true; } diff --git a/mod/quiz/db/mysql.sql b/mod/quiz/db/mysql.sql index f8042432db..4c844a757a 100644 --- a/mod/quiz/db/mysql.sql +++ b/mod/quiz/db/mysql.sql @@ -24,6 +24,7 @@ CREATE TABLE `prefix_quiz` ( `feedback` tinyint(4) NOT NULL default '0', `correctanswers` tinyint(4) NOT NULL default '1', `grademethod` tinyint(4) NOT NULL default '1', + `review` tinyint(4) NOT NULL default '0', `questions` text NOT NULL, `sumgrades` int(10) NOT NULL default '0', `grade` int(10) NOT NULL default '0', diff --git a/mod/quiz/db/postgres7.php b/mod/quiz/db/postgres7.php index 1af9d80d02..87cd5dff45 100644 --- a/mod/quiz/db/postgres7.php +++ b/mod/quiz/db/postgres7.php @@ -6,6 +6,10 @@ function quiz_upgrade($oldversion) { global $CFG; + if ($oldversion < 2003010100) { + execute_sql(" ALTER TABLE {$CFG->prefix}quiz ADD review integer DEFAULT '0' NOT NULL AFTER `grademethod` "); + } + return true; } diff --git a/mod/quiz/db/postgres7.sql b/mod/quiz/db/postgres7.sql index 854da8858d..c42b7b02b0 100644 --- a/mod/quiz/db/postgres7.sql +++ b/mod/quiz/db/postgres7.sql @@ -24,6 +24,7 @@ CREATE TABLE prefix_quiz ( feedback integer NOT NULL default '0', correctanswers integer NOT NULL default '1', grademethod integer NOT NULL default '1', + review integer NOT NULL default '0', questions text NOT NULL default '', sumgrades integer NOT NULL default '0', grade integer NOT NULL default '0', diff --git a/mod/quiz/mod.html b/mod/quiz/mod.html index 8b2fe04b9d..4617f3ac1c 100644 --- a/mod/quiz/mod.html +++ b/mod/quiz/mod.html @@ -1,7 +1,42 @@ -dirroot/mod/quiz/lib.php") ?> +dirroot/mod/quiz/lib.php"); + + if (empty($form->name)) { + $form->name = ""; + } + if (empty($form->intro)) { + $form->intro = ""; + } + if (empty($form->timeopen)) { + $form->timeopen = ""; + } + if (empty($form->timeclose)) { + $form->timeclose = ""; + } + if (empty($form->attempts)) { + $form->attempts = ""; + } + if (empty($form->grademethod)) { + $form->grademethod = ""; + } + if (empty($form->feedback)) { + $form->feedback = ""; + } + if (empty($form->correctanswers)) { + $form->correctanswers = ""; + } + if (empty($form->grade)) { + $form->grade = ""; + } + if (empty($form->questions)) { + $form->questions = ""; + } +?> + +
diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 24bfb42f24..ebd409fa8b 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -5,7 +5,7 @@ // This fragment is called by moodle_needs_upgrading() and /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2002122300; // The (date) version of this module +$module->version = 2003010100; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? ?> diff --git a/mod/resource/mod.html b/mod/resource/mod.html index 10608f196c..6b730b1853 100644 --- a/mod/resource/mod.html +++ b/mod/resource/mod.html @@ -1,3 +1,22 @@ +name)) { + $form->name = ""; + } + if (empty($form->type)) { + $form->type = ""; + } + if (empty($form->summary)) { + $form->summary = ""; + } + if (empty($form->reference)) { + $form->reference = ""; + } + if (empty($form->alltext)) { + $form->alltext = ""; + } +?> + +
diff --git a/mod/survey/mod.html b/mod/survey/mod.html index e45cd6b160..2d8c1e4edd 100644 --- a/mod/survey/mod.html +++ b/mod/survey/mod.html @@ -1,3 +1,15 @@ +name)) { + $form->name = ""; + } + if (empty($form->template)) { + $form->template = ""; + } + if (empty($form->intro)) { + $form->intro = ""; + } +?> +
-- 2.39.5