OSDN Git Service

f4e9c35bf00c1125e336611aabd39142cd95a84d
[nucleus-jp/nucleus-jp-ancient.git] / euc / atom.php
1 <?php
2
3 /**
4   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/) 
5   * Copyright (C) 2002-2005 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   * Nucleus Atom Syndication
14   */
15
16 header("Pragma: no-cache");
17
18 $CONF = array();
19 $CONF['Self'] = 'atom.php';
20
21 include('./config.php');
22
23 if (!$CONF['DisableSite']) {
24         // get feed into $feed
25         ob_start();
26                 selectSkin('feeds/atom');
27                 selector();
28         $feed = ob_get_contents();
29         ob_end_clean();
30         
31         // create ETAG (hash of feed)
32         // (HTTP_IF_NONE_MATCH has quotes around it)
33         $eTag = '"'.md5($feed).'"';
34         header('Etag: '.$eTag);
35         
36         // compare Etag to what we got
37         if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) { 
38                 header("HTTP/1.0 304 Not Modified");
39                 header('Content-Length: 0');
40         } else {
41                 $feed = mb_convert_encoding($feed, "UTF-8", "EUC-JP");
42                 header("Content-Type: application/xml");
43                 // dump feed
44                 echo $feed;
45         }
46                 
47 }
48
49 ?>