]>
git.defcon.no Git - plsgen/blob - rss.php
3 $site_url = "http://photos.defcon.no";
4 $stream_title = "photos.defcon.no gallerystream";
5 $stream_description = "The latest entries in the photo galleries at defcon.no";
6 $contact_address = "jon.langseth@lilug.no";
15 //define the path as relative
18 //using the opendir function
19 $dir_handle = @opendir
($basepath) or die("Unable to open $basepath");
21 //running the while loop
22 while ($dir = readdir($dir_handle)) {
23 $target = $basepath . $dir;
26 if ((!is_file($target)) &&
27 (file_exists($target)) &&
32 if (is_file($target . "/.title"))
34 $ctime = filectime($target . "/.title");
35 $key = date("Y-m-d-His", $ctime);
37 $ctimes[$key] = $ctime;
39 $fd = fopen($target . "/.title", "r");
40 $buf = chop(fgets($fd, 4096));
44 if (is_file($target . "/.indeximage")) {
45 $fd = fopen($target . "/.indeximage", "r");
47 $buf .= chop(fgets($fd, 4096));
50 $idximage[$key] = $buf;
56 //closing the directory
57 closedir($dir_handle);
60 header("Content-type: application/xml;\n\n");
61 print ("<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'
62 xmlns:content='http://purl.org/rss/1.0/modules/content/'>\n");
63 print ("<!-- rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/' -->\n");
64 print (" <channel>\n");
65 print (" <title>" . $stream_title . "</title>\n");
66 print (" <link>" . $site_url . "</link>\n");
67 print (" <description>" . $stream_description . "</description>\n");
68 print (" <docs>http://blogs.law.harvard.edu/tech/rss</docs>\n");
69 print (" <managingEditor>" . $contact_address . "</managingEditor>\n");
70 print (" <webMaster>" . $contact_address . "</webMaster>\n");
74 </lastBuildDate> </lastBuildDate> */
76 foreach ( $album as $key => $value ) {
79 $i_title = html_entity_decode($title[$key]);
80 $url = $site_url . "/" . $value;
83 print (" <pubDate>" . date("D, j M Y H:i:s +0100", $ctimes[$key]) . "</pubDate>\n");
84 print (" <link>" . $url . "</link>\n");
85 print (" <guid>$key$value</guid>\n");
86 print (" <description>\n");
87 printf ("The photo gallery '%s' at <a href='%s'>%s</a> was updated/published at %s", $i_title,$url,$url,date("D, j M Y H:i:s +0100", $ctimes[$key]));
88 print (" </description>\n");
89 print ("<content:encoded><![CDATA[ ");
90 printf("<center><img src='%s/%s' /></center>", $url, $idximage[$key]);
91 printf ("The photo gallery '%s' at <a href='%s'>%s</a> was updated/published at %s", $i_title,$url,$url,date("D, j M Y H:i:s +0100", $ctimes[$key]));
92 print (" ]]></content:encoded>");
96 if ($maxcount < 1) break;
98 print (" </channel>\n");