Fixed several instances in WordPress where PHP Notices are not being handled correctly.
Fixes supplied by Aaron Jensen (aaron@visualprose.com). Plus removed currently unworkable 304 handling git-svn-id: http://svn.automattic.com/wordpress/trunk@568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b011e9e776
commit
280324268f
32
wp-rdf.php
32
wp-rdf.php
|
@ -1,43 +1,21 @@
|
||||||
<?php /* RDF 1.0 generator, original version by garym@teledyn.com */
|
<?php /* RDF 1.0 generator, original version by garym@teledyn.com */
|
||||||
$blog = 1; // enter your blog's ID
|
$blog = 1; // enter your blog's ID
|
||||||
$doing_rss=1;
|
$doing_rss = 1;
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml', true);
|
||||||
|
|
||||||
include('blog.header.php');
|
include('blog.header.php');
|
||||||
|
|
||||||
// Handle Conditional GET
|
|
||||||
|
|
||||||
// Get the time of the most recent article
|
// Get the time of the most recent article
|
||||||
$sql = "SELECT max(post_date) FROM $tableposts";
|
$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
|
||||||
|
|
||||||
$maxdate = $wpdb->get_var($sql);
|
|
||||||
++$querycount;
|
|
||||||
$unixtime = strtotime($maxdate);
|
$unixtime = strtotime($maxdate);
|
||||||
|
|
||||||
// format timestamp for Last-Modified header
|
// format timestamp for Last-Modified header
|
||||||
$clast = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
|
$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
|
||||||
$cetag = md5($last);
|
$cetag = (isset($clast)) ? md5($clast) : '';
|
||||||
|
|
||||||
$slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
|
||||||
$setag = $_SERVER['HTTP_IF_NONE_MATCH'];
|
|
||||||
|
|
||||||
// send it in a Last-Modified header
|
// send it in a Last-Modified header
|
||||||
header("Last-Modified: " . $clast, true);
|
header("Last-Modified: " . $clast, true);
|
||||||
header("Etag: " . $cetag, true);
|
header("Etag: " . $cetag, true);
|
||||||
|
|
||||||
// compare it to aggregator's If-Modified-Since and If-None-Match headers
|
|
||||||
// if they match, send a 304 and die
|
|
||||||
|
|
||||||
// This logic says that if only one header is provided, just use that one,
|
|
||||||
// but if both headers exist, they *both* must match up with the locally
|
|
||||||
// generated values.
|
|
||||||
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
|
|
||||||
if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
|
|
||||||
header("HTTP/1.1 304 Not Modified");
|
|
||||||
echo "\r\n\r\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
add_filter('the_content', 'trim');
|
add_filter('the_content', 'trim');
|
||||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||||
?>
|
?>
|
||||||
|
|
30
wp-rss.php
30
wp-rss.php
|
@ -2,47 +2,21 @@
|
||||||
In every template you do, you got to copy them before the CafeLog 'loop' */
|
In every template you do, you got to copy them before the CafeLog 'loop' */
|
||||||
$blog = 1; // enter your blog's ID
|
$blog = 1; // enter your blog's ID
|
||||||
$doing_rss = 1;
|
$doing_rss = 1;
|
||||||
header('Content-type: text/xml',true);
|
header('Content-type: text/xml', true);
|
||||||
include('blog.header.php');
|
include('blog.header.php');
|
||||||
|
|
||||||
// Handle Conditional GET
|
|
||||||
|
|
||||||
// Get the time of the most recent article
|
// Get the time of the most recent article
|
||||||
$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
|
$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
|
||||||
++$querycount;
|
|
||||||
$unixtime = strtotime($maxdate);
|
$unixtime = strtotime($maxdate);
|
||||||
|
|
||||||
// format timestamp for Last-Modified header
|
// format timestamp for Last-Modified header
|
||||||
$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
|
$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
|
||||||
$cetag = (isset($last)) ? md5($last) : '';
|
$cetag = (isset($clast)) ? md5($clast) : '';
|
||||||
|
|
||||||
$slast = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : '' ;
|
|
||||||
$setag = (isset($_SERVER['HTTP_IF_NONE_MATCH'])) ? $_SERVER['HTTP_IF_NONE_MATCH'] : '';
|
|
||||||
|
|
||||||
// send it in a Last-Modified header
|
// send it in a Last-Modified header
|
||||||
header("Last-Modified: " . $clast, true);
|
header("Last-Modified: " . $clast, true);
|
||||||
header("Etag: " . $cetag, true);
|
header("Etag: " . $cetag, true);
|
||||||
|
|
||||||
// compare it to aggregator's If-Modified-Since and If-None-Match headers
|
|
||||||
// if they match, send a 304 and die
|
|
||||||
|
|
||||||
// This logic says that if only one header is provided, just use that one,
|
|
||||||
// but if both headers exist, they *both* must match up with the locally
|
|
||||||
// generated values.
|
|
||||||
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
|
|
||||||
if (($slast != '') && ($setag != '')) {
|
|
||||||
if (($slast == $clast) && ($setag == $cetag)) {
|
|
||||||
header("HTTP/1.1 304 Not Modified");
|
|
||||||
echo "\r\n\r\n";
|
|
||||||
exit;
|
|
||||||
} else if (($slast == $clast)
|
|
||||||
|| ($setag == $cetag)) {
|
|
||||||
header("HTTP/1.1 304 Not Modified");
|
|
||||||
echo "\r\n\r\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||||
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
||||||
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
|
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
|
||||||
|
|
35
wp-rss2.php
35
wp-rss2.php
|
@ -1,44 +1,21 @@
|
||||||
<?php
|
<?php
|
||||||
$blog=1;
|
$blog = 1;
|
||||||
$doing_rss=1;
|
$doing_rss = 1;
|
||||||
header('Content-type: text/xml');
|
header('Content-type: text/xml', true);
|
||||||
|
|
||||||
include('blog.header.php');
|
include('blog.header.php');
|
||||||
|
|
||||||
// Handle Conditional GET
|
|
||||||
|
|
||||||
// Get the time of the most recent article
|
// Get the time of the most recent article
|
||||||
$sql = "SELECT max(post_date) FROM $tableposts";
|
$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
|
||||||
|
|
||||||
$maxdate = $wpdb->get_var($sql);
|
|
||||||
++$querycount;
|
|
||||||
|
|
||||||
$unixtime = strtotime($maxdate);
|
$unixtime = strtotime($maxdate);
|
||||||
|
|
||||||
// format timestamp for Last-Modified header
|
// format timestamp for Last-Modified header
|
||||||
$clast = gmdate("D, d M Y H:i:s \G\M\T",$unixtime);
|
$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
|
||||||
$cetag = md5($last);
|
$cetag = (isset($clast)) ? md5($clast) : '';
|
||||||
|
|
||||||
$slast = $_SERVER['HTTP_IF_MODIFIED_SINCE'];
|
|
||||||
$setag = $_SERVER['HTTP_IF_NONE_MATCH'];
|
|
||||||
|
|
||||||
// send it in a Last-Modified header
|
// send it in a Last-Modified header
|
||||||
header("Last-Modified: " . $clast, true);
|
header("Last-Modified: " . $clast, true);
|
||||||
header("Etag: " . $cetag, true);
|
header("Etag: " . $cetag, true);
|
||||||
|
|
||||||
// compare it to aggregator's If-Modified-Since and If-None-Match headers
|
|
||||||
// if they match, send a 304 and die
|
|
||||||
|
|
||||||
// This logic says that if only one header is provided, just use that one,
|
|
||||||
// but if both headers exist, they *both* must match up with the locally
|
|
||||||
// generated values.
|
|
||||||
//if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){
|
|
||||||
if (($slast && $setag)?(($slast == $clast) && ($setag == $cetag)):(($slast == $clast) || ($setag == $cetag))) {
|
|
||||||
header("HTTP/1.1 304 Not Modified");
|
|
||||||
echo "\r\n\r\n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($rss_language)) { $rss_language = 'en'; }
|
if (!isset($rss_language)) { $rss_language = 'en'; }
|
||||||
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
|
||||||
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
|
if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
|
||||||
|
|
Loading…
Reference in New Issue