diff options
Diffstat (limited to 'phpBB/includes/mcp')
-rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index d97fbb7107..e1820aa7ce 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -146,8 +146,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $read_tracking_join = $read_tracking_select = ''; } - $sql = "SELECT t.*$read_tracking_select - FROM " . TOPICS_TABLE . " t $read_tracking_join + $sql = "SELECT t.topic_id + FROM " . TOPICS_TABLE . " t WHERE t.forum_id IN($forum_id, 0) " . (($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . " $limit_time_sql @@ -155,13 +155,24 @@ function mcp_forum_view($id, $mode, $action, $forum_info) $result = $db->sql_query_limit($sql, $topics_per_page, $start); $topic_list = $topic_tracking_info = array(); + while ($row = $db->sql_fetchrow($result)) { - $topic_rows[$row['topic_id']] = $row; $topic_list[] = $row['topic_id']; } $db->sql_freeresult($result); + $sql = "SELECT t.*$read_tracking_select + FROM " . TOPICS_TABLE . " t $read_tracking_join + WHERE " . $db->sql_in_set('t.topic_id', $topic_list); + + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $topic_rows[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); + // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync if (!sizeof($topic_list) && $forum_topics && $start > 0) { @@ -181,10 +192,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info) } } - foreach ($topic_rows as $topic_id => $row) + foreach ($topic_list as $topic_id) { $topic_title = ''; + $row = &$topic_rows[$topic_id]; + $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; if ($row['topic_status'] == ITEM_MOVED) |