1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 14:00:31 +02:00

[ticket/7291] Use template loop for character list, to avoid double &first_char

PHPBB3-7291
This commit is contained in:
Joas Schilling
2011-07-14 22:29:27 +02:00
parent 1ace10ab92
commit 91b20ddba5
3 changed files with 37 additions and 37 deletions

View File

@@ -1293,13 +1293,6 @@ switch ($mode)
$total_users = $config['num_users'];
}
$s_char_options = '<option value=""' . ((!$first_char) ? ' selected="selected"' : '') . '>&nbsp; &nbsp;</option>';
for ($i = 97; $i < 123; $i++)
{
$s_char_options .= '<option value="' . chr($i) . '"' . (($first_char == chr($i)) ? ' selected="selected"' : '') . '>' . chr($i-32) . '</option>';
}
$s_char_options .= '<option value="other"' . (($first_char == 'other') ? ' selected="selected"' : '') . '>' . $user->lang['OTHER'] . '</option>';
// Build a relevant pagination_url
$params = $sort_params = array();
@@ -1329,6 +1322,7 @@ switch ($mode)
'first_char' => array('first_char', ''),
);
$u_first_char_params = array();
foreach ($check_params as $key => $call)
{
if (!isset($_REQUEST[$key]))
@@ -1340,6 +1334,10 @@ switch ($mode)
$param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : $param);
$params[] = $param;
if ($key != 'first_char')
{
$u_first_char_params[] = $param;
}
if ($key != 'sk' && $key != 'sd')
{
$sort_params[] = $param;
@@ -1359,6 +1357,27 @@ switch ($mode)
unset($search_params, $sort_params);
$u_first_char_params = implode('&amp;', $u_first_char_params);
$u_first_char_params .= ($u_first_char_params) ? '&amp;' : '';
$first_characters = array();
$first_characters[''] = $user->lang['ALL'];
for ($i = 97; $i < 123; $i++)
{
$first_characters[chr($i)] = chr($i - 32);
}
$first_characters['other'] = $user->lang['OTHER'];
foreach ($first_characters as $char => $desc)
{
$template->assign_block_vars('first_char', array(
'DESC' => $desc,
'VALUE' => $char,
'S_SELECTED' => ($first_char == $char) ? true : false,
'U_SORT' => append_sid("{$phpbb_root_path}memberlist.$phpEx", $u_first_char_params . 'first_char=' . $char) . '#memberlist',
));
}
// Some search user specific data
if ($mode == 'searchuser' && ($config['load_search'] || $auth->acl_get('a_')))
{
@@ -1603,7 +1622,6 @@ switch ($mode)
'S_LEADERS_SET' => $leaders_set,
'S_MODE_SELECT' => $s_sort_key,
'S_ORDER_SELECT' => $s_sort_dir,
'S_CHAR_OPTIONS' => $s_char_options,
'S_MODE_ACTION' => $pagination_url)
);
}