Merge branch 'MDL-39507_24' of git://github.com/timhunt/moodle into MOODLE_24_STABLE
This commit is contained in:
@@ -67,9 +67,8 @@ class qformat_xhtml extends qformat_default {
|
||||
$expout .= "<h3>$question->name</h3>\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 .= '<p class="questiontext">' . format_text($text,
|
||||
$question->questiontextformat, array('noclean' => true)) . "</p>\n";
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user