From: dhawes Date: Fri, 24 Sep 2004 23:18:17 +0000 (+0000) Subject: Double quote strings converted to single quote literals - inspired by missing escape... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=4723e40941374dff60fc9f05b343a00682bfe429;p=moodle.git Double quote strings converted to single quote literals - inspired by missing escapes on quote characters inside echo strings found by ottenhoff and noted in comment to bug 1981 --- diff --git a/mod/quiz/multiple.php b/mod/quiz/multiple.php index c682d8276a..862d1518b3 100644 --- a/mod/quiz/multiple.php +++ b/mod/quiz/multiple.php @@ -1,31 +1,31 @@ modform)) { - error("You have used this page incorrectly!"); + error('You have used this page incorrectly!'); } else { $modform = $SESSION->modform; } - if (! $category = get_record("quiz_categories", "id", $category)) { - error("Course ID is incorrect"); + if (! $category = get_record('quiz_categories', 'id', $category)) { + error('Course ID is incorrect'); } - if (! $course = get_record("course", "id", $category->course)) { - error("Course ID is incorrect"); + if (! $course = get_record('course', 'id', $category->course)) { + error('Course ID is incorrect'); } require_login($course->id); if (!isteacher($course->id)) { - error("Only teachers can use this page!"); + error('Only teachers can use this page!'); } @@ -34,7 +34,7 @@ if ($form = data_submitted()) { if ($form->randomcreate > 0) { - $existing = count_records("quiz_questions", "qtype", RANDOM, "category", $category->id); + $existing = count_records('quiz_questions', 'qtype', RANDOM, 'category', $category->id); $randomcreate = $form->randomcreate - $existing; if ($randomcreate > 0) { @@ -42,21 +42,21 @@ $question->qtype = RANDOM; $question->category = $category->id; - $question->name = get_string("random", "quiz")." (".$category->name.")"; - $question->questiontext = "---"; - $question->image = ""; + $question->name = get_string('random', 'quiz') .' ('. $category->name .')'; + $question->questiontext = '---'; + $question->image = ''; $question->defaultgrade = $form->randomgrade; for ($i=0; $i<$randomcreate; $i++) { $question->stamp = make_unique_id_code(); // Set the unique code (not to be changed) - if (!$newquestionids[] = insert_record("quiz_questions", $question)) { - error("Could not insert new random question!"); + if (!$newquestionids[] = insert_record('quiz_questions', $question)) { + error('Could not insert new random question!'); } } // Add them to the quiz if necessary if (!empty($form->addquestionstoquiz)) { if (!empty($modform->questions)) { - $questionids = explode(",", $modform->questions); + $questionids = explode(',', $modform->questions); foreach ($questionids as $questionid) { foreach ($newquestionids as $key => $newquestionid) { if ($newquestionid == $questionid) { @@ -75,12 +75,12 @@ } $newquestionids = array_merge($questionids, $newquestionids); - $modform->questions = implode(",", $newquestionids); + $modform->questions = implode(',', $newquestionids); $SESSION->modform = $modform; } } } - redirect("edit.php"); + redirect('edit.php'); } @@ -88,27 +88,27 @@ /// Print headings - $strquestions = get_string("questions", "quiz"); - $strpublish = get_string("publish", "quiz"); - $strdelete = get_string("delete"); - $straction = get_string("action"); - $stradd = get_string("add"); - $strcancel = get_string("cancel"); - $strsavechanges = get_string("savechanges"); - $strbacktoquiz = get_string("backtoquiz", "quiz"); + $strquestions = get_string('questions', 'quiz'); + $strpublish = get_string('publish', 'quiz'); + $strdelete = get_string('delete'); + $straction = get_string('action'); + $stradd = get_string('add'); + $strcancel = get_string('cancel'); + $strsavechanges = get_string('savechanges'); + $strbacktoquiz = get_string('backtoquiz', 'quiz'); $strquizzes = get_string('modulenameplural', 'quiz'); - $streditingquiz = get_string(isset($SESSION->modform->instance) ? "editingquiz" : "editquestions", "quiz"); - $strcreatemultiple = get_string("createmultiple", "quiz"); + $streditingquiz = get_string(isset($SESSION->modform->instance) ? 'editingquiz' : 'editquestions', 'quiz'); + $strcreatemultiple = get_string('createmultiple', 'quiz'); - print_header_simple("$strcreatemultiple", "$strcreatemultiple", + print_header_simple($strcreatemultiple, $strcreatemultiple, "wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes". " -> $streditingquiz -> $strcreatemultiple"); - print_heading_with_help($strcreatemultiple, "createmultiple", "quiz"); + print_heading_with_help($strcreatemultiple, 'createmultiple', 'quiz'); if (!$categories = quiz_get_category_menu($course->id, true)) { - error("No categories!"); + error('No categories!'); } for ($i=1;$i<=100; $i++) { @@ -118,45 +118,45 @@ $gradecount[$i] = $i; } $options = array(); - $options[0] = get_string("no"); - $options[1] = get_string("yes"); - - print_simple_box_start("center", "", "$THEME->cellheading"); - echo "
"; - echo ""; - echo "'; + + echo ''; + + echo ''; + + echo ''; + + echo ''; + echo '
"; - print_string("category", "quiz"); - echo ":"; + $options[0] = get_string('no'); + $options[1] = get_string('yes'); + + print_simple_box_start('center', '', $THEME->cellheading); + echo ''; + echo ''; + echo '"; - - echo ""; - - echo ""; - - echo ""; - - echo ""; - echo "
'; + print_string('category', 'quiz'); + echo ':'; // choose_from_menu($categories, "category", "$category->id", ""); quiz_category_select_menu($course->id, true, true, $category->id ); - echo "
"; - print_string("randomcreate", "quiz"); - echo ":"; - choose_from_menu($randomcount, "randomcreate", "10", ""); - echo "
"; - print_string("defaultgrade", "quiz"); - echo ":"; - choose_from_menu($gradecount, "randomgrade", "1", ""); - echo "
"; - print_string("addquestionstoquiz", "quiz"); - echo ":"; - choose_from_menu($options, "addquestionstoquiz", "1", ""); - echo "
 "; - echo " id\" />"; - echo " "; - echo "
"; - echo ""; + echo '
'; + print_string('randomcreate', 'quiz'); + echo ':'; + choose_from_menu($randomcount, 'randomcreate', '10', ''); + echo '
'; + print_string('defaultgrade', 'quiz'); + echo ':'; + choose_from_menu($gradecount, 'randomgrade', '1', ''); + echo '
'; + print_string('addquestionstoquiz', 'quiz'); + echo ':'; + choose_from_menu($options, 'addquestionstoquiz', '1', ''); + echo '
 '; + echo ' '; + echo ' '; + echo '
'; + echo ''; print_simple_box_end(); print_footer(); -?> +?> \ No newline at end of file