diff options
author | Loui Chang <louipc.ist@gmail.com> | 2008-04-01 02:16:24 -0400 |
---|---|---|
committer | Simo Leone <simo@archlinux.org> | 2008-04-03 19:58:44 -0500 |
commit | f61a345d8d3faf74a3af8125939462523150eb1e (patch) | |
tree | 0197ba44b36e4ab67bfe0bf545258ed28bd850a0 /web | |
parent | 2539bf8774b068c6438e3142dfd3b2e90345a849 (diff) | |
download | aurweb-f61a345d8d3faf74a3af8125939462523150eb1e.tar.xz |
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>
Diffstat (limited to 'web')
-rw-r--r-- | web/html/rss2.php | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/web/html/rss2.php b/web/html/rss2.php index cb09423..9d198cc 100644 --- a/web/html/rss2.php +++ b/web/html/rss2.php @@ -3,11 +3,12 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib' . PATH_SEPARATOR . '../lang'); 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); +$rss->useCached("RSS2.0", "xml/newestpkg.xml", 1800); #All the general RSS setup $rss->title = "AUR Newest Packages"; @@ -28,13 +29,23 @@ $q.= "WHERE DummyPkg != 1 "; $q.= "ORDER BY SubmittedTS DESC "; $q.= "LIMIT 0 , 20"; $result = db_query($q, $dbh); + +$protocol = 'http'; + +if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') + $protocol = 'https'; + + while ($row = mysql_fetch_assoc($result)) { $item = new FeedItem(); $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->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"]); $rss->addItem($item); } |