$noanswer = true;
break;
}
- $useranswer = clean_param($useranswer, PARAM_CLEAN);
+ $useranswer = clean_param($useranswer, PARAM_RAW);
if (!$answers = get_records("lesson_answers", "pageid", $pageid, "id")) {
error("Continue: No answers found");
$userresponse->response = "";
$userresponse = addslashes(serialize($userresponse));
- $studentanswer = $useranswer;
+ $studentanswer = s(stripslashes_safe($useranswer));
break;
case LESSON_SHORTANSWER :
if (!$useranswer = $_POST['answer']) {
$essayinfo->graded = 1;
$essayinfo->score = clean_param($form->score, PARAM_INT);
- $essayinfo->response = stripslashes_safe($form->response);
+ $essayinfo->response = stripslashes_safe(clean_param($form->response, PARAM_RAW));
$essayinfo->sent = 0;
if (!$lesson->custom && $essayinfo->score == 1) {
$attempt->correct = 1;
// Set rest of the message values
$a->question = format_text($pages[$attempt->pageid]->contents, FORMAT_MOODLE, $options);
- $a->response = format_text(stripslashes($essayinfo->answer));
+ $a->response = s(stripslashes_safe($essayinfo->answer));
$a->teacher = $course->teacher;
- $a->comment = format_text(stripslashes($essayinfo->response), FORMAT_MOODLE, $options);
+ $a->comment = s($essayinfo->response);
// Fetch message HTML and plain text formats
$essayinfo = unserialize($attempt->useranswer);
$table->head = array(get_string('studentresponse', 'lesson', fullname($user, true)));
- $table->data[] = array(format_text(stripslashes($essayinfo->answer)));
+ $table->data[] = array(s(stripslashes_safe($essayinfo->answer)));
print_table($table);
// Now a response box and grade drop-down for grader
$table->head = array(get_string('comments', 'lesson'));
- $table->data[] = array(print_textarea(false, 15, 60, 0, 0, 'response', format_text($essayinfo->response, FORMAT_PLAIN, $options), $course->id, true));
+ $table->data[] = array(print_textarea(false, 15, 60, 0, 0, 'response', $essayinfo->response, $course->id, true));
$options = array();
if ($lesson->custom) {
for ($i=$answer->score; $i>=0; $i--) {
if ($essayinfo->response == NULL) {
$answerdata->response = get_string("nocommentyet", "lesson");
} else {
- $answerdata->response = $essayinfo->response;
+ $answerdata->response = s($essayinfo->response);
}
if (isset($pagestats[$page->id])) {
$percent = $pagestats[$page->id]->totalscore / $pagestats[$page->id]->total * 100;
// dont think this should ever be reached....
$avescore = get_string("nooneansweredthisquestion", "lesson");
}
- $answerdata->answers[] = array($essayinfo->answer, $avescore);
+ $answerdata->answers[] = array(s(stripslashes_safe($essayinfo->answer)), $avescore);
break;
case LESSON_BRANCHTABLE :
$data = "<input type=\"button\" name=\"$answer->id\" value=\"".strip_tags(format_text($answer->answer, FORMAT_MOODLE,$formattextdefoptions))."\" disabled=\"disabled\"> ";