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
This commit is contained in:
Andreas Fischer 2009-12-13 13:02:37 +00:00
parent 07c990302c
commit b6f9a1a6e8

View file

@ -693,26 +693,31 @@ class phpbb_feed extends phpbb_feed_base
{ {
global $auth, $db, $user; global $auth, $db, $user;
// Topic/Forum feed
if ($this->topic_id || $this->forum_id)
{
if ($this->topic_id) if ($this->topic_id)
{ {
// Topic feed // Topic feed
$sql = 'SELECT forum_id $sql = 'SELECT t.forum_id, f.forum_options
FROM ' . TOPICS_TABLE . ' FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f
WHERE topic_id = ' . $this->topic_id; WHERE t.topic_id = ' . $this->topic_id . '
AND t.forum_id = f.forum_id';
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
$this->forum_id = (int) $row['forum_id'];
$db->sql_freeresult($result); $db->sql_freeresult($result);
if (empty($row)) if (empty($row))
{ {
trigger_error('NO_TOPIC'); trigger_error('NO_TOPIC');
} }
$this->forum_id = (int) $row['forum_id'];
} }
else if ($this->forum_id) else
{ {
// Forum feed // Forum feed
$sql = 'SELECT forum_id $sql = 'SELECT forum_options
FROM ' . FORUMS_TABLE . ' FROM ' . FORUMS_TABLE . '
WHERE forum_id = ' . $this->forum_id; WHERE forum_id = ' . $this->forum_id;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
@ -725,9 +730,13 @@ class phpbb_feed extends phpbb_feed_base
} }
} }
// Topic/Forum feed // Make sure forum is not excluded from feed
if ($this->topic_id || $this->forum_id) if (phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']))
{ {
trigger_error('NO_FEED');
}
// Make sure we can read this forum
if (!$auth->acl_get('f_read', $this->forum_id)) if (!$auth->acl_get('f_read', $this->forum_id))
{ {
trigger_error('SORRY_AUTH_READ'); trigger_error('SORRY_AUTH_READ');