<?
//   XUL Webmail, a web based mailclient
//
//   Copyright (C) 2004 Wouter van Wijk (wvw@dds.nl),
//   based on XUL Channels, Copyright (C) 2003 Tim Broddin
//
//   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 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
//
// session check
session_start();
if (!isset($_SESSION['user']))
{
	header("Location: error.php?ec=2");
	exit;
}

header('Content-type: text/rdf; charset=iso-8859-15');
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
$mb = $_GET['mailbox'];
echo '<' . '?xml version="1.0" encoding="iso-8859-15" ?' . '>';
include('settings.php');
?>

<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:items="http://www.xulwebmail.com/rdf/messagelist#">
<?
	$messagelist = getMessages ($mb, 0, 20);

	// iterate through messages
	foreach ($messagelist as $value) {
		$idnew = htmlspecialchars($value['id']);
		$string1 .= '<RDF:Description about="urn:items:' . $idnew;
		$string1 .= '" items:subject="'. htmlspecialchars($value['subject']);
		$string1 .= '" items:fromaddress="' . htmlspecialchars($value['fromaddress']);
		$string1 .= '" items:date="' . htmlspecialchars($value['date']);
		$string1 .= '" items:id="' . $idnew . ' "/>' . "\n";
		$string2 .= '<RDF:li resource="urn:items:' . $idnew . '"/>' . "\n";
	}
	echo $string1;

	echo '<RDF:Seq about="urn:items:root">' . "\n";
	echo $string2;
	echo '</RDF:Seq>' . "\n";
?>
</RDF:RDF>
