diff options
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 5 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_forum.php | 21 | ||||
-rw-r--r-- | phpBB/viewforum.php | 63 |
3 files changed, 61 insertions, 28 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index d2e4ed52ee..660e5abb19 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -90,6 +90,11 @@ <li>[Fix] Allow single quotes in db password to be stored within config.php in installer</li> <li>[Fix] Correctly quote db password for re-display in installer (Bug #16695 / thanks to m313 for reporting too - #s17235)</li> <li>[Fix] Correctly handle empty imageset entries (Bug #16865)</li> + <li>[Fix] Correctly check empty subjects/messages (Bug #17915)</li> + <li>[Change] Do not check usernames against word censor list. Disallowed usernames is already checked and word censor belong to posts. (Bug #17745)</li> + <li>[Fix] Additionally include non-postable forums for moderators forums shown within the teams list. (Bug #17265)</li> + <li>[Change] Sped up viewforum considerably (also goes towards mcp_forum)</li> + </ul> <a name="v30rc8"></a><h3>1.i. Changes since 3.0.RC8</h3> 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) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index c0ea87fede..0b2af13d76 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -408,38 +408,53 @@ else $sql_where = (sizeof($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; } -// SQL array for obtaining topics/stickies -$sql_array = array( - 'SELECT' => $sql_array['SELECT'], - 'FROM' => $sql_array['FROM'], - 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], - - 'WHERE' => $sql_where . ' - AND t.topic_type IN (' . POST_NORMAL . ', ' . POST_STICKY . ") +// Grab just the sorted topic ids +$sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . " t + WHERE $sql_where + AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ") $sql_approved - $sql_limit_time", - - 'ORDER_BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order, -); - -// If store_reverse, then first obtain topics, then stickies, else the other way around... -// Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because -// the number of stickies are not known -$sql = $db->sql_build_query('SELECT', $sql_array); + $sql_limit_time + ORDER BY t.topic_type " . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order; $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); -$shadow_topic_list = array(); while ($row = $db->sql_fetchrow($result)) { - if ($row['topic_status'] == ITEM_MOVED) + $topic_list[] = (int) $row['topic_id']; +} +$db->sql_freeresult($result); + +// For storing shadow topics +$shadow_topic_list = array(); + +if (sizeof($topic_list)) +{ + // SQL array for obtaining topics/stickies + $sql_array = array( + 'SELECT' => $sql_array['SELECT'], + 'FROM' => $sql_array['FROM'], + 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], + + 'WHERE' => $db->sql_in_set('t.topic_id', $topic_list), + ); + + // If store_reverse, then first obtain topics, then stickies, else the other way around... + // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because + // the number of stickies are not known + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) { - $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; - } + if ($row['topic_status'] == ITEM_MOVED) + { + $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; + } - $rowset[$row['topic_id']] = $row; - $topic_list[] = $row['topic_id']; + $rowset[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); } -$db->sql_freeresult($result); // If we have some shadow topics, update the rowset to reflect their topic information if (sizeof($shadow_topic_list)) |