Browse code

#23 rss output fix

Jimako authored on 2023/09/08 04:26:46
Showing 1 changed files
... ...
@@ -20,9 +20,13 @@
20 20
 // To read the license please visit http://www.gnu.org/copyleft/gpl.html
21 21
 // ----------------------------------------------------------------------
22 22
 
23
+ini_set('display_errors', 0);
24
+ini_set('display_startup_errors', 0);
25
+error_reporting(-1);
26
+
23 27
 define("_BASEDIR", "");
24
-  include_once("includes/dbfunctions.php");    
25
-  include_once("config.php"); 
28
+  require_once("includes/dbfunctions.php");
29
+  require_once("config.php"); 
26 30
 $settingsresults = dbquery("SELECT sitename, url, siteemail, slogan, language, tableprefix, dateformat FROM ".$settingsprefix."fanfiction_settings WHERE sitekey = '$sitekey'");
27 31
 $settings = dbassoc($settingsresults);
28 32
 foreach($settings as $var => $val) {
... ...
@@ -30,6 +34,8 @@ foreach($settings as $var => $val) {
30 34
 }
31 35
 define("TABLEPREFIX", $tableprefix);
32 36
 define("SITEKEY", $sitekey);
37
+define("_CHARSET", "utf-8");
38
+
33 39
   include_once("includes/queries.php");
34 40
   if(file_exists("languages/{$language}.php")) include("languages/{$language}.php");
35 41
   else include("languages/en.php");
... ...
@@ -57,31 +63,31 @@ while($rate = dbassoc($ratlist)) {
57 63
   $rss.="<webMaster>$siteemail</webMaster>\n"; 
58 64
   $rss.="<language>$language</language>\n"; 
59 65
 
60
-$query = _STORYQUERY." ORDER BY updated DESC LIMIT 20";
61
-$results = dbquery($query);
62
-while($story = dbassoc($results)) {
63
-    $story['authors'][] = $story['penname'];
64
-    if($story['coauthors']) {
65
-		$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']."'");
66
-		while($c = dbassoc($coauth)) {
67
-			$story['authors'][] = $c['penname'];
68
-		}
69
-    }
70
-    foreach($story['authors'] AS $k => $v) {
71
-	$story['authors'][$k] = strip_tags(xmlentities( $v));
72
-    }
73
-    $rss.= "<item>
74
-	<title>".strip_tags(xmlentities($story['title']))." "._BY." ".implode(", ", $story['authors'])." [".$ratings[$story['rid']]."]</title>
75
-	<link>$url/viewstory.php?sid=".$story['sid']."</link>
76
-	<description>".strip_tags(xmlentities($story['summary']))."</description>
77
-	<pubDate>".date("r",$story['updated'])."</pubDate>
78
-     </item>\n";  
79
-} 
66
+  $query = _STORYQUERY." ORDER BY updated DESC LIMIT 20";
67
+  $results = dbquery($query);
68
+  while($story = dbassoc($results)) {
69
+      $story['authors'][] = $story['penname'];
70
+      if($story['coauthors']) {
71
+      $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']."'");
72
+      while($c = dbassoc($coauth)) {
73
+        $story['authors'][] = $c['penname'];
74
+      }
75
+      }
76
+      foreach($story['authors'] AS $k => $v) {
77
+    $story['authors'][$k] = strip_tags(xmlentities( $v));
78
+      }
79
+      $rss.= "<item>
80
+    <title>".strip_tags(xmlentities($story['title']))." "._BY." ".implode(", ", $story['authors'])." [".$ratings[$story['rid']]."]</title>
81
+    <link>$url/viewstory.php?sid=".$story['sid']."</link>
82
+    <description>".strip_tags(xmlentities($story['summary']))."</description>
83
+    <pubDate>".date("r",$story['updated'])."</pubDate>
84
+      </item>\n";  
85
+  } 
80 86
 
81
-  $rss.="</channel>
82
-</rss>"; 
87
+    $rss.="</channel>
88
+  </rss>"; 
83 89
 
84
-  header('Content-type: application/xml', TRUE);
90
+  header('Content-type: application/xml');
85 91
   header("Cache-Control: must-revalidate"); 
86 92
   header("Expires: ".gmdate("D, d M Y H:i:s", time() + 3600) . " GMT"); 
87 93