|
From: Meik S. <acy...@ph...> - 2009-08-20 14:51:28
|
Author: acydburn
Date: Thu Aug 20 15:50:40 2009
New Revision: 10035
Log:
Sort private messages by message time and not message id. (Bug #50015)
Modified:
branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_viewfolder.php
branches/phpBB-3_0_0/phpBB/viewtopic.php
Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html
==============================================================================
*** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original)
--- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Thu Aug 20 15:50:40 2009
***************
*** 198,203 ****
--- 198,204 ----
<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>
Modified: branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_viewfolder.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_viewfolder.php (original)
--- branches/phpBB-3_0_0/phpBB/includes/ucp/ucp_pm_viewfolder.php Thu Aug 20 15:50:40 2009
***************
*** 386,397 ****
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');
}
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');
}
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
--- 386,397 ----
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.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' => 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,477 ****
}
// Select the sort order
! $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($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');
$sql_start = $start;
}
$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
--- 462,487 ----
}
// Select the sort order
! $directioin = ($sort_dir == 'd') ? 'ASC' : 'DESC';
$sql_start = max(0, $pm_count - $sql_limit - $start);
}
else
{
// Select the sort order
! $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
Modified: branches/phpBB-3_0_0/phpBB/viewtopic.php
==============================================================================
*** branches/phpBB-3_0_0/phpBB/viewtopic.php (original)
--- branches/phpBB-3_0_0/phpBB/viewtopic.php Thu Aug 20 15:50:40 2009
***************
*** 907,912 ****
--- 907,913 ----
$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,922 ****
$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;
--- 917,922 ----
***************
*** 1604,1610 ****
$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
--- 1604,1610 ----
$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
|