diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-08-20 14:50:40 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-08-20 14:50:40 +0000 |
commit | 74879efcb5c8af253c1d4bdbe97c8065681a1778 (patch) | |
tree | 5b1ee7dc1686caa2b0f4c76212c568a249c1dd7b /phpBB/includes/ucp/ucp_pm_viewfolder.php | |
parent | 20ace274d6b6d370fde9aad6d85cc57740fcfbf1 (diff) | |
download | forums-74879efcb5c8af253c1d4bdbe97c8065681a1778.tar forums-74879efcb5c8af253c1d4bdbe97c8065681a1778.tar.gz forums-74879efcb5c8af253c1d4bdbe97c8065681a1778.tar.bz2 forums-74879efcb5c8af253c1d4bdbe97c8065681a1778.tar.xz forums-74879efcb5c8af253c1d4bdbe97c8065681a1778.zip |
Sort private messages by message time and not message id. (Bug #50015)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10035 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/ucp/ucp_pm_viewfolder.php')
-rw-r--r-- | phpBB/includes/ucp/ucp_pm_viewfolder.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index f947518ba8..11e7f5e7e8 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -386,12 +386,12 @@ function get_pm_from($folder_id, $folder, $user_id) if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) { $sort_by_text = array('t' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('t' => 'p.msg_id', 's' => 'p.message_subject'); + $sort_by_sql = array('t' => 'p.message_time', 's' => array('p.message_subject', 'p.message_time')); } else { $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('a' => 'u.username_clean', 't' => 'p.msg_id', 's' => 'p.message_subject'); + $sort_by_sql = array('a' => array('u.username_clean', 'p.message_time'), 't' => 'p.message_time', 's' => array('p.message_subject', 'p.message_time')); } $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; @@ -462,16 +462,26 @@ function get_pm_from($folder_id, $folder, $user_id) } // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC'); + $directioin = ($sort_dir == 'd') ? 'ASC' : 'DESC'; $sql_start = max(0, $pm_count - $sql_limit - $start); } else { // Select the sort order - $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $direction = ($sort_dir == 'd') ? 'DESC' : 'ASC'; $sql_start = $start; } + // Sql sort order + if (is_array($sort_by_sql[$sort_key])) + { + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; + } + else + { + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; + } + $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u WHERE t.user_id = $user_id |