diff options
-rw-r--r-- | phpBB/adm/style/acp_users.html | 15 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 82 | ||||
-rw-r--r-- | phpBB/includes/acp/auth.php | 7 | ||||
-rw-r--r-- | phpBB/includes/auth.php | 4 | ||||
-rw-r--r-- | phpBB/language/en/acp/permissions.php | 2 |
6 files changed, 80 insertions, 34 deletions
diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html index 7bc81434d0..c615dadb44 100644 --- a/phpBB/adm/style/acp_users.html +++ b/phpBB/adm/style/acp_users.html @@ -731,10 +731,21 @@ var help_line = { <!-- ELSEIF S_PERMISSIONS --> - <fieldset class="quick"> + <div style="float: right;"> <a href="{U_USER_PERMISSIONS}">» {L_SET_USERS_PERMISSIONS}</a><br /> <a href="{U_USER_FORUM_PERMISSIONS}">» {L_SET_USERS_FORUM_PERMISSIONS}</a> - </fieldset> + </div> + + <form id="select_forum" method="post" action="{U_ACTION}"> + + <fieldset class="quick" style="text-align: left;"> + {L_SELECT_FORUM}: <select name="f">{S_FORUM_OPTIONS}</select> + <input class="button2" type="submit" value="{L_GO}" name="select" /> + </fieldset> + + </form> + + <br clear="all" /> <!-- INCLUDE permission_mask.html --> diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 8b611ffef1..61017a059d 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -305,7 +305,7 @@ class acp_permissions $s_forum_options = ''; foreach ($forum_list as $f_id => $f_row) { - $s_forum_options .= '<option value="' . $f_id . '"' . $f_row['selected'] . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>'; + $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>'; } // Build subforum options @@ -488,7 +488,7 @@ class acp_permissions foreach ($forum_list as $key => $row) { - $s_options .= '<option value="' . $row['forum_id'] . '"' . $row['selected'] . '>' . $row['padding'] . $row['forum_name']; + $s_options .= '<option value="' . $row['forum_id'] . '"' . (($row['selected']) ? ' selected="selected"' : '') . '>' . $row['padding'] . $row['forum_name']; // We check if a branch is there... $branch_there = false; diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index dc08a766a3..7c0834aa79 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1960,49 +1960,75 @@ class acp_users $user->add_lang('acp/permissions'); add_permission_language(); - // Select auth options - $sql = 'SELECT auth_option, is_local, is_global - FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option LIKE '%\_'"; + $forum_id = request_var('f', 0); - if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') + // Global Permissions + if (!$forum_id) { - $sql .= " ESCAPE '\\' "; - } + // Select auth options + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option LIKE '%\_'"; - $sql .= 'AND is_global = 1 - ORDER BY auth_option'; - $result = $db->sql_query($sql); + if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') + { + $sql .= " ESCAPE '\\' "; + } - while ($row = $db->sql_fetchrow($result)) - { - $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER); - $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false); - } - $db->sql_freeresult($result); + $sql .= 'AND is_global = 1 + ORDER BY auth_option'; + $result = $db->sql_query($sql); - $sql = 'SELECT auth_option, is_local, is_global - FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option LIKE '%\_'"; + $hold_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false); + } + $db->sql_freeresult($result); - if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') + unset($hold_ary); + } + else { - $sql .= " ESCAPE '\\' "; + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option LIKE '%\_'"; + + if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') + { + $sql .= " ESCAPE '\\' "; + } + + $sql .= 'AND is_local = 1 + ORDER BY is_global DESC, auth_option'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false); + } + $db->sql_freeresult($result); } - $sql .= 'AND is_local = 1 - ORDER BY is_global DESC, auth_option'; - $result = $db->sql_query($sql); + $s_forum_options = '<option value="0"' . ((!$forum_id) ? ' selected="selected"' : '') . '>' . $user->lang['VIEW_GLOBAL_PERMS'] . '</option>'; - while ($row = $db->sql_fetchrow($result)) + $forum_list = make_forum_select($forum_id, false, true, false, false, false, true); + + // Build forum options + foreach ($forum_list as $f_id => $f_row) { - $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'local', ACL_NEVER); - $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false); + $s_forum_options .= '<option value="' . $f_id . '"' . (($f_row['selected']) ? ' selected="selected"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>'; } - $db->sql_freeresult($result); $template->assign_vars(array( 'S_PERMISSIONS' => true, + + 'S_GLOBAL' => (!$forum_id) ? true : false, + 'S_FORUM_OPTIONS' => $s_forum_options, + + 'U_ACTION' => $this->u_action . '&u=' . $user_id, 'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), 'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)) ); diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 95dffb9e72..26977a6ceb 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -380,6 +380,7 @@ class auth_admin extends auth } $template->assign_var('S_ROLE_JS_ARRAY', $s_role_js_array); + unset($s_role_js_array); // Now obtain memberships $user_groups_default = $user_groups_custom = array(); @@ -481,7 +482,11 @@ class auth_admin extends auth ); $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view')); + + unset($content_array[$ug_id]); } + + unset($hold_ary[$forum_id]); } } else @@ -569,6 +574,8 @@ class auth_admin extends auth $this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace, ($mode == 'view')); } + + unset($hold_ary[$ug_id], $ug_names_ary[$ug_id]); } } } diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php index a553d8e4ed..cf1b053f8c 100644 --- a/phpBB/includes/auth.php +++ b/phpBB/includes/auth.php @@ -113,7 +113,7 @@ class auth { if (isset($this->acl[0])) { - $this->cache[$f][$opt] = $this->acl[0]{$this->acl_options['global'][$opt]}; + $this->cache[$f][$opt] = $this->acl[0][$this->acl_options['global'][$opt]]; } } @@ -123,7 +123,7 @@ class auth { if (isset($this->acl[$f])) { - $this->cache[$f][$opt] |= $this->acl[$f]{$this->acl_options['local'][$opt]}; + $this->cache[$f][$opt] |= $this->acl[$f][$this->acl_options['local'][$opt]]; } } } diff --git a/phpBB/language/en/acp/permissions.php b/phpBB/language/en/acp/permissions.php index e17b31b8ef..94ff82148b 100644 --- a/phpBB/language/en/acp/permissions.php +++ b/phpBB/language/en/acp/permissions.php @@ -242,6 +242,8 @@ $lang = array_merge($lang, array( 'USER_IS_MEMBER_OF_CUSTOM' => 'is a member of the following custom groups', 'VIEW_ASSIGNED_ITEMS' => 'View assigned items', + 'VIEW_LOCAL_PERMS' => 'Local permissions', + 'VIEW_GLOBAL_PERMS' => 'Global permissions', 'VIEW_PERMISSIONS' => 'View permissions', 'WRONG_PERMISSION_TYPE' => 'Wrong permission type selected.', |