diff --git a/question/format/xhtml/format.php b/question/format/xhtml/format.php index 71e7f19f70a..8d19f03aee7 100644 --- a/question/format/xhtml/format.php +++ b/question/format/xhtml/format.php @@ -67,9 +67,8 @@ class qformat_xhtml extends qformat_default { $expout .= "

$question->name

\n"; // Format and add the question text. - $text = question_rewrite_question_preview_urls($question->questiontext, $question->id, - $question->contextid, 'question', 'questiontext', $question->id, - $question->contextid, 'qformat_xhtml'); + $text = question_rewrite_questiontext_preview_urls($question->questiontext, + $question->contextid, 'qformat_xhtml', $question->id); $expout .= '

' . format_text($text, $question->questiontextformat, array('noclean' => true)) . "

\n"; diff --git a/question/format/xhtml/lib.php b/question/format/xhtml/lib.php index e1d6c640b22..dd190830db3 100644 --- a/question/format/xhtml/lib.php +++ b/question/format/xhtml/lib.php @@ -38,21 +38,14 @@ defined('MOODLE_INTERNAL') || die(); * @param bool $forcedownload. * @param array $options additional options affecting the file serving. */ -function qformat_xhtml_question_preview_pluginfile($previewcontext, $questionid, - $filecontext, $filecomponent, $filearea, $args, $forcedownload, $options = array()) { +function qformat_xhtml_questiontext_preview_pluginfile($context, $questionid, + $args, $forcedownload, array $options = array()) { global $CFG; - list($context, $course, $cm) = get_context_info_array($previewcontext->id); + list($context, $course, $cm) = get_context_info_array($context->id); require_login($course, false, $cm); question_require_capability_on($questionid, 'view'); - $fs = get_file_storage(); - $relativepath = implode('/', $args); - $fullpath = "/{$filecontext->id}/{$filecomponent}/{$filearea}/{$relativepath}"; - if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->is_directory()) { - send_file_not_found(); - } - - send_stored_file($file, 0, 0, $forcedownload, $options); + question_send_questiontext_file($questionid, $args, $forcedownload, $options); }