From 9ecbd0edb64368193f96111d7164bb824c8f16cd Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Wed, 13 Aug 2008 14:37:33 +0000 Subject: #31185 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@8752 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_content.php | 87 ++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 44 deletions(-) (limited to 'phpBB/includes/functions_content.php') diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index ced5106c14..33df0314a7 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -41,57 +41,56 @@ if (!defined('IN_PHPBB')) /** * Generate sort selection fields */ -function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir, &$u_sort_param) +function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir, &$u_sort_param, $def_st = false, $def_sk = false, $def_sd = false) { global $user; $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); - // Check if the key is selectable. If not, we reset to the first key found. - // This ensures the values are always valid. - if (!isset($limit_days[$sort_days])) - { - @reset($limit_days); - $sort_days = key($limit_days); - } - - if (!isset($sort_by_text[$sort_key])) - { - @reset($sort_by_text); - $sort_key = key($sort_by_text); - } - - if (!isset($sort_dir_text[$sort_dir])) - { - @reset($sort_dir_text); - $sort_dir = key($sort_dir_text); - } - - $s_limit_days = ''; - - $s_sort_key = ''; - - $s_sort_dir = ''; + foreach ($sort_ary['options'] as $option => $text) + { + $selected = ($sort_ary['selected']== $option) ? ' selected="selected"' : ''; + $sort_ary['output'] .= ''; + } + $sort_ary['output'] .= ''; + $u_sort_param .= ($sort_ary['selected'] !== $sort_ary['default']) ? ((strlen($u_sort_param)) ? '&' : '') . "{$name}={$sort_ary['selected']}" : ''; } - $s_sort_dir .= ''; - - $u_sort_param = "st=$sort_days&sk=$sort_key&sd=$sort_dir"; return; } -- cgit v1.2.1