OSDN Git Service

fixed corrupted image files
[nucleus-jp/nucleus-jp-ancient.git] / euc / xml-rss2.php
1 <?php
2
3 /*
4  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
5  * Copyright (C) 2002-2007 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 /**
15  * Nucleus RSS syndication channel skin
16  * @license http://nucleuscms.org/license.txt GNU General Public License
17  * @copyright Copyright (C) 2002-2007 The Nucleus Group
18  * @version $Id: xml-rss2.php,v 1.5 2007-03-22 09:23:50 kimitake Exp $
19  * $NucleusJP: xml-rss2.php,v 1.8 2007/02/04 06:28:44 kimitake Exp $
20  */
21
22 header('Pragma: no-cache');
23
24 $CONF = array();
25 $CONF['Self'] = 'xml-rss2.php';
26
27 include('./config.php');
28
29 if (!$CONF['DisableSite']) {
30
31         // get feed into $feed
32         ob_start();
33         selectSkin('feeds/rss20');
34         selector();
35         $feed = ob_get_contents();
36         ob_end_clean();
37
38         // create ETAG (hash of feed)
39         // (HTTP_IF_NONE_MATCH has quotes around it)
40         $eTag = '"' . md5($feed) . '"';
41         header('Etag: ' . $eTag);
42
43         // compare Etag to what we got
44         if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) {
45                 header('HTTP/1.0 304 Not Modified');
46                 header('Content-Length: 0');
47         } else {
48                 $feed = mb_convert_encoding($feed, "UTF-8", "EUC-JP");
49                 header("Content-Type: application/xml");
50                 // dump feed
51                 echo $feed;
52         }
53
54 } else {
55         // output empty RSS file...
56         // (because site is disabled)
57
58         echo '<' . '?xml version="1.0" encoding="' . _CHARSET . '"?' . '>';
59
60         ?>
61         <rss version="2.0">
62                 <channel>
63                         <title><?php echo htmlspecialchars($CONF['SiteName']); ?></title>
64                         <link><?php echo htmlspecialchars($CONF['IndexURL']); ?></link>
65                         <description></description>
66                         <docs>http://backend.userland.com/rss</docs>
67                 </channel>
68         </rss>
69         <?php
70 }
71
72 ?>