issue: feed subpage for atom xml formatting
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 8 Nov 2019 00:02:50 +0000 (01:02 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 20 Nov 2019 08:58:17 +0000 (09:58 +0100)
Feature of news articles lost during database transition.

Include adapted from nieuws/feed/index.php for different object structure
(to be merged again later if possible).

issue/feed.inc.php [new file with mode: 0644]
issue/index.php

diff --git a/issue/feed.inc.php b/issue/feed.inc.php
new file mode 100644 (file)
index 0000000..1c4202e
--- /dev/null
@@ -0,0 +1,29 @@
+<?php
+header('Content-Type: application/atom+xml; charset=utf-8');
+print '<?xml version="1.0" encoding="utf-8"?>';
+$siteref = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . '://' . $_SERVER['HTTP_HOST'];
+?>
+
+<feed xmlns="http://www.w3.org/2005/Atom">
+       <title>Lijtweg.nl</title>
+       <subtitle>Meldingen</subtitle>
+       <id><?= $siteref ?>/</id>
+       <link href="<?= $siteref ?>/" />
+       <link href="<?= $siteref . $_SERVER['REQUEST_URI'] ?>" rel="self" />
+       <author><name>Lijtweg</name></author>
+<?php
+while ($row = $query->fetch()) {
+?>
+       <entry>
+               <id><?= "$siteref/$Page/{$row->id}/{$row->link}" ?></id>
+               <link href="<?= "$siteref/$Page/{$row->id}/{$row->link}" ?>" />
+               <title><?= $row->subject ?></title>
+               <published><?= $row->created ?></published>
+               <updated><?= $row->updated ?></updated>
+       </entry>
+<?php
+}
+?>
+</feed>
+<?php
+exit;
index f950861f98c4181e459e9cb1cbe925b1637baf7c..fb6a84e8dfbe6aa04a1db12ca98e7115d3abd887 100644 (file)
@@ -3,7 +3,7 @@ global $User, $Db;
 require_once 'database.inc.php';
 @list ($id, $title) = explode('/', ltrim($Args, '/'));
 
-if ($id) {
+if ($id and ctype_digit($id)) {
        $Article->title = "Issue #$id";
 
        $Issue = $Db->query(
@@ -60,6 +60,10 @@ if (isset($_GET['open'])) {
 $sql .= ' ORDER BY closed IS NOT NULL, updated DESC';
 $query = $Db->query($sql, [$Page]);
 
+if ($id == 'feed') {
+       require 'issue/feed.inc.php';
+}
+
 ob_start();
 print '<ul>';
 while ($row = $query->fetch()) {