OSDN Git Service

Merge branch 'skinnable-master'
[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 1693 2012-03-10 11:37:56Z sakamocchi $
18  */
19
20 header('Pragma: no-cache');
21
22 $CONF = array();
23 include('./config.php');
24
25 if ( !$CONF['DisableSite'] )
26 {
27         // get feed into $feed
28         ob_start();
29         selectSkin('feeds/atom');
30         selector();
31         $feed = ob_get_contents();
32         ob_end_clean();
33         
34         // create ETAG (hash of feed)
35         // (HTTP_IF_NONE_MATCH has quotes around it)
36         $eTag = '"' . md5($feed) . '"';
37         header('Etag: ' . $eTag);
38         
39         // compare Etag to what we got
40         if ( $eTag == serverVar('HTTP_IF_NONE_MATCH') )
41         {
42                 header('HTTP/1.0 304 Not Modified');
43                 header('Content-Length: 0');
44         }
45         else
46         {
47                 echo $feed;
48         }
49 }