Rev 444 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
438 | tom | 1 | <?php |
2 | |||
3 | require '../_taios.php'; |
||
4 | |||
5 | header("Content-type: application/rss+xml"); |
||
6 | |||
7 | $page = new Taios_Page('Photos RSS Feed', '../'); |
||
8 | |||
9 | $dirName = $_GET['dir']; |
||
10 | if (empty($dirName)) |
||
11 | { |
||
12 | $dirName = "Lassitor"; |
||
13 | } |
||
14 | |||
15 | write('<?xml version="1.0" encoding="UTF-8" ?>'); |
||
16 | write('<rss version="2.0">'); |
||
17 | write('<channel>'); |
||
444 | tom | 18 | write('<title>Tim32 Photo RSS - ' . $dirName . '</title>'); |
438 | tom | 19 | write('<description>This is the RSS feed for the Tim32 Photos.</description>'); |
20 | write('<link>http://tim32.org/photos/album.php?dir=' . $dirName . '</link>'); |
||
21 | |||
22 | $directory = "albums/" . $dirName . "/"; |
||
23 | $sortOrder = "newestFirst"; |
||
24 | |||
25 | $results = array(); |
||
26 | $handler = opendir($directory); |
||
27 | |||
28 | while ($file = readdir($handler)) |
||
29 | { |
||
30 | if ($file != '.' && $file != '..' && $file != "robots.txt" && $file != ".htaccess" && getimagesize($directory . $file)) |
||
31 | { |
||
32 | $currentModified = filectime($directory . $file); |
||
33 | $file_names[] = $file; |
||
34 | $file_dates[] = $currentModified; |
||
35 | } |
||
36 | } |
||
37 | |||
38 | closedir($handler); |
||
39 | |||
40 | if ($sortOrder == "newestFirst") |
||
41 | { |
||
42 | arsort($file_dates); |
||
43 | } |
||
44 | else |
||
45 | { |
||
46 | asort($file_dates); |
||
47 | } |
||
48 | |||
49 | $file_names_Array = array_keys($file_dates); |
||
50 | foreach ($file_names_Array as $idx => $name) $name=$file_names[$name]; |
||
51 | $file_dates = array_merge($file_dates); |
||
52 | |||
53 | $indexInArray = 0; |
||
54 | |||
55 | foreach ($file_dates as $date) |
||
56 | { |
||
57 | $j = $file_names_Array[$indexInArray]; |
||
58 | $file = $file_names[$j]; |
||
59 | |||
60 | $filename = $directory . $file; |
||
61 | |||
62 | write('<item>'); |
||
63 | write('<title>' . $file . '</title>'); |
||
441 | tom | 64 | write('<link>http://tim32.org/photos/' . str_replace(" ", "%20", $filename) . '</link>'); |
448 | tom | 65 | write('<guid>id_' . $file . '</guid>'); |
438 | tom | 66 | write('<pubDate>' . date('D, d M Y H:i:s O', $date). '</pubDate>'); |
443 | tom | 67 | write('<description><![CDATA[<img src="http://tim32.org/photos/' . str_replace(" ", "%20", $filename) . '" />]]></description>'); |
438 | tom | 68 | write('</item>'); |
69 | |||
70 | $indexInArray++; |
||
71 | } |
||
72 | |||
73 | write('</channel>'); |
||
74 | write('</rss>'); |
||
75 | |||
76 | ?> |