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) {