diff options
author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-01 21:47:19 +0200 |
---|---|---|
committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-09-01 21:47:19 +0200 |
commit | 5b8164a1bb911fb2df56affc5024652070cf35e4 (patch) | |
tree | b820621ff2862616a2d326d7f3f1ef1f2c8ce93d | |
parent | 5e643ae750dcae3e5496759405ec8501e0e529d4 (diff) | |
parent | 8749c99e3453012d5fc8be199ed5a725e447b511 (diff) | |
download | forums-5b8164a1bb911fb2df56affc5024652070cf35e4.tar forums-5b8164a1bb911fb2df56affc5024652070cf35e4.tar.gz forums-5b8164a1bb911fb2df56affc5024652070cf35e4.tar.bz2 forums-5b8164a1bb911fb2df56affc5024652070cf35e4.tar.xz forums-5b8164a1bb911fb2df56affc5024652070cf35e4.zip |
Merge branch '3.1.x'
* 3.1.x:
[ticket/13950] Hide undefined categories
[ticket/13950] Hide undefined permissions
-rw-r--r-- | phpBB/includes/acp/auth.php | 10 | ||||
-rw-r--r-- | phpBB/phpbb/permissions.php | 22 |
2 files changed, 32 insertions, 0 deletions
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 2c4c82fcc7..027be03a00 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1114,6 +1114,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, @@ -1140,6 +1145,11 @@ class auth_admin extends \phpbb\auth\auth @reset($cat_array['permissions']); while (list($permission, $allowed) = each($cat_array['permissions'])) { + if (!$phpbb_permissions->permission_defined($permission)) + { + continue; + } + if ($s_view) { $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php index c462f72a73..0c6fad295c 100644 --- a/phpBB/phpbb/permissions.php +++ b/phpBB/phpbb/permissions.php @@ -160,6 +160,28 @@ class permissions } /** + * 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 + * + * @param string $permission Identifier of the permission + * @return bool True if the permission is defined, false otherwise + */ + public function permission_defined($permission) + { + return isset($this->permissions[$permission]); + } + + /** * Returns the language string of a permission * * @param string $permission Identifier of the permission |