OSDN Git Service

本家Nucleus CMS 4.0のリビジョン1626をコミット
[nucleus-jp/nucleus-next.git] / atom.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2009 The Nucleus Group
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * (see nucleus/documentation/index.html#license for more info)
11  */
12
13 /**
14  * Nucleus Atom Syndication
15  * @license http://nucleuscms.org/license.txt GNU General Public License
16  * @copyright Copyright (C) 2002-2009 The Nucleus Group
17  * @version $Id: atom.php 1388 2009-07-18 06:31:28Z shizuki $
18  */
19
20 header('Pragma: no-cache');
21
22 $CONF = array();
23 $CONF['Self'] = 'atom.php';
24
25 include('./config.php');
26
27 if (!$CONF['DisableSite']) {
28         // get feed into $feed
29         ob_start();
30                 selectSkin('feeds/atom');
31                 selector();
32                 $feed = ob_get_contents();
33         ob_end_clean();
34
35         // create ETAG (hash of feed)
36         // (HTTP_IF_NONE_MATCH has quotes around it)
37         $eTag = '"' . md5($feed) . '"';
38         header('Etag: ' . $eTag);
39
40         // compare Etag to what we got
41         if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) {
42                 header('HTTP/1.0 304 Not Modified');
43                 header('Content-Length: 0');
44         } else {
45                 // dump feed
46                 echo $feed;
47         }
48
49 }
50
51 ?>