Fix FS 10008 and update rss2.php

The newline was the actual problem. Freaking PHP.

rss2.php:
- check for protocol once total rather than twice per loop iteration
- lower cache time to 30 min

Signed-off-by: Loui Chang <louipc.ist@gmail.com>
Signed-off-by: Simo Leone <simo@archlinux.org>
This commit is contained in:
Loui Chang 2008-04-01 02:16:24 -04:00 committed by Simo Leone
parent 2539bf8774
commit f61a345d8d

View file

@ -3,11 +3,12 @@
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang'); set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang');
include("aur.inc"); include("aur.inc");
include("feedcreator.class.php"); include("feedcreator.class.php");
#If there's a cached version <1hr old, won't regenerate now #If there's a cached version <1hr old, won't regenerate now
$rss = new UniversalFeedCreator(); $rss = new UniversalFeedCreator();
$rss->useCached("RSS2.0","xml/newestpkg.xml",3600); $rss->useCached("RSS2.0", "xml/newestpkg.xml", 1800);
#All the general RSS setup #All the general RSS setup
$rss->title = "AUR Newest Packages"; $rss->title = "AUR Newest Packages";
@ -28,13 +29,23 @@ $q.= "WHERE DummyPkg != 1 ";
$q.= "ORDER BY SubmittedTS DESC "; $q.= "ORDER BY SubmittedTS DESC ";
$q.= "LIMIT 0 , 20"; $q.= "LIMIT 0 , 20";
$result = db_query($q, $dbh); $result = db_query($q, $dbh);
$protocol = 'http';
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
$protocol = 'https';
while ($row = mysql_fetch_assoc($result)) { while ($row = mysql_fetch_assoc($result)) {
$item = new FeedItem(); $item = new FeedItem();
$item->title = $row["Name"]; $item->title = $row["Name"];
$item->link = "http" . ($_SERVER["HTTPS"]=='on'?"s":"") . "://".$_SERVER['HTTP_HOST'].'/packages.php?do_Details&ID='.$row["ID"];
$item->link = $protocol . "://".$_SERVER['HTTP_HOST'] .
'/packages.php?ID='.$row["ID"];
$item->description = $row["Description"]; $item->description = $row["Description"];
$item->date = intval($row["SubmittedTS"]); $item->date = intval($row["SubmittedTS"]);
$item->source = "http" . ($_SERVER["HTTPS"]=='on'?"s":"") . "://".$_SERVER['HTTP_HOST']; $item->source = $protocol . "://".$_SERVER['HTTP_HOST'];
$item->author = username_from_id($row["MaintainerUID"]); $item->author = username_from_id($row["MaintainerUID"]);
$rss->addItem($item); $rss->addItem($item);
} }