aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewforum.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2007-04-30 13:32:18 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2007-04-30 13:32:18 +0000
commit816bc5da616f1326d97fa20ccf59f3b1bca9fe1d (patch)
tree912bfdefef01c5b362af07bce0517cea0a0983d2 /phpBB/viewforum.php
parentef427b6483e89d797fed11485bdc857039d3b61f (diff)
downloadforums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar
forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar.gz
forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar.bz2
forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.tar.xz
forums-816bc5da616f1326d97fa20ccf59f3b1bca9fe1d.zip
"Ghost" topics in active topics list when shadow topics and corresponding topic in same resultset [#10313]
Find a member supporting hidden groups for those able to see them [#10305] Display hidden groups for all those able to see them across the board (composing messages, viewonline) Fix space for sending PM's to groups Let the permissions_phpbb file be included the same way as all other permission files [#10301] Add request_a-z+ handling within modules_auth suggested by Pyramide. This will allow modders to directly show/hide their module in addition to !empty() $_REQUEST variables. [#10297] git-svn-id: file:///svn/phpbb/trunk@7433 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/viewforum.php')
-rw-r--r--phpBB/viewforum.php40
1 files changed, 17 insertions, 23 deletions
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index ab5150bf8d..554bda47b5 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -410,11 +410,9 @@ $sql_array = array(
// 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 = str_replace('{SQL_TOPIC_TYPE}', ($store_reverse) ? POST_NORMAL : POST_STICKY, $sql);
$result = $db->sql_query_limit($sql, $sql_limit, $sql_start);
$shadow_topic_list = array();
-//$num_rows = 0;
while ($row = $db->sql_fetchrow($result))
{
if ($row['topic_status'] == ITEM_MOVED)
@@ -424,30 +422,9 @@ while ($row = $db->sql_fetchrow($result))
$rowset[$row['topic_id']] = $row;
$topic_list[] = $row['topic_id'];
-// $num_rows++;
}
$db->sql_freeresult($result);
-/* If the number of topics exceeds the sql limit then we do not need to retrieve the remaining topic type
-if ($num_rows < $sql_limit)
-{
- $sql = $db->sql_build_query('SELECT', $sql_array);
- $sql = str_replace('{SQL_TOPIC_TYPE}', ($store_reverse) ? POST_STICKY : POST_NORMAL, $sql);
- $result = $db->sql_query_limit($sql, $sql_limit - $num_rows, $sql_start);
-
- while ($row = $db->sql_fetchrow($result))
- {
- 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'];
- }
- $db->sql_freeresult($result);
-}
-*/
// If we have some shadow topics, update the rowset to reflect their topic information
if (sizeof($shadow_topic_list))
{
@@ -460,6 +437,17 @@ if (sizeof($shadow_topic_list))
{
$orig_topic_id = $shadow_topic_list[$row['topic_id']];
+ // If the shadow topic is already listed within the rowset (happens for active topics for example), then do not include it...
+ if (isset($rowset[$row['topic_id']]))
+ {
+ // We need to remove any trace regarding this topic. :)
+ unset($rowset[$orig_topic_id]);
+ unset($topic_list[array_search($orig_topic_id, $topic_list)]);
+ $topics_count--;
+
+ continue;
+ }
+
// Do not include those topics the user has no permission to access
if (!$auth->acl_get('f_read', $row['forum_id']))
{
@@ -483,6 +471,12 @@ if (sizeof($shadow_topic_list))
}
unset($shadow_topic_list);
+// Ok, adjust topics count for active topics list
+if ($s_display_active)
+{
+ $topics_count = 1;
+}
+
$template->assign_vars(array(
'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&amp;$u_sort_param"), $topics_count, $config['topics_per_page'], $start),
'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start),