diff options
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/acp/auth.php | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 11478842d7..b36b900396 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -466,8 +466,10 @@ class auth_admin extends \phpbb\auth\auth // Build role dropdown options $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; - // Output current role id to template - $template->assign_var('S_ROLE_ID', $current_role_id); + $role_options = array(); + + $s_role_options = ''; + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; @reset($roles); while (list($role_id, $role_row) = each($roles)) @@ -475,12 +477,20 @@ class auth_admin extends \phpbb\auth\auth $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; - $template->assign_block_vars('role_options', array( + $title = ($role_description) ? ' title="' . $role_description . '"' : ''; + $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; + + $role_options[] = array( 'ID' => $role_id, 'ROLE_NAME' => $role_name, 'TITLE' => $role_description, 'SELECTED' => $role_id == $current_role_id, - )); + ); + } + + if ($s_role_options) + { + $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars($user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; } if (!$current_role_id && $mode != 'view') @@ -504,9 +514,13 @@ class auth_admin extends \phpbb\auth\auth $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( 'NAME' => $ug_names_ary[$ug_id], 'UG_ID' => $ug_id, + 'S_ROLE_OPTIONS' => $s_role_options, 'S_CUSTOM' => $s_custom_permissions, - 'FORUM_ID' => $forum_id) - ); + 'FORUM_ID' => $forum_id, + 'S_ROLE_ID' => $current_role_id, + )); + + $template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options); $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace); @@ -551,8 +565,10 @@ class auth_admin extends \phpbb\auth\auth // Build role dropdown options $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; - // Output current role id to template - $template->assign_var('S_ROLE_ID', $current_role_id); + $role_options = array(); + + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + $s_role_options = ''; @reset($roles); while (list($role_id, $role_row) = each($roles)) @@ -560,12 +576,20 @@ class auth_admin extends \phpbb\auth\auth $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; - $template->assign_block_vars('role_options', array( + $title = ($role_description) ? ' title="' . $role_description . '"' : ''; + $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_name . '</option>'; + + $role_options[] = array( 'ID' => $role_id, 'ROLE_NAME' => $role_name, 'TITLE' => $role_description, 'SELECTED' => $role_id == $current_role_id, - )); + ); + } + + if ($s_role_options) + { + $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . ' title="' . htmlspecialchars($user->lang['NO_ROLE_ASSIGNED_EXPLAIN']) . '">' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; } if (!$current_role_id && $mode != 'view') @@ -591,9 +615,12 @@ class auth_admin extends \phpbb\auth\auth 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'], 'S_CUSTOM' => $s_custom_permissions, 'UG_ID' => $ug_id, + 'S_ROLE_OPTIONS' => $s_role_options, 'FORUM_ID' => $forum_id) ); + $template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options); + $this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace); } |
