$news_page_url
{$m['newsid']}@$news_page_url
$pubDate
EX;
}
} else {
$last_mod_time = date(RSS20_DATE_FORMAT, time());
}
# Channel header
$rss_channel['title'] = htmlspecialchars($rss_channel['title']);
$rss_channel['description'] = htmlspecialchars($rss_channel['description']);
$channel = <<
{$rss_channel['title']}
{$rss_channel['link']}
{$rss_channel['description']}
{$rss_channel['language']}
X-Cart
$last_mod_time
$last_mod_time
EX;
if (!empty($items_code)) {
$channel .= $items_code;
unset($items_code);
}
$channel .= <<
EX;
$channel_etag = '"'.md5($channel).'"';
# Conditional GET logic [[[
# Check if the channel contents should be passed to client.
# We analyze HTTP response headers: If-Modified-Since, If-None-Match
$IMS_FLAG = 0;
if (!empty($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE'])) {
if (strtotime($HTTP_SERVER_VARS['HTTP_IF_MODIFIED_SINCE']) == strtotime($last_mod_time)) {
$IMS_FLAG = 1;
}
}
$INM_FLAG = 0;
if (!empty($HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH'])) {
if ($HTTP_SERVER_VARS['HTTP_IF_NONE_MATCH'] == $channel_etag) {
$INM_FLAG = 1;
}
}
$pass_channel_to_client = !($IMS_FLAG || $INM_FLAG);
# ]]]
if (!$pass_channel_to_client) {
header("HTTP/1.0 304 Not Modified");
header('ETag: ' . $channel_etag);
} else {
# Output headers [[[
header("Content-Type: application/xml; charset=".$rss_channel['encoding']);
header("Content-length: " . strlen($channel));
header("Last-Modified: " . $last_mod_time);
header('ETag: ' . $channel_etag);
# ]]]
echo $channel;
}
# vim600: set et sw=4 sts=4 ts=4 fdm=marker fmr=[[[,]]]:
?>