Fix for bug 137. Patch from kelson.

git-svn-id: https://develop.svn.wordpress.org/trunk@1799 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Matt Mullenweg 2004-10-14 08:27:56 +00:00
parent 53316541a9
commit 8485291bd9
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]) ) {