0a88cd4f3e06f2ea458d3aaa0d0ed826867f5a08
[minimedit.git] / nieuws / feed / index.php
1 <?php
2 ob_clean();
3 header('Content-Type: application/atom+xml; charset=utf-8');
4 print '<?xml version="1.0" encoding="utf-8"?>';
5 $siteref = 'http://'.$_SERVER['HTTP_HOST'];
6 ?>
7
8 <feed xmlns="http://www.w3.org/2005/Atom">
9         <title>Lijtweg.nl</title>
10         <subtitle>Nieuwsberichten</subtitle>
11         <id><?= $siteref ?></id>
12         <link href="<?= $siteref ?>" />
13         <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
14         <author><name>Lijtweg</name></author>
15 <?php
16 include 'nieuws.inc.php';
17 $root = preg_replace('{/feed$}', '', $Page) . "/2???";
18 $pages = array_reverse(glob("$root/*.html"));
19
20 foreach ($pages as $i => $page) {
21         $article = new ArchiveArticle($page);
22         if (!$i) {
23                 // feed metadata from top (most recent) article
24                 print "\t<updated>{$article->lastiso}</updated>\n";
25         }
26 ?>
27
28         <entry>
29                 <id><?= $siteref . '/' . $article->link ?></id>
30                 <link href="/<?= $article->link ?>" />
31                 <title><?= $article->title ?></title>
32                 <published><?= $article->dateiso ?></published>
33                 <updated><?= $article->dateiso ?></updated>
34                 <content type="html"><?= htmlspecialchars($article->body) ?></content>
35 <?php
36         if ($article->thumb) {
37                 printf("\t\t".'<link rel="enclosure" type="%s" length="%d" href="%s" />'."\n",
38                         'image/jpeg', filesize($article->thumb), "$siteref/{$article->thumb}"
39                 );
40         }
41 ?>
42         </entry>
43 <?php
44 }
45 ?>
46 </feed>
47 <?php
48 exit;