From af246483e2feb0a8fbfb81782da17fb5f8dda957 Mon Sep 17 00:00:00 2001 From: Zoddo Date: Fri, 28 Aug 2015 18:56:10 +0200 Subject: [ticket/13950] Hide undefined categories This hides the categories added by disabled extensions PHPBB3-13950 --- phpBB/includes/acp/auth.php | 5 +++++ phpBB/phpbb/permissions.php | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 6c13a6694c..52c45499b2 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1113,6 +1113,11 @@ class auth_admin extends \phpbb\auth\auth @reset($category_array); while (list($cat, $cat_array) = each($category_array)) { + if (!$phpbb_permissions->category_defined($cat)) + { + continue; + } + $template->assign_block_vars($tpl_cat, array( 'S_YES' => ($cat_array['S_YES'] && !$cat_array['S_NEVER'] && !$cat_array['S_NO']) ? true : false, 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index 7006c84b76..42bbe443d1 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -159,6 +159,17 @@ class permissions return (isset($this->permissions[$permission]['cat'])) ? $this->permissions[$permission]['cat'] : 'misc'; } + /** + * Checks if a category has been defined + * + * @param string $category Identifier of the category + * @return bool True if the category is defined, false otherwise + */ + public function category_defined($category) + { + return isset($this->categories[$category]); + } + /** * Checks if a permission has been defined * -- cgit v1.2.1