$val) { $$var = $val; } define("TABLEPREFIX", $tableprefix); define("SITEKEY", $sitekey); define("_RSSCHARSET", "utf-8"); include_once("includes/queries.php"); if(file_exists("languages/{$language}.php")) include("languages/{$language}.php"); else include("languages/en.php"); ob_start ("ob_gzhandler"); function xmlentities ( $string ) { return str_replace ( array ( '&', '"', "'", '<', '>' ), array ( '&' , '"', ''' , '<' , '>' ), $string ); } $ratlist = dbquery("SELECT * FROM ".TABLEPREFIX."fanfiction_ratings"); while($rate = dbassoc($ratlist)) { $ratings[$rate['rid']] = $rate['rating']; } $rss="\n"; $rss.="\n"; $rss.="\n"; $rss.="Copyright ".date("Y")."\n"; $rss.="".date("r")."\n"; $rss.="".xmlentities($slogan)."\n"; $rss.="$url\n"; $rss.="".xmlentities( $sitename)."\n"; $rss.="$siteemail\n"; $rss.="$siteemail\n"; $rss.="$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.= " ".strip_tags(xmlentities($story['title']))." "._BY." ".implode(", ", $story['authors'])." [".$ratings[$story['rid']]."] $url/viewstory.php?sid=".$story['sid']." ".strip_tags(xmlentities($story['summary']))." ".date("r",$story['updated'])." \n"; } $rss.=" "; header('Content-type: application/xml'); header("Cache-Control: must-revalidate"); header("Expires: ".gmdate("D, d M Y H:i:s", time() + 3600) . " GMT"); echo $rss; ?>