00001 <?php 00002 00003 /* 00004 * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 00005 * Copyright (C) 2002-2007 The Nucleus Group 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * (see nucleus/documentation/index.html#license for more info) 00012 */ 00013 00022 header('Pragma: no-cache'); 00023 00024 $CONF = array(); 00025 $CONF['Self'] = 'xml-rss2.php'; 00026 00027 include('./config.php'); 00028 00029 if (!$CONF['DisableSite']) { 00030 00031 // get feed into $feed 00032 ob_start(); 00033 selectSkin('feeds/rss20'); 00034 selector(); 00035 $feed = ob_get_contents(); 00036 ob_end_clean(); 00037 00038 // create ETAG (hash of feed) 00039 // (HTTP_IF_NONE_MATCH has quotes around it) 00040 $eTag = '"' . md5($feed) . '"'; 00041 header('Etag: ' . $eTag); 00042 00043 // compare Etag to what we got 00044 if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) { 00045 header('HTTP/1.0 304 Not Modified'); 00046 header('Content-Length: 0'); 00047 } else { 00048 header("Content-Type: application/xml"); 00049 // dump feed 00050 echo $feed; 00051 } 00052 00053 } else { 00054 // output empty RSS file... 00055 // (because site is disabled) 00056 00057 echo '<' . '?xml version="1.0" encoding="' . _CHARSET . '"?' . '>'; 00058 00059 ?> 00060 <rss version="2.0"> 00061 <channel> 00062 <title><?php echo htmlspecialchars($CONF['SiteName']); ?></title> 00063 <link><?php echo htmlspecialchars($CONF['IndexURL']); ?></link> 00064 <description></description> 00065 <docs>http://backend.userland.com/rss</docs> 00066 </channel> 00067 </rss> 00068 <?php 00069 } 00070 00071 ?>