1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 20:13:22 +01:00

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
This commit is contained in:
Meik Sievertsen 2009-08-20 14:50:40 +00:00
parent 20ace274d6
commit 74879efcb5
3 changed files with 17 additions and 6 deletions

View File

@ -198,6 +198,7 @@
<li>[Fix] Do not display topic approval status image for shadow topic if a user is not a moderator in the forum the topic has been moved to. (Bug #43295)</li>
<li>[Fix] Fix email problems on servers with PHP installations not accepting RFC-compliant subject string passed to the the mail()-function. (Bug #46725)</li>
<li>[Fix] Correctly orientate Control-Panel-Navigation background-image on RTL languages. (Bug #49945)</li>
<li>[Fix] Sort private messages by message time and not message id. (Bug #50015)</li>
<li>[Change] submit_post() now accepts force_approved_state key passed to $data to indicate new posts being approved (true) or unapproved (false).</li>
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>

View File

@ -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

View File

@ -907,6 +907,7 @@ else
$direction = (($sort_dir == 'd') ? 'DESC' : 'ASC');
$sql_start = $start;
}
if (is_array($sort_by_sql[$sort_key]))
{
$sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction;
@ -916,7 +917,6 @@ else
$sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction;
}
// Container for user details, only process once
$post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = array();
$has_attachments = $display_notice = false;
@ -1604,7 +1604,7 @@ if ($topic_data['topic_type'] == POST_GLOBAL)
$result = $db->sql_query_limit($sql, 1);
$topic_data['forum_last_post_time'] = (int) $db->sql_fetchfield('forum_last_post_time');
$db->sql_freeresult($result);
$sql = 'SELECT mark_time as forum_mark_time
FROM ' . FORUMS_TRACK_TABLE . '
WHERE forum_id = 0