aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/feed.php
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2009-12-13 13:02:37 +0000
committerAndreas Fischer <bantu@phpbb.com>2009-12-13 13:02:37 +0000
commitb6f9a1a6e881241fa16b24a3a7bd30017fb52d0e (patch)
tree0d7e3a48561f0440602622e20763edac26ac22ef /phpBB/feed.php
parent07c990302c9bdcd98dfbc8d5db2cae764cc7aa6e (diff)
downloadforums-b6f9a1a6e881241fa16b24a3a7bd30017fb52d0e.tar
forums-b6f9a1a6e881241fa16b24a3a7bd30017fb52d0e.tar.gz
forums-b6f9a1a6e881241fa16b24a3a7bd30017fb52d0e.tar.bz2
forums-b6f9a1a6e881241fa16b24a3a7bd30017fb52d0e.tar.xz
forums-b6f9a1a6e881241fa16b24a3a7bd30017fb52d0e.zip
Topic/Forum Feed: Also throw NO_FEED if forum has been excluded from feeds.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10328 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/feed.php')
-rw-r--r--phpBB/feed.php63
1 files changed, 36 insertions, 27 deletions
diff --git a/phpBB/feed.php b/phpBB/feed.php
index 960ada589e..13eb0698bc 100644
--- a/phpBB/feed.php
+++ b/phpBB/feed.php
@@ -693,41 +693,50 @@ class phpbb_feed extends phpbb_feed_base
{
global $auth, $db, $user;
- if ($this->topic_id)
+ // Topic/Forum feed
+ if ($this->topic_id || $this->forum_id)
{
- // Topic feed
- $sql = 'SELECT forum_id
- FROM ' . TOPICS_TABLE . '
- WHERE topic_id = ' . $this->topic_id;
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $this->forum_id = (int) $row['forum_id'];
- $db->sql_freeresult($result);
+ if ($this->topic_id)
+ {
+ // Topic feed
+ $sql = 'SELECT t.forum_id, f.forum_options
+ FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
+ WHERE t.topic_id = ' . $this->topic_id . '
+ AND t.forum_id = f.forum_id';
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
- if (empty($row))
+ if (empty($row))
+ {
+ trigger_error('NO_TOPIC');
+ }
+
+ $this->forum_id = (int) $row['forum_id'];
+ }
+ else
{
- trigger_error('NO_TOPIC');
+ // Forum feed
+ $sql = 'SELECT forum_options
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_id = ' . $this->forum_id;
+ $result = $db->sql_query($sql);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if (empty($row))
+ {
+ trigger_error('NO_FORUM');
+ }
}
- }
- else if ($this->forum_id)
- {
- // Forum feed
- $sql = 'SELECT forum_id
- FROM ' . FORUMS_TABLE . '
- WHERE forum_id = ' . $this->forum_id;
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- if (empty($row))
+ // Make sure forum is not excluded from feed
+ if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']))
{
- trigger_error('NO_FORUM');
+ trigger_error('NO_FEED');
}
- }
- // Topic/Forum feed
- if ($this->topic_id || $this->forum_id)
- {
+ // Make sure we can read this forum
if (!$auth->acl_get('f_read', $this->forum_id))
{
trigger_error('SORRY_AUTH_READ');