Fix Bug #54295 - Cleanly handle forum/topic not found in ATOM Feeds. Also related: Bug #54735

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10296 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Andreas Fischer 2009-12-01 12:25:34 +00:00
parent cf9e42ffd8
commit 1de328e2fe
2 changed files with 27 additions and 19 deletions

View file

@ -100,6 +100,7 @@
<li>[Fix] Fulltext-MySQL search for keywords and username at the same time. (Bug #54325)</li> <li>[Fix] Fulltext-MySQL search for keywords and username at the same time. (Bug #54325)</li>
<li>[Fix] Various XHTML mistakes in prosilver. (Bug #54705)</li> <li>[Fix] Various XHTML mistakes in prosilver. (Bug #54705)</li>
<li>[Fix] Correctly show topic ATOM feed link when only post id is specified. (Bug #53025)</li> <li>[Fix] Correctly show topic ATOM feed link when only post id is specified. (Bug #53025)</li>
<li>[Fix] Cleanly handle forum/topic not found in ATOM Feeds. (Bug #54295)</li>
<li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li> <li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li>
<li>[Change] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)</li> <li>[Change] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)</li>
</ul> </ul>

View file

@ -66,7 +66,10 @@ if ($feed === false)
} }
// Open Feed // Open Feed
$feed->open(); if ($feed->open() === false)
{
trigger_error('NO_FEED');
}
// Iterate through items // Iterate through items
while ($row = $feed->get_item()) while ($row = $feed->get_item())
@ -479,34 +482,42 @@ class phpbb_feed
{ {
if (!$this->forum_id && !$this->topic_id) if (!$this->forum_id && !$this->topic_id)
{ {
return; return false;
} }
else if ($this->forum_id && !$this->topic_id) else if ($this->forum_id && !$this->topic_id)
{ {
global $db, $user, $global_vars; global $db, $user;
$sql = 'SELECT forum_name $sql = 'SELECT forum_name
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);
$row = $db->sql_fetchrow($result);
$global_vars['FEED_MODE'] = $user->lang['FORUM'] . ': ' . $db->sql_fetchfield('forum_name');
$db->sql_freeresult($result); $db->sql_freeresult($result);
if (empty($row))
{
return false;
}
} }
else if ($this->topic_id) else if ($this->topic_id)
{ {
global $db, $user, $global_vars; global $db, $user;
$sql = 'SELECT topic_title $sql = 'SELECT topic_title
FROM ' . TOPICS_TABLE . ' FROM ' . TOPICS_TABLE . '
WHERE topic_id = ' . $this->topic_id; WHERE topic_id = ' . $this->topic_id;
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$global_vars['FEED_MODE'] = $user->lang['TOPIC'] . ': ' . $db->sql_fetchfield('topic_title');
$db->sql_freeresult($result); $db->sql_freeresult($result);
if (empty($row))
{
return false;
}
} }
return true;
} }
function close() function close()
@ -517,6 +528,8 @@ class phpbb_feed
$db->sql_freeresult($this->result); $db->sql_freeresult($this->result);
} }
return true;
} }
/** /**
@ -840,9 +853,7 @@ class phpbb_feed_forums extends phpbb_feed
function open() function open()
{ {
global $user, $global_vars; return true;
$global_vars['FEED_MODE'] = $user->lang['FORUMS'];
} }
function get_sql() function get_sql()
@ -903,9 +914,7 @@ class phpbb_feed_news extends phpbb_feed
function open() function open()
{ {
global $user, $global_vars; return true;
$global_vars['FEED_MODE'] = $user->lang['FEED_NEWS'];
} }
function get_sql() function get_sql()
@ -997,9 +1006,7 @@ class phpbb_feed_topics extends phpbb_feed
function open() function open()
{ {
global $user, $global_vars; return true;
$global_vars['FEED_MODE'] = $user->lang['TOPICS'];
} }
function get_sql() function get_sql()