diff options
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_permission_roles.php | 3 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 7 | ||||
-rw-r--r-- | phpBB/includes/acp/auth.php | 6 | ||||
-rw-r--r-- | phpBB/includes/permissions.php | 29 |
4 files changed, 35 insertions, 10 deletions
diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 8a2798a90a..2a00301543 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -459,7 +459,6 @@ class acp_permission_roles global $template, $user, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_categories = $permissions->get_categories(); $content_array = $categories = array(); $key_sort_array = array(0); @@ -476,7 +475,7 @@ class acp_permission_roles foreach ($content_array as $cat => $cat_array) { $template->assign_block_vars('auth', array( - 'CAT_NAME' => $user->lang($permission_categories[$cat]), + 'CAT_NAME' => $permissions->get_lang_category($cat), '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/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 9c5395c5b2..13e0f1c535 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -587,10 +587,9 @@ class acp_permissions */ function build_permission_dropdown($options, $default_option, $permission_scope) { - global $user, $auth, $phpbb_container; + global $auth, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_types = $permissions->get_types(); $s_dropdown_options = ''; foreach ($options as $setting) @@ -601,8 +600,8 @@ class acp_permissions } $selected = ($setting == $default_option) ? ' selected="selected"' : ''; - $l_setting = (isset($permission_types[$permission_scope][$setting])) ? $permission_types[$permission_scope][$setting] : $permission_types[$setting]; - $s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $user->lang($l_setting) . '</option>'; + $l_setting = $permissions->get_lang_type($setting, $permission_scope); + $s_dropdown_options .= '<option value="' . $setting . '"' . $selected . '>' . $l_setting . '</option>'; } return $s_dropdown_options; diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 03cc0c1705..7a7ccc0c50 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -1103,7 +1103,6 @@ class auth_admin extends phpbb_auth global $template, $user, $phpbb_admin_path, $phpEx, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_categories = $permissions->get_categories(); @reset($category_array); while (list($cat, $cat_array) = each($category_array)) @@ -1113,7 +1112,7 @@ class auth_admin extends phpbb_auth 'S_NEVER' => ($cat_array['S_NEVER'] && !$cat_array['S_YES'] && !$cat_array['S_NO']) ? true : false, 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, - 'CAT_NAME' => $user->lang($permission_categories[$cat]), + 'CAT_NAME' => $permissions->get_lang_category($cat), )); /* Sort permissions by name (more naturaly and user friendly than sorting by a primary key) @@ -1182,7 +1181,6 @@ class auth_admin extends phpbb_auth global $user, $phpbb_container; $permissions = $phpbb_container->get('acl.permissions'); - $permission_categories = $permissions->get_categories(); foreach ($key_sort_array as $forum_id) { @@ -1210,7 +1208,7 @@ class auth_admin extends phpbb_auth // Build our categories array if (!isset($categories[$cat])) { - $categories[$cat] = $user->lang($permission_categories[$cat]); + $categories[$cat] = $permissions->get_lang_category($cat); } // Build our content array diff --git a/phpBB/includes/permissions.php b/phpBB/includes/permissions.php index ddeadc825b..f3b2ab5da0 100644 --- a/phpBB/includes/permissions.php +++ b/phpBB/includes/permissions.php @@ -84,6 +84,16 @@ class phpbb_permissions } /** + * Returns the language string of a permission category + * + * @return array Language string + */ + public function get_lang_category($category) + { + return $this->user->lang($this->categories[$category]); + } + + /** * Returns an array with all the permission types (a_, u_, m_, etc.) * * @return array Layout: type-identifier => Language key @@ -94,6 +104,25 @@ class phpbb_permissions } /** + * Returns the language string of a permission type + * + * @return array Language string + */ + public function get_lang_type($type, $scope = false) + { + if ($scope && isset($this->types[$scope][$type])) + { + $lang_key = $this->types[$scope][$type]; + } + else + { + $lang_key = $this->types[$type]; + } + + return $this->user->lang($lang_key); + } + + /** * Returns an array with all the permissions. * Each Permission has the following layout: * 'acl_<type><permission>' => array( |