OSDN Git Service

bookmarklet.phpの単純なコード修正
[nucleus-jp/nucleus-next.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-2012 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-2012 The Nucleus Group\r
18  * @version $Id: xml-rss2.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
19  */\r
20 \r
21 header('Pragma: no-cache');\r
22 \r
23 $CONF = array();\r
24 include('./config.php');\r
25 \r
26 if ( !$CONF['DisableSite'] )\r
27 {\r
28         // get feed into $feed\r
29         ob_start();\r
30         selectSkin('feeds/rss20');\r
31         selector();\r
32         $feed = ob_get_contents();\r
33         ob_end_clean();\r
34         \r
35         /*\r
36          * create ETAG (hash of feed)\r
37          * (HTTP_IF_NONE_MATCH has quotes around it)\r
38          */\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         {\r
45                 header('HTTP/1.0 304 Not Modified');\r
46                 header('Content-Length: 0');\r
47         }\r
48         else\r
49         {\r
50                 echo $feed;\r
51         }\r
52 }\r
53 // site is disabled, output empty RSS file\r
54 else\r
55 {\r
56         echo '<?xml version="1.0" encoding="' . i18n::get_current_charset() . '"?>' . "\n";\r
57         echo "<rss version=\"2.0\">\n";\r
58         echo "<channel>\n";\r
59         echo '<title>' . Entity::hsc($CONF['SiteName']) . "</title>\n";\r
60         echo "<link>" . Entity::hsc($CONF['IndexURL']) . "</link>\n";\r
61         echo "<description></description>\n";\r
62         echo "<docs>http://backend.userland.com/rss</docs>\n";\r
63         echo "</channel>\n";\r
64         echo "</rss>\n";\r
65 }\r