OSDN Git Service

merged 3.2.1(?) modification
[nucleus-jp/nucleus-jp-ancient.git] / xml-rss2.php
1 <?php\r
2 \r
3 /*\r
4  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
5  * Copyright (C) 2002-2005 The Nucleus Group\r
6  *\r
7  * This program is free software; you can redistribute it and/or\r
8  * modify it under the terms of the GNU General Public License\r
9  * as published by the Free Software Foundation; either version 2\r
10  * of the License, or (at your option) any later version.\r
11  * (see nucleus/documentation/index.html#license for more info)\r
12  */\r
13 \r
14 /**\r
15  * Nucleus RSS syndication channel skin\r
16  * @license http://nucleuscms.org/license.txt GNU General Public License\r
17  * @copyright Copyright (C) 2002-2005 The Nucleus Group\r
18  * @version $Id: xml-rss2.php,v 1.5 2005-04-20 06:49:45 kimitake Exp $\r
19  * $NucleusJP$\r
20  */\r
21 \r
22 header("Pragma: no-cache");\r
23 \r
24 $CONF = array();\r
25 $CONF['Self'] = "xml-rss2.php";\r
26 \r
27 include('./config.php');\r
28 \r
29 if (!$CONF['DisableSite']) {\r
30         // get feed into $feed\r
31         ob_start();\r
32                 selectSkin('feeds/rss20');\r
33                 selector();\r
34         $feed = ob_get_contents();\r
35         ob_end_clean();\r
36         \r
37         // create ETAG (hash of feed)\r
38         // (HTTP_IF_NONE_MATCH has quotes around it)\r
39         $eTag = '"'.md5($feed).'"';\r
40         header('Etag: '.$eTag);\r
41         \r
42         // compare Etag to what we got\r
43         if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) { \r
44                 header("HTTP/1.0 304 Not Modified");\r
45                 header('Content-Length: 0');\r
46         } else {\r
47                 header("Content-Type: application/xml");\r
48                 // dump feed\r
49                 echo $feed;\r
50         }\r
51                 \r
52 } else {\r
53         // output empty RSS file...\r
54         // (because site is disabled)\r
55         \r
56         echo '<' . '?xml version="1.0" encoding="ISO-8859-1"?' . '>';\r
57         \r
58         ?>\r
59         <rss version="2.0">\r
60           <channel>\r
61             <title><?php echo htmlspecialchars($CONF['SiteName'])?></title>\r
62             <link><?php echo htmlspecialchars($CONF['IndexURL'])?></link>\r
63             <description></description>\r
64             <docs>http://backend.userland.com/rss</docs>\r
65           </channel>\r
66         </rss>  \r
67         <?php\r
68 }\r
69 \r
70 ?>\r