<?php
header("Content-Type: application/xml; charset=ISO-8859-1");
echo '<?xml version="1.0" encoding="UTF-8"?>';
$year = date("Y", time());
$baseurl = "";
?>

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Daedalus' Photos RSS Feed</title>
    <link>http://daedalus.id.au/</link>
	<copyright>Joel Wigley 2006 - <?=$year; ?></copyright>
    <description>The photos posted on daedalus.id.au by Joel Wigley</description>
    <generator>http://daedalus.id.au/photos.xml</generator>
    <atom:link href="http://daedalus.id.au/photos.xml" rel="self" type="application/rss+xml" />

<?
require('includes/mysql.php');
require('includes/paths.php');
$result = mysql_query("SELECT * FROM `photos` ORDER BY photo_id DESC LIMIT 20;");

while($row = mysql_fetch_array($result)) {
	$url = $baseurl . $row['medium_name'];
	$description = $row['description'];
	if($row['timestamp']=="") {
		$timestamp = "18000";
	} else {
		$timestamp = $row['timestamp'];
	}
	$description = "<![CDATA[<a href='http://daedalus.id.au/view/photo/".$row['photo_id']."'><img src='http://daedalus.id.au/images/".$row['medium_name']."'></a><br />".$description."]]>";
?>
      <item>
        <title> <?=$row['name'];?></title>
        <link>http://daedalus.id.au/view/photo/<?=$row['photo_id'];?></link>
	<description><?=$description; ?></description>
        <pubDate><?=strftime( "%a, %d %b %Y %T %Z" , $timestamp); ?></pubDate>
        <guid>http://daedalus.id.au/view/photo/<?=$row['photo_id']; ?></guid>
      </item>
<? 
}
?>

  </channel>
</rss>
