mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Correctly use RFC 3339 date in ATOM feeds. Bug #55005
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10312 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
b577dece44
commit
56cc34602b
2 changed files with 31 additions and 6 deletions
|
@ -108,6 +108,7 @@
|
||||||
<li>[Fix] Posting errors with CAPTCHAs using user::add_lang(). (Bug #55245)</li>
|
<li>[Fix] Posting errors with CAPTCHAs using user::add_lang(). (Bug #55245)</li>
|
||||||
<li>[Fix] Use memcache::replace() instead of memcache::set() for existing keys to prevent problems.</li>
|
<li>[Fix] Use memcache::replace() instead of memcache::set() for existing keys to prevent problems.</li>
|
||||||
<li>[Fix] Check for required functions in eAccelerator. (Bug #54465)</li>
|
<li>[Fix] Check for required functions in eAccelerator. (Bug #54465)</li>
|
||||||
|
<li>[Fix] Use correct RFC 3339 date format in ATOM feed. (Bug #55005)</li>
|
||||||
<li>[Change] Log activation through inactive users ACP. (Bug #30145)</li>
|
<li>[Change] Log activation through inactive users ACP. (Bug #30145)</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>
|
||||||
|
|
|
@ -35,15 +35,12 @@ $forum_id = request_var('f', 0);
|
||||||
$topic_id = request_var('t', 0);
|
$topic_id = request_var('t', 0);
|
||||||
$mode = request_var('mode', '');
|
$mode = request_var('mode', '');
|
||||||
|
|
||||||
// Feed date format for PHP > 5 and PHP4
|
|
||||||
$feed_date_format = (PHP_VERSION >= 5) ? 'c' : "Y-m-d\TH:i:sO";
|
|
||||||
$params = false;
|
|
||||||
|
|
||||||
// We do not use a template, therefore we simply define the global template variables here
|
// We do not use a template, therefore we simply define the global template variables here
|
||||||
$global_vars = $item_vars = array();
|
$global_vars = $item_vars = array();
|
||||||
$feed_updated_time = 0;
|
$feed_updated_time = 0;
|
||||||
|
|
||||||
// Generate params array for use in append_sid() to correctly link back to this page
|
// Generate params array for use in append_sid() to correctly link back to this page
|
||||||
|
$params = false;
|
||||||
if ($forum_id || $topic_id || $mode)
|
if ($forum_id || $topic_id || $mode)
|
||||||
{
|
{
|
||||||
$params = array(
|
$params = array(
|
||||||
|
@ -94,7 +91,7 @@ while ($row = $feed->get_item())
|
||||||
|
|
||||||
$item_row = array(
|
$item_row = array(
|
||||||
'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
|
'author' => ($feed->get('creator') !== NULL) ? $row[$feed->get('creator')] : '',
|
||||||
'pubdate' => $user->format_date($item_time, $feed_date_format, true),
|
'pubdate' => feed_format_date($item_time),
|
||||||
'link' => '',
|
'link' => '',
|
||||||
'title' => censor_text($title),
|
'title' => censor_text($title),
|
||||||
'category' => ($config['feed_item_statistics']) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
|
'category' => ($config['feed_item_statistics']) ? $board_url . '/viewforum.' . $phpEx . '?f=' . $row['forum_id'] : '',
|
||||||
|
@ -125,7 +122,7 @@ $global_vars = array_merge($global_vars, array(
|
||||||
'FEED_LINK' => $board_url . '/index.' . $phpEx,
|
'FEED_LINK' => $board_url . '/index.' . $phpEx,
|
||||||
'FEED_TITLE' => $config['sitename'],
|
'FEED_TITLE' => $config['sitename'],
|
||||||
'FEED_SUBTITLE' => $config['site_desc'],
|
'FEED_SUBTITLE' => $config['site_desc'],
|
||||||
'FEED_UPDATED' => $user->format_date($feed_updated_time, $feed_date_format, true),
|
'FEED_UPDATED' => feed_format_date($feed_updated_time),
|
||||||
'FEED_LANG' => $user->lang['USER_LANG'],
|
'FEED_LANG' => $user->lang['USER_LANG'],
|
||||||
'FEED_AUTHOR' => $config['sitename'],
|
'FEED_AUTHOR' => $config['sitename'],
|
||||||
));
|
));
|
||||||
|
@ -224,6 +221,33 @@ function feed_append_sid($url, $params)
|
||||||
return append_sid($board_url . $url, $params, true, '');
|
return append_sid($board_url . $url, $params, true, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate ISO 8601 date string (RFC 3339)
|
||||||
|
**/
|
||||||
|
function feed_format_date($time)
|
||||||
|
{
|
||||||
|
static $zone_offset;
|
||||||
|
static $offset_string;
|
||||||
|
|
||||||
|
if (empty($offset_string))
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$zone_offset = (int) $user->timezone + (int) $user->dst;
|
||||||
|
|
||||||
|
$sign = ($zone_offset < 0) ? '-' : '+';
|
||||||
|
$time_offset = abs($zone_offset);
|
||||||
|
|
||||||
|
$offset_seconds = $time_offset % 3600;
|
||||||
|
$offset_minutes = $offset_seconds / 60;
|
||||||
|
$offset_hours = ($time_offset - $offset_seconds) / 3600;
|
||||||
|
|
||||||
|
$offset_string = sprintf("%s%02d:%02d", $sign, $offset_hours, $offset_minutes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return gmdate("Y-m-d\TH:i:s", $time + $zone_offset) . $offset_string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate text content
|
* Generate text content
|
||||||
**/
|
**/
|
||||||
|
|
Loading…
Add table
Reference in a new issue