<?php

/************************************************************************/
/* RSS Feed for XCommunity and phpBB2 Forums	                        */
/* ===================================				                    */
/*                                                                      */
/* Copyright (c) 2004 by xybersystem intelligent inc. developer network */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/* See a copy of the GPL licensed attached in the archive.		*/
/************************************************************************/

include("mainfile.php");

header("Content-Type: text/xml");
$result = sql_query("SELECT t.topic_id, t.topic_title FROM ".$prefix."_bbtopics t, ".$prefix."_bbforums f where t.forum_id=f.forum_id and f.auth_view=0  ORDER BY t.topic_last_post_id DESC LIMIT 10", $dbi);

    if (!result) {
	echo "An error occured";
    } else {
        echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";
	echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";
	echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";
        echo "<rss version=\"0.91\">\n\n";
	echo "<channel>\n";
        echo "<title>$sitename- Forums</title>\n";
        echo "<link>$RSSFeedURL</link>\n";
        echo "<description>$backend_title</description>\n";
	echo "<language>$backend_language</language>\n\n";
        for ($m=0; $m < sql_num_rows($result, $dbi); $m++) {
	    list($topic_id, $topic_title) = sql_fetch_row($result, $dbi);
            echo "<item>\n";
            echo "<title>$topic_title</title>\n";
            echo "<link>$RSSFeedURL/postt$topic_id.html</link>\n";
            echo "</item>\n\n";
        }
	echo "</channel>\n";
        echo "</rss>";
    }

?>
