<?PHP
/*
* rdf.php RDF creator (rss).
* copyright (c)2005 Marco Islas <markuz@islascruz.org>
*/
/*
 *  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, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */
header ("Content-type: text/xml");
require_once("./include/config.php");
$sql 	= "select id from sites where autorized = 'true' order by rand()";
$rs 	= $GLOBALS["db"]->fetch_row($sql);
$title 	= $GLOBALS["functions"]->get_registry_value("/pagval/title");
$url 	= $GLOBALS["functions"]->get_registry_value("/pagval/url");
$desc	= $GLOBALS["functions"]->get_registry_value("/pagval/description");
$lang	= $GLOBALS["functions"]->get_registry_value("/pagval/lang");
$email  = $GLOBALS["functions"]->get_registry_value("/pagval/owner_email");
$copyright= $GLOBALS["functions"]->get_registry_value("/pagval/copyright");
if (substr(strrev($url),0,1)!="/")
	$url.="/";
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<rss version=\"2.0\">
<channel>
<title>".$title."</title>
<link>".$url."</link>
<description>".$desc."</description>
<managinEditor>".$email."</managinEditor>
<copyright>".$copyright."</copyright>
<generator>Cintilla 0.1</generator>
<language>".$lang."</language>";
foreach ($rs as $id) {
	$sql  = "select short_name,url from sites where id = '".$id."'";
	$data = $GLOBALS["db"]->fetch_array($sql);
	$site_url=$url."index.php?action=redirect&amp;id=".$id;
	print "
	<item>
	        <title>".$data["short_name"]."</title>
	        <link>".$site_url."</link>
	</item>";
	}
print "</channel>
</rss>";
?>
