Fixed problem with slashes, bug 5177

This commit is contained in:
gustav_delius
2006-04-13 00:37:14 +00:00
parent d6d29245e7
commit da1cc5a44e
3 changed files with 4 additions and 2 deletions
+2
View File
@@ -645,8 +645,10 @@ function restore_question_state(&$question, &$state) {
global $QTYPES;
// initialise response to the value in the answer field
$state->answer = addslashes($state->answer);
$state->responses = array('' => $state->answer);
unset($state->answer);
$state->comment = isset($state->comment) ? addslashes($state->comment) : '';
// Set the changed field to false; any code which changes the
// question session must set this to true and must increment
+1 -1
View File
@@ -110,7 +110,7 @@ class question_essay_qtype extends default_questiontype {
// get response value
if (isset($state->responses[''])) {
// security problem. responses[''] is never cleaned before it is sent to the db (I think)
$value = $state->responses[''];
$value = stripslashes_safe($state->responses['']);
} else {
$value = "";
}
+1 -1
View File
@@ -475,7 +475,7 @@ class default_questiontype {
$grade .= $question->maxgrade;
}
$comment = $state->comment;
$comment = stripslashes($state->comment);
$commentlink = '';
if (isset($options->questioncommentlink)) {
$strcomment = get_string('commentorgrade', 'quiz');