From d64516057fef276a9ba435bd20e7223015376a95 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 20 Dec 2009 14:22:51 +0000 Subject: [PATCH] Also improve topics feed. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10353 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/feed.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 04b6b09af4..63c3fe083f 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -1184,17 +1184,16 @@ class phpbb_feed_topics extends phpbb_feed_base { global $db, $config; - $excluded_forum_ids = $this->excluded_forums(); - if (empty($excluded_forum_ids)) + $forum_ids_read = $this->get_readable_forums(); + if (empty($forum_ids_read)) { - // Whole board - $sql_where_more = ''; + return false; } - else + + $in_fid_ary = array_diff($forum_ids_read, $this->get_excluded_forums(), $this->get_passworded_forums()); + if (empty($in_fid_ary)) { - // Not excluded forums or global topic - $sql_where_more = 'AND (' . $db->sql_in_set('t.forum_id', $excluded_forum_ids, true) . ' - OR t.topic_type = ' . POST_GLOBAL . ')'; + return false; } $this->sql = array( @@ -1211,10 +1210,11 @@ class phpbb_feed_topics extends phpbb_feed_base 'ON' => 'f.forum_id = t.forum_id', ), ), - 'WHERE' => "p.post_id = t.topic_first_post_id + 'WHERE' => 'p.post_id = t.topic_first_post_id AND t.topic_moved_id = 0 AND t.topic_approved = 1 - $sql_where_more", + AND (' . $db->sql_in_set('t.forum_id', $in_fid_ary) . ' + OR t.topic_type = ' . POST_GLOBAL . ')', 'ORDER_BY' => 't.topic_time DESC', );