Subversion Repositories taios

Rev

Rev 438 | Rev 440 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

header("Content-type: application/rss+xml");

$page = new Taios_Page('Photos RSS Feed', '../');

$dirName = $_GET['dir'];
if (empty($dirName))
{
    $dirName = "Lassitor";
}

write('<?xml version="1.0" encoding="UTF-8" ?>');
write('<rss version="2.0">');
write('<channel>');
write('<title>Tim32 Photo RSS ' . $dirName . '</title>');
write('<description>This is the RSS feed for the Tim32 Photos.</description>');
write('<link>http://tim32.org/photos/album.php?dir=' . $dirName . '</link>');
 
$directory = "albums/" . $dirName . "/";
$sortOrder = "newestFirst";

$results = array();
$handler = opendir($directory);
   
while ($file = readdir($handler))
{
    if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess" && getimagesize($directory . $file))
    {
           $currentModified = filectime($directory . $file);
           $file_names[] = $file;
           $file_dates[] = $currentModified;
    }    
}

closedir($handler);

if ($sortOrder == "newestFirst")
{
    arsort($file_dates);
}
else
{
    asort($file_dates);
}
   
$file_names_Array = array_keys($file_dates);
foreach ($file_names_Array as $idx => $name) $name=$file_names[$name];
$file_dates = array_merge($file_dates);

$indexInArray = 0;

foreach ($file_dates as $date)
{
    $j = $file_names_Array[$indexInArray];
    $file = $file_names[$j];
   
    $filename = $directory . $file;
   
    write('<item>');
    write('<title>' . $file . '</title>');
    write('<link>http://tim32.org/photos/' . $filename . '</link>');
    write('<guid>' . $indexInArray . '</guid>');
    write('<pubDate>' . date('D, d M Y H:i:s O', $date). '</pubDate>');
    write('<description>&lt;img src="' . $filename . '" /&gt;</description>');
    write('</item>');
   
    $indexInArray++;
}

write('</channel>');
write('</rss>');

?>