Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

question import/export MDL-23198 extra_question_fields not handling s…

…pecial characters properly.

Thanks to Oleg Sychev for the fix.
  • Loading branch information...
commit a1a0d9a49dfacab0db1d05e1d88be5fe4ae1a1c5 1 parent 874a2ea
@timhunt timhunt authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 question/type/questiontype.php
View
8 question/type/questiontype.php
@@ -1732,7 +1732,7 @@ function import_from_xml($data, $question, $format, $extra=null) {
$qo->qtype = $question_type;
foreach ($extraquestionfields as $field) {
- $qo->$field = $format->getpath($data, array('#',$field,0,'#'), $qo->$field);
+ $qo->$field = addslashes($format->getpath($data, array('#',$field,0,'#'), $qo->$field));
}
// run through the answers
@@ -1769,7 +1769,11 @@ function export_to_xml($question, $format, $extra=null) {
array_shift($extraquestionfields);
$expout='';
foreach ($extraquestionfields as $field) {
- $expout .= " <$field>{$question->options->$field}</$field>\n";
+ $exportedvalue = $question->options->$field;
+ if (!empty($exportedvalue) && htmlspecialchars($exportedvalue) != $exportedvalue) {
+ $exportedvalue = '<![CDATA[' . $exportedvalue . ']]>';
+ }
+ $expout .= " <$field>{$exportedvalue}</$field>\n";
}
$extraasnwersfields = $this->extra_answer_fields();

0 comments on commit a1a0d9a

Please sign in to comment.
Something went wrong with that request. Please try again.