<?php
//
// this file is an exmple of how to include an rss feed which will list the last six newsitems
// with an extract of the text and a link to read more
// if you want to show more or less than six extracts change the 6 in line 12 to another number
//
ob_start("ob_gzhandler");
header('Content-Type: application/rss+xml');
include_once("configuration.php");
include_once("functions.php");
if ($rss_limit == "")
{
$rss_limit = 100;
}
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n";
echo "<!-- feedurl: http://$SERVER_NAME$PHP_SELF -->\n";
?>
<rss version="2.0"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title><?php echo "Unapproved Comments for " . $sitename; ?></title>
<link><?php echo $base_url; ?></link>
<description><?php echo $description; ?></description>
<dc:language>en-us</dc:language>
<dc:creator><?php echo $adminname; ?></dc:creator>
<dc:rights><?php echo $copy; ?></dc:rights>
<?php
$query = "SELECT id, comment, poster_name FROM $comment_table WHERE approved = '0' ORDER BY uniqueid DESC LIMIT 0,$rss_limit";
$result = mysql_query($query);
while($query_data = mysql_fetch_array($result))
{
$article = $query_data["id"];
$comment = convertBBCode($query_data["comment"]);
$poster_name = $query_data["poster_name"];
$comment = stripslashes($comment);
$query2 = "SELECT id, title FROM $table WHERE id = '$article'";
$result2 = mysql_query($query2);
while($query_data = mysql_fetch_array($result2))
{
$title = htmlentities($query_data["title"]);
}
echo "\t\t<item>\n";
echo "\t\t\t<title>$poster_name on $title</title>\n";
echo "\t\t\t<link>$news_base?action=comment&article=$article#comments</link>\n";
echo "\t\t\t<description><![CDATA[$comment]]></description>\n";
echo "\t\t</item>\n\n";
}
?>
</channel>
</rss>
<?php
ob_end_flush();
?>