nieuws/feed: header to allow js access from any domain
[minimedit.git] / nieuws / feed / index.php
index 9dc05ec64733e69f537f548c8f997f7df191be87..f2c62afdb05d3466c5c1fa93777ecb883ca81d81 100644 (file)
@@ -1,6 +1,6 @@
 <?php
-ob_clean();
 header('Content-Type: application/atom+xml; charset=utf-8');
+header('Access-Control-Allow-Origin: *');
 print '<?xml version="1.0" encoding="utf-8"?>';
 $siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
 ?>
@@ -13,7 +13,6 @@ $siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTT
        <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
        <author><name>Lijtweg</name></author>
 <?php
-include 'nieuws.inc.php';
 $root = preg_replace('{/feed$}', '', $Page) . "/2???";
 $pages = array_reverse(glob("$root/*.html"));
 
@@ -27,13 +26,14 @@ foreach ($pages as $i => $page) {
 
        <entry>
                <id><?= $siteref . '/' . $article->link ?></id>
-               <link href="/<?= $article->link ?>" />
+               <link href="<?= $siteref . '/' . $article->link ?>" />
                <title><?= $article->title ?></title>
                <published><?= $article->dateiso ?></published>
                <updated><?= $article->dateiso ?></updated>
-               <content type="html"><?= htmlspecialchars($article->body) ?>
-               </content>
 <?php
+       if ($article->teaser) {
+               printf("\t\t<summary>%s</summary>\n", htmlspecialchars($article->teaser));
+       }
        if ($article->thumb) {
                printf("\t\t".'<link rel="enclosure" type="%s" href="%s"%s />'."\n",
                        'image/jpeg',
@@ -42,6 +42,8 @@ foreach ($pages as $i => $page) {
                );
        }
 ?>
+               <content type="html"><?= htmlspecialchars($article->story) ?>
+               </content>
        </entry>
 <?php
 }