MDL-27866, set page context for $OUTPUT->pix_url

This commit is contained in:
Dongsheng Cai
2011-06-20 13:52:03 +08:00
parent 7a7d34febb
commit 4be8a7d55c
+3
View File
@@ -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