diff options
Diffstat (limited to 'phpBB/feed.php')
-rw-r--r-- | phpBB/feed.php | 119 |
1 files changed, 22 insertions, 97 deletions
diff --git a/phpBB/feed.php b/phpBB/feed.php index 9816f0f303..bc23a19f42 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -760,9 +760,6 @@ class phpbb_feed_overall extends phpbb_feed_post_base return false; } - // Add global forum id - $forum_ids[] = 0; - // m_approve forums $fid_m_approve = $this->get_moderator_approve_forums(); $sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $db->sql_in_set('forum_id', $fid_m_approve) : ''; @@ -900,12 +897,11 @@ class phpbb_feed_forum extends phpbb_feed_post_base global $auth, $db; $m_approve = ($auth->acl_get('m_approve', $this->forum_id)) ? true : false; - $forum_ids = array(0, $this->forum_id); // Determine topics with recent activity $sql = 'SELECT topic_id, topic_last_post_time FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . ' + WHERE forum_id = ' . $this->forum_id . ' AND topic_moved_id = 0 ' . ((!$m_approve) ? 'AND topic_approved = 1' : '') . ' ORDER BY topic_last_post_time DESC'; @@ -994,96 +990,37 @@ class phpbb_feed_topic extends phpbb_feed_post_base trigger_error('NO_TOPIC'); } - if ($this->topic_data['topic_type'] == POST_GLOBAL) - { - // We need to find at least one postable forum where feeds are enabled, - // that the user can read and maybe also has approve permissions. - $in_fid_ary = $this->get_readable_forums(); - - if (empty($in_fid_ary)) - { - // User cannot read any forums - trigger_error('SORRY_AUTH_READ'); - } - - if (!$this->topic_data['topic_approved']) - { - // Also require m_approve - $in_fid_ary = array_intersect($in_fid_ary, $this->get_moderator_approve_forums()); - - if (empty($in_fid_ary)) - { - trigger_error('SORRY_AUTH_READ'); - } - } - - // Diff excluded forums - $in_fid_ary = array_diff($in_fid_ary, $this->get_excluded_forums()); - - if (empty($in_fid_ary)) - { - trigger_error('SORRY_AUTH_READ'); - } - - // Also exclude passworded forums - $in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums()); - - if (empty($in_fid_ary)) - { - trigger_error('SORRY_AUTH_READ'); - } - - $sql = 'SELECT forum_id, left_id - FROM ' . FORUMS_TABLE . ' - WHERE forum_type = ' . FORUM_POST . ' - AND ' . $db->sql_in_set('forum_id', $in_fid_ary) . ' - ORDER BY left_id ASC'; - $result = $db->sql_query_limit($sql, 1); - $this->forum_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if (empty($this->forum_data)) - { - // No forum found. - trigger_error('SORRY_AUTH_READ'); - } + $this->forum_id = (int) $this->topic_data['forum_id']; - unset($in_fid_ary); + // Make sure topic is either approved or user authed + if (!$this->topic_data['topic_approved'] && !$auth->acl_get('m_approve', $this->forum_id)) + { + trigger_error('SORRY_AUTH_READ'); } - else + + // Make sure forum is not excluded from feed + if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options'])) { - $this->forum_id = (int) $this->topic_data['forum_id']; + trigger_error('NO_FEED'); + } - // Make sure topic is either approved or user authed - if (!$this->topic_data['topic_approved'] && !$auth->acl_get('m_approve', $this->forum_id)) - { - trigger_error('SORRY_AUTH_READ'); - } + // Make sure we can read this forum + if (!$auth->acl_get('f_read', $this->forum_id)) + { + trigger_error('SORRY_AUTH_READ'); + } - // Make sure forum is not excluded from feed - if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $this->topic_data['forum_options'])) - { - trigger_error('NO_FEED'); - } + // Make sure forum is not passworded or user is authed + if ($this->topic_data['forum_password']) + { + $forum_ids_passworded = $this->get_passworded_forums(); - // Make sure we can read this forum - if (!$auth->acl_get('f_read', $this->forum_id)) + if (isset($forum_ids_passworded[$this->forum_id])) { trigger_error('SORRY_AUTH_READ'); } - // Make sure forum is not passworded or user is authed - if ($this->topic_data['forum_password']) - { - $forum_ids_passworded = $this->get_passworded_forums(); - - if (isset($forum_ids_passworded[$this->forum_id])) - { - trigger_error('SORRY_AUTH_READ'); - } - - unset($forum_ids_passworded); - } + unset($forum_ids_passworded); } } @@ -1230,9 +1167,6 @@ class phpbb_feed_news extends phpbb_feed_topic_base return false; } - // Add global forum - $in_fid_ary[] = 0; - // We really have to get the post ids first! $sql = 'SELECT topic_first_post_id, topic_time FROM ' . TOPICS_TABLE . ' @@ -1303,9 +1237,6 @@ class phpbb_feed_topics extends phpbb_feed_topic_base return false; } - // Add global forum - $in_fid_ary[] = 0; - // We really have to get the post ids first! $sql = 'SELECT topic_first_post_id, topic_time FROM ' . TOPICS_TABLE . ' @@ -1395,9 +1326,6 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base return false; } - // Add global forum - $in_fid_ary[] = 0; - // Search for topics in last X days $last_post_time_sql = ($this->sort_days) ? ' AND topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : ''; @@ -1482,6 +1410,3 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title']; } } - - -?>
\ No newline at end of file |