Changeset 568 for trunk/wp-rss.php
- Timestamp:
- 12/05/2003 01:21:09 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-rss.php
r559 r568 3 3 $blog = 1; // enter your blog's ID 4 4 $doing_rss = 1; 5 header('Content-type: text/xml', true);5 header('Content-type: text/xml', true); 6 6 include('blog.header.php'); 7 8 // Handle Conditional GET9 7 10 8 // Get the time of the most recent article 11 9 $maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts"); 12 ++$querycount;13 10 $unixtime = strtotime($maxdate); 14 11 15 12 // format timestamp for Last-Modified header 16 13 $clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime); 17 $cetag = (isset($last)) ? md5($last) : ''; 18 19 $slast = (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) ? $_SERVER['HTTP_IF_MODIFIED_SINCE'] : '' ; 20 $setag = (isset($_SERVER['HTTP_IF_NONE_MATCH'])) ? $_SERVER['HTTP_IF_NONE_MATCH'] : ''; 14 $cetag = (isset($clast)) ? md5($clast) : ''; 21 15 22 16 // send it in a Last-Modified header 23 17 header("Last-Modified: " . $clast, true); 24 18 header("Etag: " . $cetag, true); 25 26 // compare it to aggregator's If-Modified-Since and If-None-Match headers27 // if they match, send a 304 and die28 29 // This logic says that if only one header is provided, just use that one,30 // but if both headers exist, they *both* must match up with the locally31 // generated values.32 //if (($slast?($slast == $clast):true) && ($setag?($setag == $cetag):true)){33 if (($slast != '') && ($setag != '')) {34 if (($slast == $clast) && ($setag == $cetag)) {35 header("HTTP/1.1 304 Not Modified");36 echo "\r\n\r\n";37 exit;38 } else if (($slast == $clast)39 || ($setag == $cetag)) {40 header("HTTP/1.1 304 Not Modified");41 echo "\r\n\r\n";42 exit;43 }44 }45 19 46 20 if (!isset($rss_language)) { $rss_language = 'en'; }
Note: See TracChangeset
for help on using the changeset viewer.