From 4be8a7d55c543489abbe8066ccc877a780d64d94 Mon Sep 17 00:00:00 2001 From: Dongsheng Cai Date: Mon, 20 Jun 2011 13:52:03 +0800 Subject: [PATCH] MDL-27866, set page context for $OUTPUT->pix_url --- pluginfile.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pluginfile.php b/pluginfile.php index e749921586b..cc855cc32bf 100644 --- a/pluginfile.php +++ b/pluginfile.php @@ -294,6 +294,9 @@ if ($component === 'blog') { // ======================================================================================================================== } else if ($component === 'user') { if ($filearea === 'icon' and $context->contextlevel == CONTEXT_USER) { + // XXX: pix_url will initialize $PAGE, so we have to set up context here + // this temp hack should be fixed by better solution + $PAGE->set_context(get_system_context()); if (!empty($CFG->forcelogin) and !isloggedin()) { // protect images if login required and not logged in; // do not use require_login() because it is expensive and not suitable here anyway