#23 rss output fix
--- a/rss.php
+++ b/rss.php
@@ -20,9 +20,13 @@
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
+ini_set('display_errors', 0);
+ini_set('display_startup_errors', 0);
+error_reporting(-1);
+
define("_BASEDIR", "");
- include_once("includes/dbfunctions.php");
- include_once("config.php");
+ require_once("includes/dbfunctions.php");
+ require_once("config.php");
$settingsresults = dbquery("SELECT sitename, url, siteemail, slogan, language, tableprefix, dateformat FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'");
$settings = dbassoc($settingsresults);
foreach($settings as $var => $val) {
@@ -30,6 +34,8 @@
}
define("TABLEPREFIX", $tableprefix);
define("SITEKEY", $sitekey);
+define("_CHARSET", "utf-8");
+
include_once("includes/queries.php");
if(file_exists("languages/{$language}.php")) include("languages/{$language}.php");
else include("languages/en.php");
@@ -57,31 +63,31 @@
$rss.="<webMaster>$siteemail</webMaster>\n";
$rss.="<language>$language</language>\n";
-$query = _STORYQUERY." ORDER BY updated DESC LIMIT 20";
-$results = dbquery($query);
-while($story = dbassoc($results)) {
- $story['authors'][] = $story['penname'];
- if($story['coauthors']) {
- $coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$story['sid']."'");
- while($c = dbassoc($coauth)) {
- $story['authors'][] = $c['penname'];
- }
- }
- foreach($story['authors'] AS $k => $v) {
- $story['authors'][$k] = strip_tags(xmlentities( $v));
- }
- $rss.= "<item>
- <title>".strip_tags(xmlentities($story['title']))." "._BY." ".implode(", ", $story['authors'])." [".$ratings[$story['rid']]."]</title>
- <link>$url/viewstory.php?sid=".$story['sid']."</link>
- <description>".strip_tags(xmlentities($story['summary']))."</description>
- <pubDate>".date("r",$story['updated'])."</pubDate>
- </item>\n";
-}
+ $query = _STORYQUERY." ORDER BY updated DESC LIMIT 20";
+ $results = dbquery($query);
+ while($story = dbassoc($results)) {
+ $story['authors'][] = $story['penname'];
+ if($story['coauthors']) {
+ $coauth = dbquery("SELECT "._PENNAMEFIELD." as penname, co.uid FROM ".TABLEPREFIX."fanfiction_coauthors AS co LEFT JOIN "._AUTHORTABLE." ON co.uid = "._UIDFIELD." WHERE co.sid = '".$story['sid']."'");
+ while($c = dbassoc($coauth)) {
+ $story['authors'][] = $c['penname'];
+ }
+ }
+ foreach($story['authors'] AS $k => $v) {
+ $story['authors'][$k] = strip_tags(xmlentities( $v));
+ }
+ $rss.= "<item>
+ <title>".strip_tags(xmlentities($story['title']))." "._BY." ".implode(", ", $story['authors'])." [".$ratings[$story['rid']]."]</title>
+ <link>$url/viewstory.php?sid=".$story['sid']."</link>
+ <description>".strip_tags(xmlentities($story['summary']))."</description>
+ <pubDate>".date("r",$story['updated'])."</pubDate>
+ </item>\n";
+ }
- $rss.="</channel>
-</rss>";
+ $rss.="</channel>
+ </rss>";
- header('Content-type: application/xml', TRUE);
+ header('Content-type: application/xml');
header("Cache-Control: must-revalidate");
header("Expires: ".gmdate("D, d M Y H:i:s", time() + 3600) . " GMT");