Index: questiontype.php =================================================================== RCS file: /cvsroot/moodle/moodle/question/type/questiontype.php,v retrieving revision 1.74.2.31 diff -u -r1.74.2.31 questiontype.php --- questiontype.php 23 Feb 2010 14:31:09 -0000 1.74.2.31 +++ questiontype.php 6 Aug 2010 14:18:20 -0000 @@ -1733,6 +1733,10 @@ foreach ($extraquestionfields as $field) { $qo->$field = $format->getpath($data, array('#',$field,0,'#'), $qo->$field); + if (is_array($qo->$field)) { + $fieldvalue = $qo->$field; + $qo->$field = $format->import_text($fieldvalue['text']); + } } // run through the answers @@ -1769,7 +1773,14 @@ array_shift($extraquestionfields); $expout=''; foreach ($extraquestionfields as $field) { - $expout .= " <$field>{$question->options->$field}\n"; + $exportedvalue=$question->options->$field; + if (!empty($exportedvalue) && htmlspecialchars($exportedvalue)!=$exportedvalue) { + $exportedvalue = ''; + } + if (strpos($exportedvalue,'\'')!=false) { + $exportedvalue = ''.$exportedvalue.''; + } + $expout .= " <$field>{$exportedvalue}\n"; } $extraasnwersfields = $this->extra_answer_fields();