Skip to content
Snippets Groups Projects
Commit 24ea6500 authored by Andreas Gohr's avatar Andreas Gohr
Browse files

check manager/admin role earlier for admin plugins FS#2180

parent 94eef7c6
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ if(!defined('DOKU_INC')) die('meh.');
function act_dispatch(){
global $ACT;
global $ID;
global $INFO;
global $QUERY;
global $lang;
global $conf;
......@@ -134,8 +135,15 @@ function act_dispatch(){
$pluginlist = plugin_list('admin');
if (in_array($_REQUEST['page'], $pluginlist)) {
// attempt to load the plugin
if ($plugin =& plugin_load('admin',$_REQUEST['page']) !== null)
$plugin->handle();
if ($plugin =& plugin_load('admin',$_REQUEST['page']) !== null){
if($plugin->forAdminOnly() && !$INFO['isadmin']){
// a manager tried to load a plugin that's for admins only
unset($_REQUEST['page']);
msg('For admins only',-1);
}else{
$plugin->handle();
}
}
}
}
}
......
......@@ -209,14 +209,9 @@ function tpl_admin(){
}
if ($plugin !== null){
if($plugin->forAdminOnly() && !$INFO['isadmin']){
msg('For admins only',-1);
html_admin();
}else{
if(!is_array($TOC)) $TOC = $plugin->getTOC(); //if TOC wasn't requested yet
if($INFO['prependTOC']) tpl_toc();
$plugin->html();
}
if(!is_array($TOC)) $TOC = $plugin->getTOC(); //if TOC wasn't requested yet
if($INFO['prependTOC']) tpl_toc();
$plugin->html();
}else{
html_admin();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment