OSDN Git Service

BugTrack/332: nodateオプションが効かなくなっていた
[pukiwiki/pukiwiki.git] / plugin / rss.inc.php
1 <?php
2 /////////////////////////////////////////////////
3 // PukiWiki - Yet another WikiWikiWeb clone.
4 //
5 // $Id: rss.inc.php,v 1.3 2003/05/16 05:58:19 arino Exp $
6 //
7 // RecentChanges ¤Î RSS ¤ò½ÐÎÏ
8 function plugin_rss_action()
9 {
10         global $script,$rss_max,$page_title,$whatsnew;
11
12         $self = 'http://'.SERVER_NAME.PHP_SELF.'?';
13         
14         $page_title_utf8 = mb_convert_encoding($page_title,'UTF-8',SOURCE_ENCODING);
15         
16         $items = '';
17         
18         if (!file_exists(CACHE_DIR.'recent.dat'))
19         {
20                 return '';
21         }
22         $recent = file(CACHE_DIR.'recent.dat');
23         $lines = array_splice($recent,0,$rss_max);
24         foreach ($lines as $line)
25         {
26                 list($time,$page) = explode("\t",rtrim($line));
27                 $r_page = rawurlencode($page);
28                 $title = mb_convert_encoding($page,'UTF-8',SOURCE_ENCODING);
29                 $desc = get_date('D, d M Y H:i:s T',$time);
30                 $items .= <<<EOD
31 <item>
32  <title>$title</title>
33  <link>$self$r_page</link>
34  <description>$desc</description>
35 </item>
36
37 EOD;
38         }
39         
40         header('Content-type: application/xml');
41         
42         print <<<EOD
43 <?xml version="1.0" encoding="UTF-8"?>
44
45 <!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
46             "http://my.netscape.com/publish/formats/rss-0.91.dtd">
47
48 <rss version="0.91">
49
50 <channel>
51 <title>$page_title_utf8</title>
52 <link>$self$whatsnew</link>
53 <description>PukiWiki RecentChanges</description>
54 <language>ja</language>
55
56 $items
57 </channel>
58 </rss>
59 EOD;
60         exit;
61 }
62 ?>