From 70a34bbff5f5d3a206782221b58d8374bfce099b Mon Sep 17 00:00:00 2001 From: shish Date: Tue, 1 May 2007 12:42:05 +0000 Subject: [PATCH] rss for images extension git-svn-id: file:///home/shish/svn/shimmie2/trunk@45 7f39781d-f577-437e-ae19-be835c7a54ca --- ext/rss_images.ext.php | 71 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 ext/rss_images.ext.php diff --git a/ext/rss_images.ext.php b/ext/rss_images.ext.php new file mode 100644 index 00000000..484dd3ce --- /dev/null +++ b/ext/rss_images.ext.php @@ -0,0 +1,71 @@ +page == "index")) { + global $page; + global $config; + $title = $config->get_string('title'); + + $page->add_header(""); + } + if(is_a($event, 'PageRequestEvent') && ($event->page == "rss")) { + if($event->get_arg(0) == 'images') { + global $database; + $this->do_rss($database->get_images(0, 12)); + } + } + } +// }}} +// output {{{ + private function do_rss($images) { + // TODO: this function + global $page; + global $config; + $page->set_mode("data"); + $page->set_type("application/xml"); + + $data = ""; + foreach($images as $image) { + $link = make_link("post/view/{$image->id}"); + $tags = $image->get_tag_list(); + $owner = $image->get_owner(); + $content = html_escape( + "

" . build_thumb_html($image) . "

" . + "

Uploaded by " . $owner->name . "

" + ); + + $data .= " + + {$image->id} - $tags + $link + $link + $content + + "; + } + + $title = $config->get_string('title'); + $base_href = $config->get_string('base_href'); + $version = $config->get_string('version'); + $xml = << + + + $title + The latest uploads to the image board + $base_href + $version + (c) 2007 Shish + $data + + +EOD; + $page->set_data($xml); + } +// }}} +} +add_event_listener(new RSS_Images()); +?>