diff options
Diffstat (limited to 'modules/media_rss')
-rw-r--r-- | modules/media_rss/controllers/media_rss.php | 108 | ||||
-rw-r--r-- | modules/media_rss/helpers/media_rss.php | 30 | ||||
-rw-r--r-- | modules/media_rss/helpers/media_rss_installer.php | 31 | ||||
-rw-r--r-- | modules/media_rss/helpers/media_rss_theme.php | 32 | ||||
-rw-r--r-- | modules/media_rss/module.info | 3 | ||||
-rw-r--r-- | modules/media_rss/views/feed.mrss.php | 55 |
6 files changed, 0 insertions, 259 deletions
diff --git a/modules/media_rss/controllers/media_rss.php b/modules/media_rss/controllers/media_rss.php deleted file mode 100644 index 1bc34557..00000000 --- a/modules/media_rss/controllers/media_rss.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access."); -/** - * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2008 Bharat Mediratta - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ -class Media_RSS_Controller extends Controller { - public static $page_size = 30; - - public function albums($id) { - $item = ORM::factory("item", $id); - if (!access::can("view", $item)) { - return Kohana::show_404(); - } - - $page = $this->input->get("page", 1); - if ($page < 1) { - url::redirect("media_rss/albums/{$item->id}"); - } - - $children = $item - ->viewable() - ->descendants(self::$page_size, ($page - 1) * self::$page_size, "photo"); - $max_pages = ceil($item->viewable()->descendants_count("photo") / self::$page_size); - - if ($page > $max_pages) { - url::redirect("media_rss/albums/{$item->id}?page=$max_pages"); - } - - $view = new View("feed.mrss"); - $view->title = $item->title; - $view->link = url::abs_site("albums/{$item->id}"); - $view->description = $item->description; - $view->feed_link = url::abs_site("media_rss/albums/{$item->id}"); - $view->children = $children; - - if ($page > 1) { - $previous_page = $page - 1; - $view->previous_page_link = url::site("media_rss/albums/{$item->id}?page={$previous_page}"); - } - - if ($page < $max_pages) { - $next_page = $page + 1; - $view->next_page_link = url::site("media_rss/albums/{$item->id}?page={$next_page}"); - } - - // @todo do we want to add an upload date to the items table? - $view->pub_date = date("D, d M Y H:i:s T"); - - rest::http_content_type(rest::RSS); - print $view; - } - - public function tags($id) { - $tag = ORM::factory("tag", $id); - if (!$tag->loaded) { - return Kohana::show_404(); - } - - $page = $this->input->get("page", 1); - if ($page < 1) { - url::redirect("media_rss/tags/{$tag->id}"); - } - - $children = $tag->items(self::$page_size, ($page - 1) * self::$page_size, "photo"); - $max_pages = ceil($tag->count / self::$page_size); - - if ($page > $max_pages) { - url::redirect("media_rss/tags/{$tag->id}?page=$max_pages"); - } - - $view = new View("feed.mrss"); - $view->title = $tag->name; - $view->link = url::abs_site("tags/{$tag->id}"); - $view->description = t("Photos related to %tag_name", array("tag_name" => $tag->name)); - $view->feed_link = url::abs_site("media_rss/tags/{$tag->id}"); - $view->children = $children; - - if ($page > 1) { - $previous_page = $page - 1; - $view->previous_page_link = url::site("media_rss/tags/{$tag->id}?page={$previous_page}"); - } - - if ($page < $max_pages) { - $next_page = $page + 1; - $view->next_page_link = url::site("media_rss/tags/{$tag->id}?page={$next_page}"); - } - - // @todo do we want to add an upload date to the items table? - $view->pub_date = date("D, d M Y H:i:s T"); - - rest::http_content_type(rest::RSS); - print $view; - } -}
\ No newline at end of file diff --git a/modules/media_rss/helpers/media_rss.php b/modules/media_rss/helpers/media_rss.php deleted file mode 100644 index 3f98277f..00000000 --- a/modules/media_rss/helpers/media_rss.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access."); -/** - * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2008 Bharat Mediratta - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ - -class media_rss_Core { - static function item_feed($item) { - $id = $item->is_album() ? $item->id : $item->parent_id; - return url::site("media_rss/albums/$id"); - } - - static function tag_feed($tag) { - return url::site("media_rss/tags/$tag->id}"); - } -}
\ No newline at end of file diff --git a/modules/media_rss/helpers/media_rss_installer.php b/modules/media_rss/helpers/media_rss_installer.php deleted file mode 100644 index 170f2dfb..00000000 --- a/modules/media_rss/helpers/media_rss_installer.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access."); -/** - * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2008 Bharat Mediratta - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ -class media_rss_installer { - static function install() { - $version = module::get_version("media_rss"); - if ($version == 0) { - module::set_version("media_rss", 1); - } - } - - static function uninstall() { - module::delete("media_rss"); - } -} diff --git a/modules/media_rss/helpers/media_rss_theme.php b/modules/media_rss/helpers/media_rss_theme.php deleted file mode 100644 index 84788e61..00000000 --- a/modules/media_rss/helpers/media_rss_theme.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access."); -/** - * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2008 Bharat Mediratta - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at - * your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. - */ -class media_rss_theme_Core { - static function head($theme) { - if ($theme->item()) { - $url = media_rss::item_feed($theme->item()); - } else if ($theme->tag()) { - $url = media_rss::tag_feed($theme->tag()); - } - - if (!empty($url)) { - return "<link rel=\"alternate\" type=\"" . rest::RSS . "\" href=\"$url\" />"; - } - } -} diff --git a/modules/media_rss/module.info b/modules/media_rss/module.info deleted file mode 100644 index 09b12c27..00000000 --- a/modules/media_rss/module.info +++ /dev/null @@ -1,3 +0,0 @@ -name = Media RSS -description = Provide a Media RSS feed for albums -version = 1 diff --git a/modules/media_rss/views/feed.mrss.php b/modules/media_rss/views/feed.mrss.php deleted file mode 100644 index d56b8ee0..00000000 --- a/modules/media_rss/views/feed.mrss.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php defined("SYSPATH") or die("No direct script access.") ?> -<? echo "<?xml version=\"1.0\" ?>" ?> -<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" - xmlns:atom="http://www.w3.org/2005/Atom" - xmlns:fh="http://purl.org/syndication/history/1.0"> - <channel> - <generator>gallery3</generator> - <title><?= htmlspecialchars($title) ?></title> - <link><?= $link ?></link> - <description><?= htmlspecialchars($description) ?></description> - <language>en-us</language> - <atom:link rel="self" href="<?= $feed_link ?>" type="application/rss+xml" /> - <fh:complete/> - <? if (!empty($previous_page_link)): ?> - <atom:link rel="previous" href="<?= $previous_page_link ?>" type="application/rss+xml" /> - <? endif ?> - <? if (!empty($next_page_link)): ?> - <atom:link rel="next" href="<?= $next_page_link ?>" type="application/rss+xml" /> - <? endif ?> - <pubDate><?= $pub_date ?></pubDate> - <lastBuildDate><?= $pub_date ?></lastBuildDate> - <? foreach ($children as $child): ?> - <item> - <title><?= htmlspecialchars($child->title) ?></title> - <link><?= url::abs_site("photos/$child->id") ?></link> - <guid isPermaLink="true"><?= url::abs_site("photos/$child->id") ?></guid> - <description><?= htmlspecialchars($child->description) ?></description> - <enclosure url="<?= $child->file_url(true) ?>" - type="<?= $child->mime_type ?>" - height="<?= $child->height ?>" - width="<?= $child->width ?>"/> - <media:thumbnail url="<?= $child->thumb_url(true) ?>" - fileSize="<?= filesize($child->thumb_path()) ?>" - height="<?= $child->thumb_height ?>" - width="<?= $child->thumb_width ?>" - /> - <media:group> - <media:content url="<?= $child->resize_url(true) ?>" - fileSize="<?= filesize($child->resize_path()) ?>" - type="<?= $child->mime_type ?>" - height="<?= $child->resize_height ?>" - width="<?= $child->resize_width ?>" - isDefault="true" - /> - <media:content url="<?= $child->file_url(true) ?>" - fileSize="<?= filesize($child->file_path()) ?>" - type="<?= $child->mime_type ?>" - height="<?= $child->height ?>" - width="<?= $child->width ?>" - /> - </media:group> - </item> - <? endforeach ?> - </channel> -</rss> |