]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-6338 - Short answer questions with ' in the answer don't work. Merged from MOODLE...
authortjhunt <tjhunt>
Wed, 23 Aug 2006 19:04:24 +0000 (19:04 +0000)
committertjhunt <tjhunt>
Wed, 23 Aug 2006 19:04:24 +0000 (19:04 +0000)
question/type/shortanswer/questiontype.php

index b34af78e0de35e322f48764d9c493258fb79f14e..a2e4e90d6ce2bf1201f7e418301a09c96c00fdd6 100644 (file)
@@ -27,9 +27,9 @@ class question_shortanswer_qtype extends default_questiontype {
         }
 
         if (!$question->options->answers = get_records('question_answers', 'question',
-         $question->id, 'id ASC')) {
-           notify('Error: Missing question answers!');
-           return false;
+                $question->id, 'id ASC')) {
+            notify('Error: Missing question answers!');
+            return false;
         }
         return true;
     }
@@ -140,7 +140,7 @@ class question_shortanswer_qtype extends default_questiontype {
         /// Print input controls
 
         if (isset($state->responses[''])) {
-            $value = ' value="'.s($state->responses['']).'" ';
+            $value = ' value="'.s($state->responses[''], true).'" ';
         } else {
             $value = ' value="" ';
         }
@@ -197,7 +197,7 @@ class question_shortanswer_qtype extends default_questiontype {
     }
 
     function test_response(&$question, $state, $answer) {
-        return $this->compare_string_with_wildcard($state->responses[''],
+        return $this->compare_string_with_wildcard(stripslashes_safe($state->responses['']),
                 $answer->answer, !$question->options->usecase);
     }