From e0e44fc8c3df2839e14c7914a6e665aea98435c9 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Wed, 26 Dec 2012 20:39:54 +0100 Subject: [PATCH] added Atom feed for news and meetings --- db/update.d/21_Atom.php | 4 ++++ includes/pages/user_atom.php | 39 ++++++++++++++++++++++++++++++++++++ public/index.php | 5 +++++ templates/layout.html | 1 + 4 files changed, 49 insertions(+) create mode 100644 db/update.d/21_Atom.php create mode 100644 includes/pages/user_atom.php diff --git a/db/update.d/21_Atom.php b/db/update.d/21_Atom.php new file mode 100644 index 00000000..f592e0e6 --- /dev/null +++ b/db/update.d/21_Atom.php @@ -0,0 +1,4 @@ + 0; +?> diff --git a/includes/pages/user_atom.php b/includes/pages/user_atom.php new file mode 100644 index 00000000..fd28510f --- /dev/null +++ b/includes/pages/user_atom.php @@ -0,0 +1,39 @@ + + + Engelsystem + ' . $_SERVER['HTTP_HOST'] . htmlspecialchars(preg_replace('#[&?]key=[a-f0-9]{32}#', '', $_SERVER['REQUEST_URI'])) . ' + ' . date('Y-m-d\TH:i:sP', $news[0]['Datum']) . "\n"; + foreach ($news as $news_entry) { + $html .= " + " . htmlspecialchars($news_entry['Betreff']) . " + + " . preg_replace('#^https?://#', '', page_link_to_absolute("news")) . "-${news_entry['ID']} + " . date('Y-m-d\TH:i:sP', $news_entry['Datum']) . " + " . htmlspecialchars($news_entry['Text']) . " + \n"; + } + $html .= ""; + header("Content-Length: " . strlen($html)); + echo $html; + die(); +} +?> diff --git a/public/index.php b/public/index.php index 1773b54b..bd7e552d 100644 --- a/public/index.php +++ b/public/index.php @@ -40,6 +40,10 @@ if ($p == "ical") { require_once ('includes/pages/user_ical.php'); user_ical(); } +elseif ($p == "atom") { + require_once ('includes/pages/user_atom.php'); + user_atom(); +} // Recht dafür vorhanden? elseif (in_array($p, $privileges)) { if ($p == "news") { @@ -185,6 +189,7 @@ if (isset ($user) && $p != "admin_user_angeltypes") echo template_render('../templates/layout.html', array ( 'theme' => isset ($user) ? $user['color'] : $default_theme, 'title' => $title, + 'atom_link' => ($p == 'news' || $p == 'user_meetings')? '' : '', 'menu' => make_menu(), 'content' => $content )); diff --git a/templates/layout.html b/templates/layout.html index 695b6c9c..f6d19c6f 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -14,6 +14,7 @@ + %atom_link%