diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index cafb3c795d..cf2e8e0790 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -485,6 +485,9 @@ class acp_search { global $db; + /** + * @todo what is faster, doing a MAX() or an ORDER BY post_id and LIMIT 1? + */ $sql = 'SELECT MAX(post_id) as max_post_id FROM '. POSTS_TABLE; $result = $db->sql_query($sql); diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php index 3fe9b60018..4ff02c7a43 100644 --- a/phpBB/includes/mcp/mcp_front.php +++ b/phpBB/includes/mcp/mcp_front.php @@ -54,7 +54,7 @@ function mcp_front_view($id, $mode, $action) FROM ' . POSTS_TABLE . ' WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ') AND post_approved = 0 - ORDER BY post_id DESC'; + ORDER BY post_time DESC'; $result = $db->sql_query_limit($sql, 5); while ($row = $db->sql_fetchrow($result)) @@ -68,7 +68,7 @@ function mcp_front_view($id, $mode, $action) WHERE p.post_id IN (' . implode(', ', $post_list) . ') AND t.topic_id = p.topic_id AND p.poster_id = u.user_id - ORDER BY p.post_id DESC'; + ORDER BY p.post_time DESC'; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) @@ -158,7 +158,7 @@ function mcp_front_view($id, $mode, $action) AND r.user_id = u.user_id AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')', - 'ORDER_BY' => 'p.post_id DESC' + 'ORDER_BY' => 'p.post_time DESC' )); $result = $db->sql_query_limit($sql, 5); diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index b81845a2aa..2b65a7c8b2 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -809,7 +809,7 @@ function mcp_fork_topic($topic_ids) $sql = 'SELECT * FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id - ORDER BY post_id ASC"; + ORDER BY post_time ASC"; $result = $db->sql_query($sql); $post_rows = array(); diff --git a/phpBB/mcp.php b/phpBB/mcp.php index 3470518a4e..b254072aad 100644 --- a/phpBB/mcp.php +++ b/phpBB/mcp.php @@ -545,14 +545,14 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql, case 'posts': $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject'); + $sort_by_sql = array('a' => 'u.username', 't' => 'p.post_time', 's' => 'p.post_subject'); $limit_time_sql = ($min_time) ? "AND p.post_time >= $min_time" : ''; break; case 'reports': $limit_days = array(0 => $user->lang['ALL_REPORTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 'r' => $user->lang['REPORTER'], 'p' => $user->lang['POST_TIME'], 't' => $user->lang['REPORT_TIME'], 's' => $user->lang['SUBJECT']); - $sort_by_sql = array('a' => 'u.username', 'r' => 'ru.username', 'p' => 'p.post_id', 't' => 'r.report_time', 's' => 'p.post_subject'); + $sort_by_sql = array('a' => 'u.username', 'r' => 'ru.username', 'p' => 'p.post_time', 't' => 'r.report_time', 's' => 'p.post_subject'); break; case 'logs': diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 7128d6b3d3..858a42920c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -224,6 +224,9 @@ if (!$topic_data) // This is for determining where we are (page) if ($post_id) { + /** + * @todo adjust for using post_time? Generally adjust query... it is not called very often though + */ $sql = 'SELECT COUNT(post_id) AS prev_posts FROM ' . POSTS_TABLE . " WHERE topic_id = {$topic_data['topic_id']} @@ -325,7 +328,7 @@ if (!isset($topic_tracking_info)) $limit_days = array(0 => $user->lang['ALL_POSTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); -$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_id', 's' => 'p.post_subject'); +$sort_by_sql = array('a' => 'u.username', 't' => 'p.post_time', 's' => 'p.post_subject'); $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; 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);