diff options
-rw-r--r-- | .gitmodules | 3 | ||||
-rw-r--r-- | .htaccess | 49 | ||||
-rw-r--r-- | modules/album_block/helpers/album_block_block.php | 61 | ||||
-rw-r--r-- | modules/album_block/module.info | 3 | ||||
-rw-r--r-- | modules/album_block/views/album_block_block.html.php | 8 | ||||
-rw-r--r-- | modules/displaytags/helpers/displaytags_block.php | 54 | ||||
-rw-r--r-- | modules/displaytags/module.info | 3 | ||||
-rw-r--r-- | modules/displaytags/views/displaytags_block.html.php | 8 | ||||
-rw-r--r-- | modules/latestupdates/controllers/latestupdates.php | 112 | ||||
-rw-r--r-- | modules/latestupdates/helpers/latestupdates_block.php | 49 | ||||
-rw-r--r-- | modules/latestupdates/module.info | 3 | ||||
-rw-r--r-- | modules/latestupdates/views/latestupdates_block.html.php | 10 | ||||
m--------- | modules/randimg | 0 | ||||
-rw-r--r-- | modules/tag/helpers/tag_block.php | 8 | ||||
-rw-r--r-- | modules/tag/models/tag.php | 5 | ||||
-rw-r--r-- | themes/wind/views/album.html.php | 2 | ||||
-rw-r--r-- | themes/wind/views/dynamic.html.php | 2 | ||||
-rw-r--r-- | themes/wind/views/photo.html.php | 2 |
18 files changed, 348 insertions, 34 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..283027db --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "modules/randimg"] + path = modules/randimg + url = gitosis@code.nkinka.de:randimg.git @@ -24,14 +24,14 @@ # in your Apache2 config file before you uncomment this block or # you'll get an "Internal Server Error". # -# <FilesMatch "(\.(class|fla|inc|sql|txt|gitignore)|(README|LICENSE))$"> -# Order deny,allow -# Deny from all -# </FilesMatch> -# <FilesMatch "robots.txt"> -# Order allow,deny -# Allow from all -# </FilesMatch> +<FilesMatch "(\.(class|fla|inc|sql|txt|gitignore)|(README|LICENSE))$"> + Order deny,allow + Deny from all +</FilesMatch> +<FilesMatch "robots.txt"> + Order allow,deny + Allow from all +</FilesMatch> # Improve performance by uncommenting this block. It tells the @@ -39,13 +39,13 @@ # asking for them. If you get an error after uncommenting this, make # sure you specify "AuthConfig Indexes" in your Apache config file. # -# <IfModule mod_expires.c> -# ExpiresActive On -# # Cache all files for a month after access (A). -# ExpiresDefault A2678400 -# # Do not cache dynamically generated pages. -# ExpiresByType text/html A1 -# </IfModule> +<IfModule mod_expires.c> + ExpiresActive On + # Cache all files for a month after access (A). + ExpiresDefault A2678400 + # Do not cache dynamically generated pages. + ExpiresByType text/html A1 +</IfModule> # You can use the mod_rewrite Apache module to get rid of the # "index.php" from your Gallery 3 urls. Uncomment the block below @@ -65,13 +65,12 @@ # want these changes to be persistent, talk to your system admin about # putting this block into your Apache config files. # -# <IfModule mod_rewrite.c> -# Options +FollowSymLinks -# RewriteEngine On -# RewriteBase / -# RewriteCond %{REQUEST_FILENAME} !-f -# RewriteCond %{REQUEST_FILENAME} !-d -# RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L] -# RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L] -# RewriteRule ^index.php/(.*) $1 [QSA,R,L] -# </IfModule> +<IfModule mod_rewrite.c> + RewriteEngine On + RewriteBase /photos + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L] + RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L] + RewriteRule ^index.php/(.*) $1 [QSA,R,L] +</IfModule> diff --git a/modules/album_block/helpers/album_block_block.php b/modules/album_block/helpers/album_block_block.php new file mode 100644 index 00000000..d469a0c7 --- /dev/null +++ b/modules/album_block/helpers/album_block_block.php @@ -0,0 +1,61 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2009 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 album_block_block_Core { + static function get_site_list() { + return array("album_list" => t("Album list")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "album_list": + $block = new Block(); + $block->css_id = "g-album-block"; + $block->title = t("Album list"); + $block->content = new View("album_block_block.html"); + + //$items = ORM::factory("item") + // ->viewable() + // ->where("type ==", "album") + // ->find_all(5); + + $items = ORM::factory("item")->where(array("type" => "album", "id !=" => 1))->orderby("updated", "DESC")->find_all(); + //if ($items->count() == 0) { + // Try once more. If this fails, just ditch the block altogether + //$items = ORM::factory("item") + //->viewable() + // ->where("type !=", "album") + // ->where("rand_key >= ", $random) + // ->orderby(array("rand_key" => "DESC")) + // ->find_all(1); + //} + + if ($items->count() > 0) { + #$block->content->item = $items->current(); + $block->content->items = $items; + } else { + $block = ""; + } + break; + } + + return $block; + } +} diff --git a/modules/album_block/module.info b/modules/album_block/module.info new file mode 100644 index 00000000..0a93532d --- /dev/null +++ b/modules/album_block/module.info @@ -0,0 +1,3 @@ +name = "Album Block" +description = "Display a list of albums in the sidebar" +version = 1 diff --git a/modules/album_block/views/album_block_block.html.php b/modules/album_block/views/album_block_block.html.php new file mode 100644 index 00000000..81660263 --- /dev/null +++ b/modules/album_block/views/album_block_block.html.php @@ -0,0 +1,8 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<?php foreach ( $items as $item ) : ?> +<div> +<a href="/photos/index.php/<?php echo $item->slug ?>"> +<img alt="<?php echo $item->title ?>" src="/photos/var/thumbs/<?php echo $item->slug ?>/.album.jpg?m=<?php echo $item->updated ?>" class="g-thumbnail"/> +</a> +</div> +<?php endforeach ?> diff --git a/modules/displaytags/helpers/displaytags_block.php b/modules/displaytags/helpers/displaytags_block.php new file mode 100644 index 00000000..fd739e5f --- /dev/null +++ b/modules/displaytags/helpers/displaytags_block.php @@ -0,0 +1,54 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2010 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 displaytags_block_Core { + static function get_site_list() { + return array("display_tags" => t("Display Tags")); + } + + static function get($block_id, $theme) { + $block = ""; + + // Make sure the current page belongs to an item. + if (!$theme->item()) { + return; + } + + switch ($block_id) { + case "display_tags": + // Create an array of all the tags for the current item. + $tagsItem = ORM::factory("tag") + ->join("items_tags", "tags.id", "items_tags.tag_id") + ->where("items_tags.item_id", "=", $theme->item->id) + ->find_all(); + + // If the current item has at least one tag, display it/them. + if (count($tagsItem) > 0) { + $block = new Block(); + $block->css_id = "g-display-tags"; + $block->title = t("Image tags"); + $block->content = new View("displaytags_block.html"); + $block->content->tags = $tagsItem; + } + + break; + } + return $block; + } +} diff --git a/modules/displaytags/module.info b/modules/displaytags/module.info new file mode 100644 index 00000000..d8458f10 --- /dev/null +++ b/modules/displaytags/module.info @@ -0,0 +1,3 @@ +name = "DisplayTags" +description = "Display all tags for the current photo/album." +version = 1 diff --git a/modules/displaytags/views/displaytags_block.html.php b/modules/displaytags/views/displaytags_block.html.php new file mode 100644 index 00000000..a0b392f3 --- /dev/null +++ b/modules/displaytags/views/displaytags_block.html.php @@ -0,0 +1,8 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<div class="g-display-tags-block"> + <? $not_first = 0; ?> + <? foreach ($tags as $tag): ?> + <?= ($not_first++) ? "," : "" ?> + <a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a> + <? endforeach ?> +</div> diff --git a/modules/latestupdates/controllers/latestupdates.php b/modules/latestupdates/controllers/latestupdates.php new file mode 100644 index 00000000..39f0df60 --- /dev/null +++ b/modules/latestupdates/controllers/latestupdates.php @@ -0,0 +1,112 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2009 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 latestupdates_Controller extends Controller { + + public function albums($id) { + // Figure out how many items to display on each page. + $itemsPerPage = module::get_var("gallery", "page_size", 9); + + // Figure out which page # the visitor is on and + // don't allow the visitor to go below page 1. + $page = Input::instance()->get("page", 1); + if ($page < 1) { + $page = 1; + } + + // First item to display. + $offset = ($page - 1) * $itemsPerPage; + + // Determine the total number of items, + // for page numbering purposes. + $count = ORM::factory("item", $id) + ->viewable() + ->where("type", "!=", "album") + ->order_by("created", "DESC") + ->count_all(); + + // Figure out what the highest page number is. + $max_pages = ceil($count / $itemsPerPage); + + // Figure out which items to display on this page. + $children = ORM::factory("item", $id) + ->viewable() + ->where("type", "!=", "album") + ->order_by("created", "DESC") + ->find_all($itemsPerPage, $offset); + + // Set up and display the actual page. + $template = new Theme_View("page.html", "collection", "LatestUpdates"); + $template->page_title = t("Gallery :: Latest Updates"); + $template->set_global("page", $page); + $template->set_global("max_page", $max_page); + $template->set_global("page_size", $itemsPerPage); + $template->set_global("children", $children); + $template->set_global("children_count", $count); + $template->content = new View("dynamic.html"); + $template->content->title = t("Latest Updates"); + print $template; + } + + public function updates() { + // Figure out how many items to display on each page. + $itemsPerPage = module::get_var("gallery", "page_size", 9); + + // Figure out which page # the visitor is on and + // don't allow the visitor to go below page 1. + $page = Input::instance()->get("page", 1); + + if ($page < 1) { + $page = 1; + } + + // First item to display. + $offset = ($page - 1) * $itemsPerPage; + + // Determine the total number of items, + // for page numbering purposes. + $count = ORM::factory("item") + ->viewable() + ->where("type", "!=", "album") + ->count_all(); + + // Figure out what the highest page number is. + $max_pages = ceil($count / $itemsPerPage); + + // Figure out which items to display on this page. + $items = ORM::factory("item") + ->viewable() + ->where("type", "!=", "album") + ->order_by("created", "DESC") + ->find_all($itemsPerPage, $offset); + + // Set up and display the actual page. + $template = new Theme_View("page.html", "collection", "LatestUpdates"); + $template->page_title = t("Gallery :: Latest Updates"); + $template->set_global("page", $page); + $template->set_global("max_pages", $max_pages); + $template->set_global("page_size", $itemsPerPage); + $template->set_global("children", $items); + $template->set_global("children_count", $count); + $template->content = new View ("dynamic.html"); + $template->content->title = t("Latest Updates"); + print $template; + } + +} diff --git a/modules/latestupdates/helpers/latestupdates_block.php b/modules/latestupdates/helpers/latestupdates_block.php new file mode 100644 index 00000000..095ba06b --- /dev/null +++ b/modules/latestupdates/helpers/latestupdates_block.php @@ -0,0 +1,49 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2009 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 latestupdates_block_Core { + static function get_site_list() { + return array("latestupdates" => t("Latest Updates")); + } + + static function get($block_id, $theme) { + $block = ""; + + if (!$theme->item()) { + return; + } + + switch ($block_id) { + case "latestupdates": + // Determine the ID# of the current album. + $albumID = $theme->item->is_album() ? $theme->item->id : $theme->item->parent_id; + + // Make a new sidebar block. + $block = new Block(); + $block->css_id = "g-latest-updates"; + $block->title = t("Latest Updates"); + $block->content = new View("latestupdates_block.html"); + $block->content->update_links = array( + "View newest photos" => url::site("latestupdates/updates"), + ); + break; + } + return $block; + } +} diff --git a/modules/latestupdates/module.info b/modules/latestupdates/module.info new file mode 100644 index 00000000..9f5d518d --- /dev/null +++ b/modules/latestupdates/module.info @@ -0,0 +1,3 @@ +name = "LatestUpdates" +description = "Display recently uploaded photos and videos." +version = 1 diff --git a/modules/latestupdates/views/latestupdates_block.html.php b/modules/latestupdates/views/latestupdates_block.html.php new file mode 100644 index 00000000..b1dd9074 --- /dev/null +++ b/modules/latestupdates/views/latestupdates_block.html.php @@ -0,0 +1,10 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<ul id="g-update-list"> +<? foreach($update_links as $title => $url): ?> + <li style="clear: both;"> + <a href="<?= $url ?>"> + <?= t($title) ?> + </a> + </li> +<? endforeach ?> +</ul> diff --git a/modules/randimg b/modules/randimg new file mode 160000 +Subproject 2cdc3b76dc51d4d7a7675117974ce3c6b004cb6 diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php index 0473e4b2..82726a72 100644 --- a/modules/tag/helpers/tag_block.php +++ b/modules/tag/helpers/tag_block.php @@ -19,7 +19,7 @@ */ class tag_block_Core { static function get_site_list() { - return array("tag" => t("Popular tags")); + return array("tag" => t("Tags")); } static function get($block_id, $theme) { @@ -28,9 +28,9 @@ class tag_block_Core { case "tag": $block = new Block(); $block->css_id = "g-tag"; - $block->title = t("Popular tags"); + $block->title = t("Tags"); $block->content = new View("tag_block.html"); - $block->content->cloud = tag::cloud(30); + $block->content->cloud = tag::cloud(250); if ($theme->item() && $theme->page_subtype() != "tag" && access::can("edit", $theme->item())) { $controller = new Tags_Controller(); @@ -42,4 +42,4 @@ class tag_block_Core { } return $block; } -}
\ No newline at end of file +} diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php index 269a0f39..b5bb857f 100644 --- a/modules/tag/models/tag.php +++ b/modules/tag/models/tag.php @@ -31,7 +31,8 @@ class Tag_Model extends ORM { $model = ORM::factory("item") ->viewable() ->join("items_tags", "items.id", "items_tags.item_id") - ->where("items_tags.tag_id", "=", $this->id); + ->where("items_tags.tag_id", "=", $this->id) + ->order_by("captured", "DESC"); if ($type) { $model->where("items.type", "=", $type); } @@ -130,4 +131,4 @@ class Tag_Model extends ORM { } return $url; } -}
\ No newline at end of file +} diff --git a/themes/wind/views/album.html.php b/themes/wind/views/album.html.php index 1a56af67..ff069a84 100644 --- a/themes/wind/views/album.html.php +++ b/themes/wind/views/album.html.php @@ -23,7 +23,7 @@ <?= $theme->thumb_bottom($child) ?> <?= $theme->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail") ?> <h2><span class="<?= $item_class ?>"></span> - <a href="<?= $child->url() ?>"><?= html::purify($child->title) ?></a></h2> + <a href="<?= $child->url() ?>"><!--<?= html::purify($child->title) ?>--></a></h2> <ul class="g-metadata"> <?= $theme->thumb_info($child) ?> </ul> diff --git a/themes/wind/views/dynamic.html.php b/themes/wind/views/dynamic.html.php index a8a4d362..67360da7 100644 --- a/themes/wind/views/dynamic.html.php +++ b/themes/wind/views/dynamic.html.php @@ -16,7 +16,7 @@ width="<?= $child->thumb_width ?>" height="<?= $child->thumb_height ?>" /> </a> - <h2><?= html::purify($child->title) ?></h2> + <!--<h2><?= html::purify($child->title) ?></h2>--> <?= $theme->thumb_bottom($child) ?> <ul class="g-metadata"> <?= $theme->thumb_info($child) ?> diff --git a/themes/wind/views/photo.html.php b/themes/wind/views/photo.html.php index b42ab987..92eb08f5 100644 --- a/themes/wind/views/photo.html.php +++ b/themes/wind/views/photo.html.php @@ -43,7 +43,7 @@ </div> <div id="g-info"> - <h1><?= html::purify($item->title) ?></h1> + <!-- <h1><?= html::purify($item->title) ?></h1> --> <div><?= nl2br(html::purify($item->description)) ?></div> </div> |