mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-25 11:28:55 +00:00
[ticket/11582] Use new class for categories
PHPBB3-11582
This commit is contained in:
parent
573987d2d2
commit
e8d2a2fd88
4 changed files with 44 additions and 37 deletions
|
@ -456,7 +456,10 @@ class acp_permission_roles
|
|||
*/
|
||||
function display_auth_options($auth_options)
|
||||
{
|
||||
global $template, $user;
|
||||
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);
|
||||
|
@ -473,7 +476,7 @@ class acp_permission_roles
|
|||
foreach ($content_array as $cat => $cat_array)
|
||||
{
|
||||
$template->assign_block_vars('auth', array(
|
||||
'CAT_NAME' => $user->lang['permission_cat'][$cat],
|
||||
'CAT_NAME' => $user->lang($permission_categories[$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,
|
||||
|
|
|
@ -1100,7 +1100,10 @@ class auth_admin extends phpbb_auth
|
|||
*/
|
||||
function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false, $s_view)
|
||||
{
|
||||
global $template, $user, $phpbb_admin_path, $phpEx;
|
||||
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))
|
||||
|
@ -1110,8 +1113,8 @@ 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_cat'][$cat])
|
||||
);
|
||||
'CAT_NAME' => $user->lang($permission_categories[$cat]),
|
||||
));
|
||||
|
||||
/* Sort permissions by name (more naturaly and user friendly than sorting by a primary key)
|
||||
* Commented out due to it's memory consumption and time needed
|
||||
|
@ -1176,7 +1179,10 @@ class auth_admin extends phpbb_auth
|
|||
*/
|
||||
function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array)
|
||||
{
|
||||
global $user;
|
||||
global $user, $phpbb_container;
|
||||
|
||||
$permissions = $phpbb_container->get('acl.permissions');
|
||||
$permission_categories = $permissions->get_categories();
|
||||
|
||||
foreach ($key_sort_array as $forum_id)
|
||||
{
|
||||
|
@ -1204,7 +1210,7 @@ class auth_admin extends phpbb_auth
|
|||
// Build our categories array
|
||||
if (!isset($categories[$cat]))
|
||||
{
|
||||
$categories[$cat] = $user->lang['permission_cat'][$cat];
|
||||
$categories[$cat] = $user->lang($permission_categories[$cat]);
|
||||
}
|
||||
|
||||
// Build our content array
|
||||
|
|
|
@ -107,20 +107,20 @@ class phpbb_permissions
|
|||
);
|
||||
|
||||
protected $categories = array(
|
||||
'actions' => 'Actions',
|
||||
'content' => 'Content',
|
||||
'forums' => 'Forums',
|
||||
'misc' => 'Misc',
|
||||
'permissions' => 'Permissions',
|
||||
'pm' => 'Private messages',
|
||||
'polls' => 'Polls',
|
||||
'post' => 'Post',
|
||||
'post_actions' => 'Post actions',
|
||||
'posting' => 'Posting',
|
||||
'profile' => 'Profile',
|
||||
'settings' => 'Settings',
|
||||
'topic_actions' => 'Topic actions',
|
||||
'user_group' => 'Users & Groups',
|
||||
'actions' => 'ACL_CAT_ACTIONS',
|
||||
'content' => 'ACL_CAT_CONTENT',
|
||||
'forums' => 'ACL_CAT_FORUMS',
|
||||
'misc' => 'ACL_CAT_MISC',
|
||||
'permissions' => 'ACL_CAT_PERMISSIONS',
|
||||
'pm' => 'ACL_CAT_PM',
|
||||
'polls' => 'ACL_CAT_POLLS',
|
||||
'post' => 'ACL_CAT_POST',
|
||||
'post_actions' => 'ACL_CAT_POST_ACTIONS',
|
||||
'posting' => 'ACL_CAT_POSTING',
|
||||
'profile' => 'ACL_CAT_PROFILE',
|
||||
'settings' => 'ACL_CAT_SETTINGS',
|
||||
'topic_actions' => 'ACL_CAT_TOPIC_ACTIONS',
|
||||
'user_group' => 'ACL_CAT_USER_GROUP',
|
||||
);
|
||||
|
||||
protected $permissions = array(
|
||||
|
|
|
@ -65,22 +65,20 @@ if (empty($lang) || !is_array($lang))
|
|||
|
||||
// Define categories and permission types
|
||||
$lang = array_merge($lang, array(
|
||||
'permission_cat' => array(
|
||||
'actions' => 'Actions',
|
||||
'content' => 'Content',
|
||||
'forums' => 'Forums',
|
||||
'misc' => 'Misc',
|
||||
'permissions' => 'Permissions',
|
||||
'pm' => 'Private messages',
|
||||
'polls' => 'Polls',
|
||||
'post' => 'Post',
|
||||
'post_actions' => 'Post actions',
|
||||
'posting' => 'Posting',
|
||||
'profile' => 'Profile',
|
||||
'settings' => 'Settings',
|
||||
'topic_actions' => 'Topic actions',
|
||||
'user_group' => 'Users & Groups',
|
||||
),
|
||||
'ACL_CAT_ACTIONS' => 'Actions',
|
||||
'ACL_CAT_CONTENT' => 'Content',
|
||||
'ACL_CAT_FORUMS' => 'Forums',
|
||||
'ACL_CAT_MISC' => 'Misc',
|
||||
'ACL_CAT_PERMISSIONS' => 'Permissions',
|
||||
'ACL_CAT_PM' => 'Private messages',
|
||||
'ACL_CAT_POLLS' => 'Polls',
|
||||
'ACL_CAT_POST' => 'Post',
|
||||
'ACL_CAT_POST_ACTIONS' => 'Post actions',
|
||||
'ACL_CAT_POSTING' => 'Posting',
|
||||
'ACL_CAT_PROFILE' => 'Profile',
|
||||
'ACL_CAT_SETTINGS' => 'Settings',
|
||||
'ACL_CAT_TOPIC_ACTIONS' => 'Topic actions',
|
||||
'ACL_CAT_USER_GROUP' => 'Users & Groups',
|
||||
|
||||
|
||||
'ACL_TYPE_USER' => 'User permissions',
|
||||
|
|
Loading…
Add table
Reference in a new issue