From 1ae35ca6ad1f17662cbc609f3e3bfcb0a7d7b626 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 17 May 2022 07:45:05 +0200 Subject: [PATCH] do not show debug menu if all items are inaccessible --- views/bootstrap/class.Bootstrap.php | 8 +++++--- views/bootstrap4/class.Bootstrap4.php | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index f392ec989..0240f663e 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1019,9 +1019,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);; } if ($settings->_enableDebugMode) { - $menuitems['debug'] = array('link'=>"#", 'label'=>getMLText('debug')); - if ($accessobject->check_view_access('Hooks')) - $menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks')); + if($accessobject->check_view_access(array('Hooks'))) { + $menuitems['debug'] = array('link'=>"#", 'label'=>getMLText('debug')); + if ($accessobject->check_view_access('Hooks')) + $menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks')); + } } /* Check if hook exists because otherwise callHook() will override $menuitems */ diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 640517739..aee665d47 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -927,9 +927,11 @@ background-image: linear-gradient(to bottom, #882222, #111111);; } if ($settings->_enableDebugMode) { - $menuitems['debug'] = array('link'=>"#", 'label'=>getMLText('debug')); - if ($accessobject->check_view_access('Hooks')) - $menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks')); + if($accessobject->check_view_access(array('Hooks'))) { + $menuitems['debug'] = array('link'=>"#", 'label'=>getMLText('debug')); + if ($accessobject->check_view_access('Hooks')) + $menuitems['debug']['children']['hooks'] = array('link'=>"../out/out.Hooks.php", 'label'=>getMLText('list_hooks')); + } } /* Check if hook exists because otherwise callHook() will override $menuitems */