summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2016-06-24 17:23:35 +0200
committerSimon Rettberg2016-06-24 17:23:35 +0200
commitd78c234a7244e93ac53fc7bcba8cdb152fa00130 (patch)
tree3c8c070f9c317f7c9afd9bc03b3c13f61b016620
parent[news] Fix install script (SQL syntax), add error messages/handling (diff)
downloadslx-admin-d78c234a7244e93ac53fc7bcba8cdb152fa00130.tar.gz
slx-admin-d78c234a7244e93ac53fc7bcba8cdb152fa00130.tar.xz
slx-admin-d78c234a7244e93ac53fc7bcba8cdb152fa00130.zip
[news] Move over global news API, add support for type param
-rw-r--r--modules-available/news/api.inc.php (renamed from apis/news.inc.php)5
1 files changed, 4 insertions, 1 deletions
diff --git a/apis/news.inc.php b/modules-available/news/api.inc.php
index 610db289..cbfaa82b 100644
--- a/apis/news.inc.php
+++ b/modules-available/news/api.inc.php
@@ -2,8 +2,11 @@
header('Content-Type: application/xml; charset=utf-8');
+$type = Request::any('type', 'news', 'string');
+
// Fetch news from DB
-$row = Database::queryFirst('SELECT title, content, dateline FROM news ORDER BY dateline DESC LIMIT 1');
+$row = Database::queryFirst('SELECT title, content, dateline FROM vmchooser_pages'
+ . ' WHERE type = :type ORDER BY dateline DESC LIMIT 1', compact('type'));
if ($row !== false ) {
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";