From cdfaa8386ed4719e46465c01342101d90b68e107 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 14 Jul 2008 15:29:30 +0000 Subject: [PATCH] Removing calls to depricated stripslashes. It is no longer needed with dmllib 2.0. --- question/format/hotpot/format.php | 14 ++------------ question/format/qti_two/format.php | 2 +- question/format/xml/format.php | 2 +- question/type/multianswer/questiontype.php | 6 +++--- question/type/shortanswer/questiontype.php | 4 ++-- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/question/format/hotpot/format.php b/question/format/hotpot/format.php index 55cada9bda..d3a4056b90 100644 --- a/question/format/hotpot/format.php +++ b/question/format/hotpot/format.php @@ -664,13 +664,7 @@ function hotpot_convert_relative_urls($str, $baseurl, $filename) { return $str; } -function hotpot_convert_relative_url($baseurl, $filename, $opentag, $url, $closetag, $stripslashes=true) { - if ($stripslashes) { - $opentag = stripslashes($opentag); - $url = stripslashes($url); - $closetag = stripslashes($closetag); - } - +function hotpot_convert_relative_url($baseurl, $filename, $opentag, $url, $closetag, $depricated=true) { // catch // ampersands can appear as "&", "&" or "&" if (preg_match('|^'.'\w+=[^&]+'.'('.'&((amp;#x0026;)?amp;)?'.'\w+=[^&]+)*'.'$|', $url)) { @@ -708,14 +702,10 @@ function hotpot_convert_relative_url($baseurl, $filename, $opentag, $url, $close return $url; } -function hotpot_convert_url($baseurl, $filename, $url, $stripslashes=true) { +function hotpot_convert_url($baseurl, $filename, $url, $depricated=true) { // maintain a cache of converted urls static $HOTPOT_RELATIVE_URLS = array(); - if ($stripslashes) { - $url = stripslashes($url); - } - // is this an absolute url? (or javascript pseudo url) if (preg_match('%^(http://|/|javascript:)%i', $url)) { // do nothing diff --git a/question/format/qti_two/format.php b/question/format/qti_two/format.php index 8e01eb7279..fc1268ecc5 100644 --- a/question/format/qti_two/format.php +++ b/question/format/qti_two/format.php @@ -289,7 +289,7 @@ function handle_questions_media(&$questions, $path, $courseid) { // results are first written into string (and then to a file) $count++; - echo "

$count. ".stripslashes($question->questiontext)."

"; + echo "

$count. ".$question->questiontext."

"; $expout = $this->writequestion( $question , null, true, $path) . "\n"; $expout = $this->presave_process( $expout ); diff --git a/question/format/xml/format.php b/question/format/xml/format.php index dc008f1188..b203e1ae23 100755 --- a/question/format/xml/format.php +++ b/question/format/xml/format.php @@ -135,7 +135,7 @@ class qformat_xml extends qformat_default { $qo->image = $this->getpath( $question, array('#','image',0,'#'), $qo->image ); $image_base64 = $this->getpath( $question, array('#','image_base64','0','#'),'' ); if (!empty($image_base64)) { - $qo->image = $this->importimagefile( $qo->image, stripslashes($image_base64) ); + $qo->image = $this->importimagefile( $qo->image, $image_base64); } $qo->generalfeedback = $this->getpath( $question, array('#','generalfeedback',0,'#','text',0,'#'), $qo->generalfeedback, true ); $qo->defaultgrade = $this->getpath( $question, array('#','defaultgrade',0,'#'), $qo->defaultgrade ); diff --git a/question/type/multianswer/questiontype.php b/question/type/multianswer/questiontype.php index 1f4a1ba407..b063519637 100644 --- a/question/type/multianswer/questiontype.php +++ b/question/type/multianswer/questiontype.php @@ -314,7 +314,7 @@ class embedded_cloze_qtype extends default_questiontype { } if ($correctanswer) { $feedback = '
'; - $feedback .= get_string('correctansweris', 'quiz', s($correctanswer, true)); + $feedback .= get_string('correctansweris', 'quiz', s($correctanswer)); $feedback .= '
'; // $strfeedbackwrapped = get_string('correctanswer and', 'quiz').get_string('feedback', 'quiz'); } @@ -413,7 +413,7 @@ class embedded_cloze_qtype extends default_questiontype { */ echo " "; + echo " type=\"text\" value=\"".s($response)."\" ".$styleinfo." /> "; if (!empty($feedback) && !empty($USER->screenreader)) { echo "pixpath/i/feedback.gif\" alt=\"$feedback\" />"; } @@ -427,7 +427,7 @@ class embedded_cloze_qtype extends default_questiontype { $selected = ' selected="selected"'; } $outputoptions .= "'; + s($mcanswer->answer) . ''; } // In the next line, $readonly is invalid HTML, but it works in // all browsers. $disabled would be valid, but then the JS for diff --git a/question/type/shortanswer/questiontype.php b/question/type/shortanswer/questiontype.php index a770a40667..5bbffcd543 100644 --- a/question/type/shortanswer/questiontype.php +++ b/question/type/shortanswer/questiontype.php @@ -145,7 +145,7 @@ class question_shortanswer_qtype extends default_questiontype { /// Print input controls if (isset($state->responses['']) && $state->responses['']!='') { - $value = ' value="'.s($state->responses[''], true).'" '; + $value = ' value="'.s($state->responses['']).'" '; } else { $value = ' value="" '; } @@ -410,7 +410,7 @@ class question_shortanswer_qtype extends default_questiontype { echo '
' . get_string($class, 'quiz'); if ($correctanswer && ($class == 'partiallycorrect' || $class == 'incorrect')) { echo ('
'); - print_string('correctansweris', 'quiz', s($correctanswer, true)); + print_string('correctansweris', 'quiz', s($correctanswer)); echo ('
'); } echo '
'; -- 2.39.5