Fix for bug 137. Patch from kelson.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1799 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-10-14 08:27:56 +00:00
parent 83253f757f
commit 62ea5faef5
3 changed files with 32 additions and 4 deletions

View File

@ -114,10 +114,13 @@ if (is_404()) {
@header ('X-Pingback: '. get_bloginfo('pingback_url'));
} else {
// We're showing a feed, so WP is indeed the only thing that last changed
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
if ( $withcomments )
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
else
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
$wp_etag = '"' . md5($wp_last_modified) . '"';
@header('Last-Modified: '.$wp_last_modified);
@header('ETag: '.$wp_etag);
@header("Last-Modified: $wp_last_modified");
@header("ETag: $wp_etag");
@header ('X-Pingback: ' . get_bloginfo('pingback_url'));
// Support for Conditional GET

View File

@ -1,5 +1,6 @@
<?php
if (! $feed) {
if ( !$feed ) {
$withcomments = 1;
require('wp-blog-header.php');
}

View File

@ -141,6 +141,30 @@ function get_lastpostmodified($timezone = 'server') {
return $lastpostmodified;
}
function get_lastcommentmodified($timezone = 'server') {
global $tablecomments, $cache_lastcommentmodified, $pagenow, $wpdb;
$add_seconds_blog = get_settings('gmt_offset') * 3600;
$add_seconds_server = date('Z');
$now = current_time('mysql', 1);
if ( !isset($cache_lastcommentmodified[$timezone]) ) {
switch(strtolower($timezone)) {
case 'gmt':
$lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $tablecomments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1");
break;
case 'blog':
$lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $tablecomments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1");
break;
case 'server':
$lastcommentmodified = $wpdb->get_var("SELECT DATE_ADD(comment_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $tablecomments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1");
break;
}
$cache_lastcommentmodified[$timezone] = $lastcommentmodified;
} else {
$lastcommentmodified = $cache_lastcommentmodified[$timezone];
}
return $lastcommentmodified;
}
function user_pass_ok($user_login,$user_pass) {
global $cache_userdata;
if ( empty($cache_userdata[$user_login]) ) {