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] 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] 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] Use em dash instead of hyphen/minus as separator in ATOM Feeds item statistics. (Bug #53565)</li>
</ul>

View file

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