OSDN Git Service

CHANGE: クエリが返り値を戻さない場合にオブジェクトのパラメーター呼び出しに失敗する警告に対応。
[nucleus-jp/nucleus-jp-ancient.git] / atom.php
1 <?php
2 /*
3  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
4  * Copyright (C) 2002-2012 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 header('Pragma: no-cache');
14
15 $CONF = array();
16 $CONF['Self'] = 'atom.php';
17
18 include('./config.php');
19
20 if (!$CONF['DisableSite']) {
21         // get feed into $feed
22         ob_start();
23                 selectSkin('feeds/atom');
24                 selector();
25                 $feed = ob_get_contents();
26         ob_end_clean();
27
28         // create ETAG (hash of feed)
29         // (HTTP_IF_NONE_MATCH has quotes around it)
30         $eTag = '"' . md5($feed) . '"';
31         header('Etag: ' . $eTag);
32
33         // compare Etag to what we got
34         if ($eTag == serverVar('HTTP_IF_NONE_MATCH') ) {
35                 header('HTTP/1.0 304 Not Modified');
36                 header('Content-Length: 0');
37         } else {
38                 if (strtolower(_CHARSET) != 'utf-8') {
39                     $feed = mb_convert_encoding($feed, "UTF-8", _CHARSET);
40                 }
41                 header("Content-Type: application/xml");
42                 // dump feed
43                 echo $feed;
44         }
45
46 }
47
48 ?>