OSDN Git Service

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