mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
RSS support implemented
Latest packages also on homepage DEPLOYMENT NOTES: - web/html/xml must be world writable
This commit is contained in:
parent
7044610e32
commit
a81f22da2d
5 changed files with 1601 additions and 0 deletions
|
@ -80,6 +80,19 @@ print " <td align='left' valign='top'>";
|
||||||
print "<p>".__("Welcome to the AUR! If you're a newcomer, you may want to read the %hGuidelines%h.", array('<a href="guidelines.html">', '</a>'))."</p>";
|
print "<p>".__("Welcome to the AUR! If you're a newcomer, you may want to read the %hGuidelines%h.", array('<a href="guidelines.html">', '</a>'))."</p>";
|
||||||
print "<p>".__("If you have feedback about the AUR, please leave it in %hFlyspray%h.", array('<a href="http://bugs.archlinux.org/index.php?tasks=all&project=2">', '</a>'))."</p>";
|
print "<p>".__("If you have feedback about the AUR, please leave it in %hFlyspray%h.", array('<a href="http://bugs.archlinux.org/index.php?tasks=all&project=2">', '</a>'))."</p>";
|
||||||
print "<p>".__("Though we can't vouch for their contents, we provide a %hlist of user repositories%h for your convenience.", array('<a href="http://wiki2.archlinux.org/index.php/Unofficial%20Repositories">', '</a>'))."</p>";
|
print "<p>".__("Though we can't vouch for their contents, we provide a %hlist of user repositories%h for your convenience.", array('<a href="http://wiki2.archlinux.org/index.php/Unofficial%20Repositories">', '</a>'))."</p>";
|
||||||
|
|
||||||
|
#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 "<span class='f3'>".__("Latest Packages:")."</span><span class='f5'><a href='http://".$_SERVER['HTTP_HOST']."/rss2.php'>(rss)</a></span><br />\n";
|
||||||
|
while ($row = mysql_fetch_assoc($result)) {
|
||||||
|
print " <span class='f4'><a href='/packages.php?do_Details=1&ID=".intval($row["ID"])."'>";
|
||||||
|
print $row["Name"]."</a></span><br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
#print __("This is where the intro text will go.");
|
#print __("This is where the intro text will go.");
|
||||||
#print __("For now, it's just a place holder.");
|
#print __("For now, it's just a place holder.");
|
||||||
#print __("It's more important to get the login functionality finished.");
|
#print __("It's more important to get the login functionality finished.");
|
||||||
|
|
44
web/html/rss2.php
Normal file
44
web/html/rss2.php
Normal file
|
@ -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
|
||||||
|
?>
|
|
@ -45,4 +45,6 @@ $_t["en"]["If you have feedback about the AUR, please leave it in %hFlyspray%h."
|
||||||
|
|
||||||
$_t["en"]["Incorrect password for username, %s."] = "Incorrect password for username, %s.";
|
$_t["en"]["Incorrect password for username, %s."] = "Incorrect password for username, %s.";
|
||||||
|
|
||||||
|
$_t["en"]["Latest Packages:"] = "Latest Packages:";
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -362,6 +362,7 @@ function html_header() {
|
||||||
print "<link rel='stylesheet' type='text/css' href='/css/fonts.css'/>\n";
|
print "<link rel='stylesheet' type='text/css' href='/css/fonts.css'/>\n";
|
||||||
print "<link rel='stylesheet' type='text/css' href='/css/containers.css'/>\n";
|
print "<link rel='stylesheet' type='text/css' href='/css/containers.css'/>\n";
|
||||||
print "<link rel='shortcut icon' href='/images/favicon.ico'/>\n";
|
print "<link rel='shortcut icon' href='/images/favicon.ico'/>\n";
|
||||||
|
print "<link rel='alternate' type='application/rss+xml' title='Newest Packages RSS' href='http://".$_SERVER['HTTP_HOST']."/rss2.php' />\n";
|
||||||
print "<meta http-equiv=\"Content-Type\"";
|
print "<meta http-equiv=\"Content-Type\"";
|
||||||
print " content=\"text/html; charset=UTF-8\" />\n";
|
print " content=\"text/html; charset=UTF-8\" />\n";
|
||||||
print "</head>\n";
|
print "</head>\n";
|
||||||
|
|
1541
web/lib/feedcreator.class.php
Normal file
1541
web/lib/feedcreator.class.php
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue