>From a14ec9f9c5c2120ee1933f4fb89ac2ff67da66fa Mon Sep 17 00:00:00 2001
From: Loui Chang <louipc.ist@gmail.com>
Date: Tue, 1 Apr 2008 02:16:24 -0400
Subject: [PATCH] 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>
---
 web/html/rss2.php            |   17 ++++++++++++++---
 web/lang/en/acctfuncs_po.inc |    1 -
 2 files changed, 14 insertions(+), 4 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);
 }
diff --git a/web/lang/en/acctfuncs_po.inc b/web/lang/en/acctfuncs_po.inc
index c19bfdb..7550234 100644
--- a/web/lang/en/acctfuncs_po.inc
+++ b/web/lang/en/acctfuncs_po.inc
@@ -90,4 +90,3 @@ $_t["en"]["Developer"] = "Developer";
 $_t["en"]["View this user's packages"] = "View this user's packages";
 
 ?>
-
-- 
1.5.4.4

