From: tjhunt Date: Fri, 18 Aug 2006 22:34:54 +0000 (+0000) Subject: Bug #6293 - Cannot regrade a question when a teacher has added a comment with a ... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ef82286874a823756861595d54f042ee2be134bd;p=moodle.git Bug #6293 - Cannot regrade a question when a teacher has added a comment with a ' - Merged from MOODLE_16_STABLE. Stupid, wreched, datalib. Why can't datalib take care of addslashes, so the whole of the rest of the code can forget about it? That is how a database abstraction layer should work. I know, it is pointless to moan about it, but it has just cost me 3 hours, so I feel I have earned the right to moan. --- diff --git a/lib/questionlib.php b/lib/questionlib.php index b1bb321522..831bea14b6 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -755,6 +755,8 @@ function save_question_session(&$question, &$state) { $session->newgraded = $state->id; $session->sumpenalty = $state->sumpenalty; $session->comment = $state->comment; + } else { + $session->comment = addslashes($session->comment); } update_record('question_sessions', $session); } diff --git a/question/comment.html b/question/comment.html index 30a837cdcb..00d5d3dd21 100644 --- a/question/comment.html +++ b/question/comment.html @@ -10,7 +10,7 @@ comment); + print_textarea($usehtmleditor, 15, 60, 630, 300, $prefix.'[comment]', stripslashes($state->comment)); ?>