diff options
author | Andreas Fischer <bantu@phpbb.com> | 2009-11-20 21:14:34 +0000 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2009-11-20 21:14:34 +0000 |
commit | f5cbd9ea0e408d5b0e6764ff167b260410acce81 (patch) | |
tree | 9742efbaf1f986b4187a423d12e48bbc83ce8d30 /phpBB | |
parent | 4701b446f52e43e9709add49b0611ea7613b1563 (diff) | |
download | forums-f5cbd9ea0e408d5b0e6764ff167b260410acce81.tar forums-f5cbd9ea0e408d5b0e6764ff167b260410acce81.tar.gz forums-f5cbd9ea0e408d5b0e6764ff167b260410acce81.tar.bz2 forums-f5cbd9ea0e408d5b0e6764ff167b260410acce81.tar.xz forums-f5cbd9ea0e408d5b0e6764ff167b260410acce81.zip |
Implement suggestion as per Bug #53305 - Send time of last item instead of current time in ATOM Feeds.
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10281 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/docs/CHANGELOG.html | 1 | ||||
-rw-r--r-- | phpBB/feed.php | 41 |
2 files changed, 27 insertions, 15 deletions
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 254364a2b7..e04fe2be48 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -92,6 +92,7 @@ <li>[Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)</li> <li>[Fix] Force full date for board online record date.</li> <li>[Fix] Correctly reset login keys if passed value is the current user. (Bug #54125)</li> + <li>[Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)</li> </ul> <a name="v305"></a><h3>1.ii. Changes since 3.0.5</h3> diff --git a/phpBB/feed.php b/phpBB/feed.php index b9d6e1959a..cbc7cb60d1 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -41,6 +41,7 @@ $params = false; // We do not use a template, therefore we simply define the global template variables here $global_vars = $item_vars = array(); +$feed_updated_time = 0; // Generate params array for use in append_sid() to correctly link back to this page if ($forum_id || $topic_id || $mode) @@ -67,19 +68,6 @@ if ($feed === false) // Open Feed $feed->open(); -// Some default assignments -// FEED_IMAGE is not used (atom) -$global_vars = array( - 'FEED_IMAGE' => ($user->img('site_logo', '', false, '', 'src')) ? $board_url . '/' . substr($user->img('site_logo', '', false, '', 'src'), strlen($phpbb_root_path)) : '', - 'SELF_LINK' => feed_append_sid('/feed.' . $phpEx, $params), - 'FEED_LINK' => $board_url . '/index.' . $phpEx, - 'FEED_TITLE' => $config['sitename'], - 'FEED_SUBTITLE' => $config['site_desc'], - 'FEED_UPDATED' => $user->format_date(time(), $feed_date_format, true), - 'FEED_LANG' => $user->lang['USER_LANG'], - 'FEED_AUTHOR' => $config['sitename'], -); - // Iterate through items while ($row = $feed->get_item()) { @@ -102,9 +90,11 @@ while ($row = $feed->get_item()) $title = ($row[$feed->get('title')]) ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : ''); $title = censor_text($title); + $item_time = (int) $row[$feed->get('date')]; + $item_row = array( 'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '', - 'pubdate' => $user->format_date($row[$feed->get('date')], $feed_date_format, true), + 'pubdate' => $user->format_date($item_time, $feed_date_format, true), 'link' => '', 'title' => censor_text($title), 'category' => ($config['feed_item_statistics']) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '', @@ -117,8 +107,29 @@ while ($row = $feed->get_item()) $feed->adjust_item($item_row, $row); $item_vars[] = $item_row; + + $feed_updated_time = max($feed_updated_time, $item_time); } +// If we do not have any items at all, sending the current time is better than sending no time. +if (!$feed_updated_time) +{ + $feed_updated_time = time(); +} + +// Some default assignments +// FEED_IMAGE is not used (atom) +$global_vars = array( + 'FEED_IMAGE' => ($user->img('site_logo', '', false, '', 'src')) ? $board_url . '/' . substr($user->img('site_logo', '', false, '', 'src'), strlen($phpbb_root_path)) : '', + 'SELF_LINK' => feed_append_sid('/feed.' . $phpEx, $params), + 'FEED_LINK' => $board_url . '/index.' . $phpEx, + 'FEED_TITLE' => $config['sitename'], + 'FEED_SUBTITLE' => $config['site_desc'], + 'FEED_UPDATED' => $user->format_date($feed_updated_time, $feed_date_format, true), + 'FEED_LANG' => $user->lang['USER_LANG'], + 'FEED_AUTHOR' => $config['sitename'], +); + $feed->close(); // Output page @@ -136,7 +147,7 @@ if ($config['gzip_compress']) if (!defined('DEBUG_EXTRA') || !request_var('explain', 0) || !$auth->acl_get('a_')) { header("Content-Type: application/atom+xml; charset=UTF-8"); - header("Last-Modified: " . gmdate('D, d M Y H:i:s', time()) . ' GMT'); + header("Last-Modified: " . gmdate('D, d M Y H:i:s', $feed_updated_time) . ' GMT'); } else { |