summaryrefslogtreecommitdiffstats
path: root/web/html/rss2.php
diff options
context:
space:
mode:
Diffstat (limited to 'web/html/rss2.php')
-rw-r--r--web/html/rss2.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/web/html/rss2.php b/web/html/rss2.php
new file mode 100644
index 00000000..c716ac66
--- /dev/null
+++ b/web/html/rss2.php
@@ -0,0 +1,44 @@
+<?
+include("aur.inc");
+include("feedcreator.class.php");
+
+#If there's a cached version <1hr old, won't regenerate now
+$rss = new UniversalFeedCreator();
+$rss->useCached("RSS2.0","xml/newestpkg.xml",3600);
+
+#All the general RSS setup
+$rss->title = "AUR Newest Packages";
+$rss->description = "The latest and greatest packages in the AUR";
+$rss->link = 'http://'.$_SERVER['HTTP_HOST'];
+$rss->syndicationURL = 'http://'.$_SERVER['HTTP_HOST'].'/rss2.php';
+$image = new FeedImage();
+$image->title = "AUR";
+$image->url = "http://".$_SERVER['HTTP_HOST']."/images/AUR-logo-80.png";
+$image->link = "http://".$_SERVER['HTTP_HOST'];
+$image->description = "AUR Newest Packages Feed";
+$rss->image = $image;
+
+#Get the latest packages and add items for them
+$dbh = db_connect();
+$q = "SELECT * FROM Packages ";
+$q.= "WHERE DummyPkg != 1 ";
+$q.= "ORDER BY SubmittedTS DESC ";
+$q.= "LIMIT 0 , 20";
+$result = db_query($q, $dbh);
+while ($row = mysql_fetch_assoc($result)) {
+ $item = new FeedItem();
+ $item->title = $row["Name"];
+ $item->link = 'http://'.$_SERVER['HTTP_HOST'].'/packages.php?do_Details&ID='.$row["ID"];
+ $item->description = $row["Description"];
+ $item->date = intval($row["SubmittedTS"]);
+ $item->source = 'http://'.$_SERVER['HTTP_HOST'];
+ $item->author = username_from_id($row["MaintainerUID"]);
+ $rss->addItem($item);
+}
+
+#save it so that useCached() can find it
+$rss->saveFeed("RSS2.0","xml/newestpkg.xml",true);
+
+# $Id$
+# vim: ts=2 sw=2 noet ft=php
+?>