From a81f22da2dc0435b7417e635abcf5cb2ebe6e18f Mon Sep 17 00:00:00 2001 From: simo Date: Fri, 10 Jun 2005 23:07:24 +0000 Subject: RSS support implemented Latest packages also on homepage DEPLOYMENT NOTES: - web/html/xml must be world writable --- web/html/index.php | 13 +++++++++++++ web/html/rss2.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 web/html/rss2.php (limited to 'web/html') diff --git a/web/html/index.php b/web/html/index.php index 30f7344..b2f4590 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -80,6 +80,19 @@ print " "; print "

".__("Welcome to the AUR! If you're a newcomer, you may want to read the %hGuidelines%h.", array('', ''))."

"; print "

".__("If you have feedback about the AUR, please leave it in %hFlyspray%h.", array('', ''))."

"; print "

".__("Though we can't vouch for their contents, we provide a %hlist of user repositories%h for your convenience.", array('', ''))."

"; + +#Hey, how about listing the newest pacakges? :D +$q = "SELECT * FROM Packages "; +$q.= "WHERE DummyPkg != 1 "; +$q.= "ORDER BY SubmittedTS DESC "; +$q.= "LIMIT 0 , 10"; +$result = db_query($q,$dbh); +print "".__("Latest Packages:")."(rss)
\n"; +while ($row = mysql_fetch_assoc($result)) { + print " "; + print $row["Name"]."
\n"; +} + #print __("This is where the intro text will go."); #print __("For now, it's just a place holder."); #print __("It's more important to get the login functionality finished."); diff --git a/web/html/rss2.php b/web/html/rss2.php new file mode 100644 index 0000000..c716ac6 --- /dev/null +++ b/web/html/rss2.php @@ -0,0 +1,44 @@ +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 +?> -- cgit v1.2.3-70-g09d2