login/pass: error messages below page title
[minimedit.git] / nieuws / feed / index.php
1 <?php
2 header('Content-Type: application/atom+xml; charset=utf-8');
3 header('Access-Control-Allow-Origin: *');
4 print '<?xml version="1.0" encoding="utf-8"?>';
5 $siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_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         <icon>/favicon.png</icon>
15         <author><name>Lijtweg</name></author>
16 <?php
17 $root = preg_replace('{/feed$}', '', $Page->handler) . "/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="<?= $siteref . '/' . $article->link ?>" />
31                 <title><?= $article->title ?></title>
32                 <published><?= $article->meta['article:published_time'] ?? $article->dateiso ?></published>
33                 <updated><?= $article->meta['article:modified_time'] ?? $article->dateiso ?></updated>
34 <?php
35         if ($article->teaser) {
36                 printf("\t\t<summary>%s</summary>\n", htmlspecialchars($article->teaser));
37         }
38         if ($article->thumb) {
39                 printf("\t\t".'<link rel="enclosure" type="%s" href="%s"%s />'."\n",
40                         'image/jpeg',
41                         "$siteref/{$article->thumb}",
42                         file_exists($article->thumb) ? sprintf(' length="%d"', filesize($article->thumb)) : ''
43                 );
44         }
45 ?>
46                 <content type="html"><?= htmlspecialchars($article->story) ?>
47                 </content>
48         </entry>
49 <?php
50 }
51 ?>
52 </feed>
53 <?php
54 exit;