Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-36806 question files: fix unnecessary require_login call.

quiz_question_pluginfile later does the correct check. Doing this
other check first means you get an error about changing $PAGE->context.
  • Loading branch information...
commit 8ee045c0260030471b991773f970498634bffe98 1 parent e4592b2
Tim Hunt timhunt authored
Showing with 6 additions and 3 deletions.
  1. +3 −3 lib/questionlib.php
  2. +3 −0  question/previewlib.php
6 lib/questionlib.php
View
@@ -1797,10 +1797,10 @@ function question_pluginfile($course, $context, $component, $filearea, $args, $f
send_file_not_found();
}
- list($context, $course, $cm) = get_context_info_array($context->id);
- require_login($course, false, $cm);
-
if ($filearea === 'export') {
+ list($context, $course, $cm) = get_context_info_array($context->id);
+ require_login($course, false, $cm);
+
require_once($CFG->dirroot . '/question/editlib.php');
$contexts = new question_edit_contexts($context);
// check export capability
3  question/previewlib.php
View
@@ -228,6 +228,9 @@ function question_preview_question_pluginfile($course, $context, $component,
$filearea, $qubaid, $slot, $args, $forcedownload) {
global $USER, $DB, $CFG;
+ list($context, $course, $cm) = get_context_info_array($context->id);
+ require_login($course, false, $cm);
+
$quba = question_engine::load_questions_usage_by_activity($qubaid);
if (!question_has_capability_on($quba->get_question($slot), 'use')) {
Please sign in to comment.
Something went wrong with that request. Please try again.