From 58a435f6cf7541a1cd8497fd8ffe6512ad11d849 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sun, 15 Jan 2012 19:11:16 +0100 Subject: [PATCH] MDL-31171 fix blog attachment serving in BLOG_USER_LEVEL --- lib/filelib.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/filelib.php b/lib/filelib.php index e3b4a22e539..ee4db2f76da 100644 --- a/lib/filelib.php +++ b/lib/filelib.php @@ -3187,6 +3187,10 @@ function file_pluginfile($relativepath, $forcedownload) { print_error('siteblogdisable', 'blog'); } + $entryid = (int)array_shift($args); + if (!$entry = $DB->get_record('post', array('module'=>'blog', 'id'=>$entryid))) { + send_file_not_found(); + } if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL) { require_login(); if (isguestuser()) { @@ -3198,10 +3202,6 @@ function file_pluginfile($relativepath, $forcedownload) { } } } - $entryid = (int)array_shift($args); - if (!$entry = $DB->get_record('post', array('module'=>'blog', 'id'=>$entryid))) { - send_file_not_found(); - } if ('publishstate' === 'public') { if ($CFG->forcelogin) {