diff options
-rw-r--r-- | modules/gallery/controllers/albums.php | 1 | ||||
-rw-r--r-- | modules/gallery/controllers/movies.php | 4 | ||||
-rw-r--r-- | modules/gallery/helpers/album.php | 5 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery.php | 33 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_error.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_graphics.php | 54 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_installer.php | 17 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_task.php | 21 | ||||
-rw-r--r-- | modules/gallery/helpers/graphics.php | 95 | ||||
-rw-r--r-- | modules/gallery/helpers/movie.php | 30 | ||||
-rw-r--r-- | modules/gallery/helpers/photo.php | 5 | ||||
-rw-r--r-- | modules/gallery/libraries/Admin_View.php | 6 | ||||
-rw-r--r-- | modules/gallery/libraries/Theme_View.php | 4 | ||||
-rw-r--r-- | modules/gallery/module.info | 2 | ||||
-rw-r--r-- | modules/gallery/tests/Xss_Security_Test.php | 4 | ||||
-rw-r--r-- | modules/gallery/tests/xss_data.txt | 176 | ||||
-rw-r--r-- | modules/gallery/views/admin_maintenance_show_log.html.php | 4 | ||||
-rw-r--r-- | modules/gallery/views/permissions_form.html.php | 33 | ||||
-rw-r--r-- | modules/gallery/views/simple_uploader.html.php | 2 | ||||
-rw-r--r-- | modules/watermark/helpers/watermark_graphics.php | 75 | ||||
-rw-r--r-- | themes/admin_wind/css/fix-ie.css (renamed from themes/admin_default/css/fix-ie.css) | 0 | ||||
-rw-r--r-- | themes/admin_wind/css/screen.css (renamed from themes/admin_default/css/screen.css) | 0 | ||||
-rw-r--r-- | themes/admin_wind/images/avatar.jpg (renamed from themes/admin_default/images/avatar.jpg) | bin | 914 -> 914 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-album.png (renamed from themes/admin_default/images/ico-album.png) | bin | 397 -> 397 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-error.png (renamed from themes/admin_default/images/ico-error.png) | bin | 701 -> 701 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-info.png (renamed from themes/admin_default/images/ico-info.png) | bin | 778 -> 778 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-print.png (renamed from themes/admin_default/images/ico-print.png) | bin | 989 -> 989 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-separator.gif (renamed from themes/admin_default/images/ico-separator.gif) | bin | 106 -> 106 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-success.png (renamed from themes/admin_default/images/ico-success.png) | bin | 537 -> 537 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-view-comments.png (renamed from themes/admin_default/images/ico-view-comments.png) | bin | 768 -> 768 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-view-fullsize.png (renamed from themes/admin_default/images/ico-view-fullsize.png) | bin | 1046 -> 1046 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-view-hybrid.png (renamed from themes/admin_default/images/ico-view-hybrid.png) | bin | 494 -> 494 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-view-slideshow.png (renamed from themes/admin_default/images/ico-view-slideshow.png) | bin | 960 -> 960 bytes | |||
-rw-r--r-- | themes/admin_wind/images/ico-warning.png (renamed from themes/admin_default/images/ico-warning.png) | bin | 666 -> 666 bytes | |||
-rw-r--r-- | themes/admin_wind/js/ui.init.js (renamed from themes/admin_default/js/ui.init.js) | 2 | ||||
-rw-r--r-- | themes/admin_wind/theme.info (renamed from themes/admin_default/theme.info) | 2 | ||||
-rw-r--r-- | themes/admin_wind/thumbnail.png (renamed from themes/admin_default/thumbnail.png) | bin | 28330 -> 28330 bytes | |||
-rw-r--r-- | themes/admin_wind/views/admin.html.php (renamed from themes/admin_default/views/admin.html.php) | 0 | ||||
-rw-r--r-- | themes/admin_wind/views/block.html.php (renamed from themes/admin_default/views/block.html.php) | 0 | ||||
-rw-r--r-- | themes/admin_wind/views/pager.html.php (renamed from themes/admin_default/views/pager.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/css/fix-ie.css (renamed from themes/default/css/fix-ie.css) | 0 | ||||
-rw-r--r-- | themes/wind/css/screen.css (renamed from themes/default/css/screen.css) | 0 | ||||
-rw-r--r-- | themes/wind/images/avatar.jpg (renamed from themes/default/images/avatar.jpg) | bin | 1172 -> 1172 bytes | |||
-rw-r--r-- | themes/wind/images/ico-album.png (renamed from themes/default/images/ico-album.png) | bin | 397 -> 397 bytes | |||
-rw-r--r-- | themes/wind/images/ico-denied-gray.png (renamed from themes/default/images/ico-denied-gray.png) | bin | 604 -> 604 bytes | |||
-rw-r--r-- | themes/wind/images/ico-denied-pale.png (renamed from themes/default/images/ico-denied-pale.png) | bin | 916 -> 916 bytes | |||
-rw-r--r-- | themes/wind/images/ico-denied.png (renamed from themes/default/images/ico-denied.png) | bin | 715 -> 715 bytes | |||
-rw-r--r-- | themes/wind/images/ico-error.png (renamed from themes/default/images/ico-error.png) | bin | 701 -> 701 bytes | |||
-rw-r--r-- | themes/wind/images/ico-help.png (renamed from themes/default/images/ico-help.png) | bin | 786 -> 786 bytes | |||
-rw-r--r-- | themes/wind/images/ico-info.png (renamed from themes/default/images/ico-info.png) | bin | 778 -> 778 bytes | |||
-rw-r--r-- | themes/wind/images/ico-lock.png (renamed from themes/default/images/ico-lock.png) | bin | 749 -> 749 bytes | |||
-rw-r--r-- | themes/wind/images/ico-print.png (renamed from themes/default/images/ico-print.png) | bin | 989 -> 989 bytes | |||
-rw-r--r-- | themes/wind/images/ico-separator.gif (renamed from themes/default/images/ico-separator.gif) | bin | 106 -> 106 bytes | |||
-rw-r--r-- | themes/wind/images/ico-success-gray.png (renamed from themes/default/images/ico-success-gray.png) | bin | 476 -> 476 bytes | |||
-rw-r--r-- | themes/wind/images/ico-success-pale.png (renamed from themes/default/images/ico-success-pale.png) | bin | 617 -> 617 bytes | |||
-rw-r--r-- | themes/wind/images/ico-success.png (renamed from themes/default/images/ico-success.png) | bin | 537 -> 537 bytes | |||
-rw-r--r-- | themes/wind/images/ico-view-comments.png (renamed from themes/default/images/ico-view-comments.png) | bin | 768 -> 768 bytes | |||
-rw-r--r-- | themes/wind/images/ico-view-fullsize.png (renamed from themes/default/images/ico-view-fullsize.png) | bin | 1046 -> 1046 bytes | |||
-rw-r--r-- | themes/wind/images/ico-view-hybrid.png (renamed from themes/default/images/ico-view-hybrid.png) | bin | 494 -> 494 bytes | |||
-rw-r--r-- | themes/wind/images/ico-view-slideshow.png (renamed from themes/default/images/ico-view-slideshow.png) | bin | 960 -> 960 bytes | |||
-rw-r--r-- | themes/wind/images/ico-warning.png (renamed from themes/default/images/ico-warning.png) | bin | 666 -> 666 bytes | |||
-rw-r--r-- | themes/wind/images/select-photos-backg.png (renamed from themes/default/images/select-photos-backg.png) | bin | 1154 -> 1154 bytes | |||
-rw-r--r-- | themes/wind/js/ui.init.js (renamed from themes/default/js/ui.init.js) | 0 | ||||
-rw-r--r-- | themes/wind/theme.info (renamed from themes/default/theme.info) | 2 | ||||
-rw-r--r-- | themes/wind/thumbnail.png (renamed from themes/default/thumbnail.png) | bin | 26946 -> 26946 bytes | |||
-rw-r--r-- | themes/wind/views/album.html.php (renamed from themes/default/views/album.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/views/block.html.php (renamed from themes/default/views/block.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/views/dynamic.html.php (renamed from themes/default/views/dynamic.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/views/movie.html.php (renamed from themes/default/views/movie.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/views/page.html.php (renamed from themes/default/views/page.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/views/pager.html.php (renamed from themes/default/views/pager.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/views/photo.html.php (renamed from themes/default/views/photo.html.php) | 0 | ||||
-rw-r--r-- | themes/wind/views/sidebar.html.php (renamed from themes/default/views/sidebar.html.php) | 0 |
73 files changed, 347 insertions, 232 deletions
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 694cc4ff..9733d1cd 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -28,7 +28,6 @@ class Albums_Controller extends Items_Controller { if ($album->id == 1) { $view = new Theme_View("page.html", "login"); $view->page_title = t("Log in to Gallery"); - //$view->content = user::get_login_form("login/auth_html"); $view->content = new View("login_ajax.html"); $view->content->form = user::get_login_form("login/auth_html"); print $view; diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index fa07668e..2a917c58 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -60,7 +60,7 @@ class Movies_Controller extends Items_Controller { access::required("view", $movie); access::required("edit", $movie); - $form = photo::get_edit_form($movie); + $form = movie::get_edit_form($movie); if ($valid = $form->validate()) { if ($form->edit_item->filename->value != $movie->name || $form->edit_item->slug->value != $movie->slug) { @@ -114,6 +114,6 @@ class Movies_Controller extends Items_Controller { public function _form_edit($movie) { access::required("view", $movie); access::required("edit", $movie); - print photo::get_edit_form($movie); + print movie::get_edit_form($movie); } } diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php index 9cd746d7..65868cf2 100644 --- a/modules/gallery/helpers/album.php +++ b/modules/gallery/helpers/album.php @@ -123,14 +123,15 @@ class album_Core { if ($parent->id != 1) { $group->input("dirname")->label(t("Directory Name"))->value($parent->name) ->rules("required") - ->error_messages("name_conflict", t("There is already a photo or album with this name")) + ->error_messages( + "name_conflict", t("There is already a movie, photo or album with this name")) ->callback("item::validate_no_slashes") ->error_messages("no_slashes", t("The directory name can't contain a \"/\"")) ->callback("item::validate_no_trailing_period") ->error_messages("no_trailing_period", t("The directory name can't end in \".\"")); $group->input("slug")->label(t("Internet Address"))->value($parent->slug) ->error_messages( - "slug_conflict", t("There is already a photo or album with this internet address")) + "slug_conflict", t("There is already a movie, photo or album with this internet address")) ->callback("item::validate_url_safe") ->error_messages( "not_url_safe", diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 80ae65bd..d4f733e4 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -79,6 +79,20 @@ class gallery_Core { return date(module::get_var("gallery", "time_format", "H:i:s"), $timestamp); } + /** + * Provide a wrapper function for Kohana::find_file, that first strips the extension and + * then calls the Kohana::find_file supply that extension + * @param string directory to search in + * @param string filename to look for (without extension) + * @param boolean file required + * @return the file relative to the DOCROOT + */ + static function find_file($directory, $file, $required=false) { + $file_name = substr($file, 0, -strlen($ext = strrchr($file, '.'))); + $file_name = Kohana::find_file($directory, $file_name, $required, substr($ext, 1)); + return substr($file_name, strlen(DOCROOT)); + } + static function site_menu($menu, $theme) { if ($theme->page_type != "login") { $menu->append(Menu::factory("link") @@ -114,19 +128,32 @@ class gallery_Core { } } + switch ($item->type) { + case "album": + $option_text = t("Album options"); + $edit_text = t("Edit album"); + break; + case "movie": + $option_text = t("Movie options"); + $edit_text = t("Edit movie"); + break; + default: + $option_text = t("Photo options"); + $edit_text = t("Edit photo"); + } + $menu->append($options_menu = Menu::factory("submenu") ->id("options_menu") - ->label(t("Photo options"))); + ->label($option_text)); if ($item && ($can_edit || $can_add)) { if ($can_edit) { $options_menu->append(Menu::factory("dialog") ->id("edit_item") - ->label($item->is_album() ? t("Edit album") : t("Edit photo")) + ->label($edit_text) ->url(url::site("form/edit/{$item->type}s/$item->id"))); } if ($item->is_album()) { - $options_menu->label(t("Album options")); if ($can_edit) { $options_menu->append(Menu::factory("dialog") ->id("edit_permissions") diff --git a/modules/gallery/helpers/gallery_error.php b/modules/gallery/helpers/gallery_error.php index 91e05407..39568c93 100644 --- a/modules/gallery/helpers/gallery_error.php +++ b/modules/gallery/helpers/gallery_error.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class gallery_error_Core { - function error_handler($severity, $message, $filename, $lineno) { + static function error_handler($severity, $message, $filename, $lineno) { if (error_reporting() == 0) { return; } diff --git a/modules/gallery/helpers/gallery_graphics.php b/modules/gallery/helpers/gallery_graphics.php new file mode 100644 index 00000000..f62fbf97 --- /dev/null +++ b/modules/gallery/helpers/gallery_graphics.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-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 gallery_graphics_Core { + /** + * Resize an image. Valid options are width, height and master. Master is one of the Image + * master dimension constants. + * + * @param string $input_file + * @param string $output_file + * @param array $options + */ + static function resize($input_file, $output_file, $options) { + graphics::init_toolkit(); + + module::event("graphics_resize", $input_file, $output_file, $options); + + if (@filesize($input_file) == 0) { + throw new Exception("@todo EMPTY_INPUT_FILE"); + } + + $dims = getimagesize($input_file); + if (max($dims[0], $dims[1]) < min($options["width"], $options["height"])) { + // Image would get upscaled; do nothing + copy($input_file, $output_file); + } else { + $image = Image::factory($input_file) + ->resize($options["width"], $options["height"], $options["master"]) + ->quality(module::get_var("gallery", "image_quality")); + if (graphics::can("sharpen")) { + $image->sharpen(module::get_var("gallery", "image_sharpen")); + } + $image->save($output_file); + } + + module::event("graphics_resize_completed", $input_file, $output_file, $options); + } +} diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 6500482b..ee605b27 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -224,8 +224,8 @@ class gallery_installer { $root->save(); access::add_item($root); - module::set_var("gallery", "active_site_theme", "default"); - module::set_var("gallery", "active_admin_theme", "admin_default"); + module::set_var("gallery", "active_site_theme", "wind"); + module::set_var("gallery", "active_admin_theme", "admin_wind"); module::set_var("gallery", "page_size", 9); module::set_var("gallery", "thumb_size", 200); module::set_var("gallery", "resize_size", 640); @@ -268,7 +268,7 @@ class gallery_installer { module::set_var("gallery", "show_credits", 1); // @todo this string needs to be picked up by l10n_scanner module::set_var("gallery", "credits", "Powered by <a href=\"%url\">Gallery %version</a>"); - module::set_version("gallery", 12); + module::set_version("gallery", 13); } static function upgrade($version) { @@ -364,6 +364,17 @@ class gallery_installer { $db->query("UPDATE {items} SET `relative_url_cache` = NULL, `relative_path_cache` = NULL"); module::set_version("gallery", $version = 12); } + + if ($version == 12) { + if (module::get_var("gallery", "active_site_theme") == "default") { + module::set_var("gallery", "active_site_theme", "wind"); + } + if (module::get_var("gallery", "active_admin_theme") == "admin_default") { + module::set_var("gallery", "active_admin_theme", "admin_wind"); + } + module::set_version("gallery", $version = 13); + } + } static function uninstall() { diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php index 1b56ab97..3d0476a8 100644 --- a/modules/gallery/helpers/gallery_task.php +++ b/modules/gallery/helpers/gallery_task.php @@ -48,9 +48,13 @@ class gallery_task_Core { $errors = array(); try { $result = graphics::find_dirty_images_query(); + $total_count = $task->get("total_count", -1); + if ($total_count < 0) { + $total_count = $result->count(); + $task->set("total_count", $total_count); + } $completed = $task->get("completed", 0); $ignored = $task->get("ignored", array()); - $remaining = $result->count() - count($ignored); $i = 0; foreach ($result as $row) { @@ -62,19 +66,18 @@ class gallery_task_Core { if ($item->loaded) { try { graphics::generate($item); - $ignored[$item->id] = 1; + $completed++; + $errors[] = t("Successfully rebuilt images for '%title'", array("title" => html::purify($item->title))); } catch (Exception $e) { $errors[] = t("Unable to rebuild images for '%title'", array("title" => html::purify($item->title))); $errors[] = $e->__toString(); + $ignored[$item->id] = 1; } } - $completed++; - $remaining--; - if (++$i == 2) { break; } @@ -83,17 +86,17 @@ class gallery_task_Core { $task->status = t2("Updated: 1 image. Total: %total_count.", "Updated: %count images. Total: %total_count.", $completed, - array("total_count" => ($remaining + $completed))); + array("total_count" => $total_count)); - if ($completed + $remaining > 0) { - $task->percent_complete = (int)(100 * $completed / ($completed + $remaining)); + if ($completed < $total_count) { + $task->percent_complete = (int)(100 * ($completed + count($ignored)) / $total_count); } else { $task->percent_complete = 100; } $task->set("completed", $completed); $task->set("ignored", $ignored); - if ($remaining == 0) { + if ($task->percent_complete == 100) { $task->done = true; $task->state = "success"; site_status::clear("graphics_dirty"); diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 78812794..6705652f 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -152,7 +152,7 @@ class graphics_Core { ->orderby("priority", "asc") ->find_all() as $rule) { $args = array($working_file, $output_file, unserialize($rule->args)); - call_user_func_array(array("graphics", $rule->operation), $args); + call_user_func_array(array("{$rule->module_name}_graphics", $rule->operation), $args); $working_file = $output_file; } } @@ -181,42 +181,6 @@ class graphics_Core { } /** - * Resize an image. Valid options are width, height and master. Master is one of the Image - * master dimension constants. - * - * @param string $input_file - * @param string $output_file - * @param array $options - */ - static function resize($input_file, $output_file, $options) { - if (!self::$init) { - self::init_toolkit(); - } - - module::event("graphics_resize", $input_file, $output_file, $options); - - if (@filesize($input_file) == 0) { - throw new Exception("@todo EMPTY_INPUT_FILE"); - } - - $dims = getimagesize($input_file); - if (max($dims[0], $dims[1]) < min($options["width"], $options["height"])) { - // Image would get upscaled; do nothing - copy($input_file, $output_file); - } else { - $image = Image::factory($input_file) - ->resize($options["width"], $options["height"], $options["master"]) - ->quality(module::get_var("gallery", "image_quality")); - if (graphics::can("sharpen")) { - $image->sharpen(module::get_var("gallery", "image_sharpen")); - } - $image->save($output_file); - } - - module::event("graphics_resize_completed", $input_file, $output_file, $options); - } - - /** * Rotate an image. Valid options are degrees * * @param string $input_file @@ -239,60 +203,6 @@ class graphics_Core { } /** - * Overlay an image on top of the input file. - * - * Valid options are: file, mime_type, position, transparency_percent, padding - * - * Valid positions: northwest, north, northeast, - * west, center, east, - * southwest, south, southeast - * - * padding is in pixels - * - * @param string $input_file - * @param string $output_file - * @param array $options - */ - static function composite($input_file, $output_file, $options) { - if (!self::$init) { - self::init_toolkit(); - } - - module::event("graphics_composite", $input_file, $output_file, $options); - - list ($width, $height) = getimagesize($input_file); - list ($w_width, $w_height) = getimagesize($options["file"]); - - $pad = isset($options["padding"]) ? $options["padding"] : 10; - $top = $pad; - $left = $pad; - $y_center = max($height / 2 - $w_height / 2, $pad); - $x_center = max($width / 2 - $w_width / 2, $pad); - $bottom = max($height - $w_height - $pad, $pad); - $right = max($width - $w_width - $pad, $pad); - - switch ($options["position"]) { - case "northwest": $x = $left; $y = $top; break; - case "north": $x = $x_center; $y = $top; break; - case "northeast": $x = $right; $y = $top; break; - case "west": $x = $left; $y = $y_center; break; - case "center": $x = $x_center; $y = $y_center; break; - case "east": $x = $right; $y = $y_center; break; - case "southwest": $x = $left; $y = $bottom; break; - case "south": $x = $x_center; $y = $bottom; break; - case "southeast": $x = $right; $y = $bottom; break; - } - - Image::factory($input_file) - ->composite($options["file"], $x, $y, $options["transparency"]) - ->quality(module::get_var("gallery", "image_quality")) - ->save($output_file); - - - module::event("graphics_composite_completed", $input_file, $output_file, $options); - } - - /** * Return a query result that locates all items with dirty images. * @return Database_Result Query result */ @@ -463,6 +373,9 @@ class graphics_Core { * Choose which driver the Kohana Image library uses. */ static function init_toolkit() { + if (self::$init) { + return; + } switch(module::get_var("gallery", "graphics_toolkit")) { case "gd": Kohana::config_set("image.driver", "GD"); diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php index 59bf5c19..6c8c6c88 100644 --- a/modules/gallery/helpers/movie.php +++ b/modules/gallery/helpers/movie.php @@ -128,6 +128,36 @@ class movie_Core { return $movie; } + static function get_edit_form($movie) { + $form = new Forge("movies/$movie->id", "", "post", array("id" => "gEditMovieForm")); + $form->hidden("_method")->value("put"); + $group = $form->group("edit_item")->label(t("Edit Movie")); + $group->input("title")->label(t("Title"))->value($movie->title); + $group->textarea("description")->label(t("Description"))->value($movie->description); + $group->input("filename")->label(t("Filename"))->value($movie->name) + ->error_messages( + "name_conflict", t("There is already a movie, photo or album with this name")) + ->callback("item::validate_no_slashes") + ->error_messages("no_slashes", t("The movie name can't contain a \"/\"")) + ->callback("item::validate_no_trailing_period") + ->error_messages("no_trailing_period", t("The movie name can't end in \".\"")); + $group->input("slug")->label(t("Internet Address"))->value($movie->slug) + ->callback("item::validate_url_safe") + ->error_messages( + "slug_conflict", t("There is already a movie, photo or album with this internet address")) + ->error_messages( + "not_url_safe", + t("The internet address should contain only letters, numbers, hyphens and underscores")); + + module::event("item_edit_form", $movie, $form); + + $group = $form->group("buttons")->label(""); + $group->submit("")->value(t("Modify")); + $form->add_rules_from(ORM::factory("item")); + return $form; + } + + static function getmoviesize($filename) { $ffmpeg = self::find_ffmpeg(); if (empty($ffmpeg)) { diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php index 3d9fbe69..065d2d31 100644 --- a/modules/gallery/helpers/photo.php +++ b/modules/gallery/helpers/photo.php @@ -163,7 +163,8 @@ class photo_Core { $group->input("title")->label(t("Title"))->value($photo->title); $group->textarea("description")->label(t("Description"))->value($photo->description); $group->input("filename")->label(t("Filename"))->value($photo->name) - ->error_messages("name_conflict", t("There is already a photo or album with this name")) + ->error_messages( + "name_conflict", t("There is already a movie, photo or album with this name")) ->callback("item::validate_no_slashes") ->error_messages("no_slashes", t("The photo name can't contain a \"/\"")) ->callback("item::validate_no_trailing_period") @@ -171,7 +172,7 @@ class photo_Core { $group->input("slug")->label(t("Internet Address"))->value($photo->slug) ->callback("item::validate_url_safe") ->error_messages( - "slug_conflict", t("There is already a photo or album with this internet address")) + "slug_conflict", t("There is already a movie, photo or album with this internet address")) ->error_messages( "not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores")); diff --git a/modules/gallery/libraries/Admin_View.php b/modules/gallery/libraries/Admin_View.php index 21b70df6..fd4fbea8 100644 --- a/modules/gallery/libraries/Admin_View.php +++ b/modules/gallery/libraries/Admin_View.php @@ -27,9 +27,9 @@ class Admin_View_Core extends Gallery_View { * @return void */ public function __construct($name) { - $theme_name = module::get_var("gallery", "active_site_theme"); - if (!file_exists("themes/$theme_name")) { - module::set_var("gallery", "active_site_theme", "admin_default"); + $theme_name = module::get_var("gallery", "active_admin_theme"); + if (!file_exists(THEMEPATH . $theme_name)) { + module::set_var("gallery", "active_admin_theme", "admin_wind"); theme::load_themes(); Kohana::log("error", "Unable to locate theme '$theme_name', switching to default theme."); } diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index 130e2dce..ebd6a920 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -29,8 +29,8 @@ class Theme_View_Core extends Gallery_View { */ public function __construct($name, $page_type) { $theme_name = module::get_var("gallery", "active_site_theme"); - if (!file_exists("themes/$theme_name")) { - module::set_var("gallery", "active_site_theme", "default"); + if (!file_exists(THEMEPATH . $theme_name)) { + module::set_var("gallery", "active_site_theme", "wind"); theme::load_themes(); Kohana::log("error", "Unable to locate theme '$theme_name', switching to default theme."); } diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 70bd91e2..65a0691c 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 12 +version = 13 diff --git a/modules/gallery/tests/Xss_Security_Test.php b/modules/gallery/tests/Xss_Security_Test.php index 16541017..b296d97c 100644 --- a/modules/gallery/tests/Xss_Security_Test.php +++ b/modules/gallery/tests/Xss_Security_Test.php @@ -248,7 +248,7 @@ class Xss_Security_Test extends Unit_Test_Case { $frame->is_safe_attr(true); } } - } + } } else if ($frame && $token[0] == T_OBJECT_OPERATOR) { $frame->expr_append($token[1]); @@ -349,7 +349,7 @@ class Xss_Security_Test extends Unit_Test_Case { $canonical = MODPATH . "gallery/tests/xss_data.txt"; exec("diff $canonical $new", $output, $return_value); $this->assert_false( - $return_value, "XSS golden file mismatch. Output:\n" . implode("\n", $output) ); + $return_value, "XSS golden file mismatch. Output:\n" . implode("\n", $output) ); } private static function _create_frame($token, $in_script_block, diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 57da8730..7d3cf362 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -148,31 +148,31 @@ modules/gallery/views/permissions_browse.html.php 44 DIRTY_JS $paren modules/gallery/views/permissions_browse.html.php 52 DIRTY_ATTR $item->id modules/gallery/views/permissions_browse.html.php 53 DIRTY_JS $item->id modules/gallery/views/permissions_browse.html.php 60 DIRTY $form -modules/gallery/views/permissions_form.html.php 24 DIRTY_JS $lock->id -modules/gallery/views/permissions_form.html.php 32 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 32 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 32 DIRTY_JS $item->id -modules/gallery/views/permissions_form.html.php 36 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 36 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 36 DIRTY_JS $item->id -modules/gallery/views/permissions_form.html.php 43 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 43 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 43 DIRTY_JS $item->id -modules/gallery/views/permissions_form.html.php 47 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 47 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 47 DIRTY_JS $item->id -modules/gallery/views/permissions_form.html.php 56 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 56 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 56 DIRTY_JS $item->id -modules/gallery/views/permissions_form.html.php 63 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 63 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 63 DIRTY_JS $item->id -modules/gallery/views/permissions_form.html.php 74 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 74 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 74 DIRTY_JS $item->id -modules/gallery/views/permissions_form.html.php 79 DIRTY_JS $group->id -modules/gallery/views/permissions_form.html.php 79 DIRTY_JS $permission->id -modules/gallery/views/permissions_form.html.php 79 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 26 DIRTY_JS $lock->id +modules/gallery/views/permissions_form.html.php 34 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 34 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 34 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 37 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 37 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 37 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 44 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 44 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 44 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 48 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 48 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 48 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 57 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 57 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 57 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 64 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 64 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 64 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 75 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 75 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 75 DIRTY_JS $item->id +modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $group->id +modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $permission->id +modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $item->id modules/gallery/views/upgrader.html.php 44 DIRTY_ATTR $module->version==$module->code_version?"current":"upgradeable" modules/gallery/views/upgrader.html.php 45 DIRTY_ATTR $id modules/gallery/views/upgrader.html.php 49 DIRTY $module->version @@ -251,8 +251,8 @@ modules/search/views/search.html.php 31 DIRTY_JS $item- modules/search/views/search.html.php 32 DIRTY $item->thumb_img() modules/server_add/views/admin_server_add.html.php 15 DIRTY_ATTR $id modules/server_add/views/admin_server_add.html.php 24 DIRTY $form -modules/server_add/views/server_add_tree.html.php 12 DIRTY_JS html::js_string($dir) modules/server_add/views/server_add_tree.html.php 20 DIRTY_ATTR is_dir($file)?"ui-icon-folder-collapsed":"ui-icon-document" +modules/server_add/views/server_add_tree.html.php 21 DIRTY_ATTR is_dir($file)?"gDirectory":"gFile" modules/server_add/views/server_add_tree_dialog.html.php 3 DIRTY_JS url::site("server_add/children?path=__PATH__") modules/server_add/views/server_add_tree_dialog.html.php 4 DIRTY_JS url::site("server_add/start?item_id={$item->id}&csrf=$csrf") modules/server_add/views/server_add_tree_dialog.html.php 23 DIRTY $tree @@ -283,65 +283,65 @@ modules/user/views/user_languages_block.html.php 2 DIRTY form:: modules/watermark/views/admin_watermarks.html.php 19 DIRTY_ATTR $width modules/watermark/views/admin_watermarks.html.php 19 DIRTY_ATTR $height modules/watermark/views/admin_watermarks.html.php 19 DIRTY_ATTR $url -themes/admin_default/views/admin.html.php 15 DIRTY_JS $theme->url() -themes/admin_default/views/admin.html.php 32 DIRTY $theme->admin_head() -themes/admin_default/views/admin.html.php 36 DIRTY $theme->admin_page_top() -themes/admin_default/views/admin.html.php 44 DIRTY $theme->admin_header_top() -themes/admin_default/views/admin.html.php 49 DIRTY_JS item::root()->url() -themes/admin_default/views/admin.html.php 53 DIRTY $theme->admin_menu() -themes/admin_default/views/admin.html.php 55 DIRTY $theme->admin_header_bottom() -themes/admin_default/views/admin.html.php 62 DIRTY $content -themes/admin_default/views/admin.html.php 68 DIRTY $sidebar -themes/admin_default/views/admin.html.php 73 DIRTY $theme->admin_footer() -themes/admin_default/views/admin.html.php 75 DIRTY $theme->admin_credits() -themes/admin_default/views/admin.html.php 79 DIRTY $theme->admin_page_bottom() -themes/admin_default/views/block.html.php 3 DIRTY_ATTR $anchor -themes/admin_default/views/block.html.php 5 DIRTY $id -themes/admin_default/views/block.html.php 5 DIRTY_ATTR $css_id -themes/admin_default/views/block.html.php 13 DIRTY $title -themes/admin_default/views/block.html.php 16 DIRTY $content -themes/admin_default/views/pager.html.php 13 DIRTY_JS str_replace('{page}',1,$url) -themes/admin_default/views/pager.html.php 20 DIRTY_JS str_replace('{page}',$previous_page,$url) -themes/admin_default/views/pager.html.php 27 DIRTY $from_to_msg -themes/admin_default/views/pager.html.php 30 DIRTY_JS str_replace('{page}',$next_page,$url) -themes/admin_default/views/pager.html.php 37 DIRTY_JS str_replace('{page}',$last_page,$url) -themes/default/views/album.html.php 16 DIRTY_ATTR $child->id -themes/default/views/album.html.php 16 DIRTY_ATTR $item_class -themes/default/views/album.html.php 18 DIRTY_JS $child->url() -themes/default/views/album.html.php 19 DIRTY $child->thumb_img(array("class"=>"gThumbnail")) -themes/default/views/album.html.php 23 DIRTY_JS $child->url() -themes/default/views/block.html.php 3 DIRTY_ATTR $anchor -themes/default/views/block.html.php 5 DIRTY_ATTR $css_id -themes/default/views/block.html.php 6 DIRTY $title -themes/default/views/block.html.php 8 DIRTY $content -themes/default/views/dynamic.html.php 11 DIRTY_ATTR $child->is_album()?"gAlbum":"" -themes/default/views/dynamic.html.php 13 DIRTY_JS $child->url() -themes/default/views/dynamic.html.php 14 DIRTY_ATTR $child->id -themes/default/views/dynamic.html.php 15 DIRTY_ATTR $child->thumb_url() -themes/default/views/dynamic.html.php 16 DIRTY_ATTR $child->thumb_width -themes/default/views/dynamic.html.php 17 DIRTY_ATTR $child->thumb_height -themes/default/views/movie.html.php 8 DIRTY_JS $previous_item->url() -themes/default/views/movie.html.php 18 DIRTY_JS $next_item->url() -themes/default/views/movie.html.php 28 DIRTY $item->movie_img(array("class"=>"gMovie","id"=>"gMovieId-{$item->id}")) -themes/default/views/page.html.php 9 DIRTY $page_title -themes/default/views/page.html.php 32 DIRTY_JS $theme->url() -themes/default/views/page.html.php 41 DIRTY $new_width -themes/default/views/page.html.php 42 DIRTY $new_height -themes/default/views/page.html.php 43 DIRTY $thumb_proportion -themes/default/views/page.html.php 82 DIRTY $header_text -themes/default/views/page.html.php 84 DIRTY_JS item::root()->url() -themes/default/views/page.html.php 102 DIRTY_JS $parent->url($parent==$theme->item()->parent()?"show={$theme->item()->id}":null) -themes/default/views/page.html.php 117 DIRTY $content -themes/default/views/page.html.php 123 DIRTY newView("sidebar.html") -themes/default/views/page.html.php 130 DIRTY $footer_text -themes/default/views/pager.html.php 13 DIRTY_JS str_replace('{page}',1,$url) -themes/default/views/pager.html.php 20 DIRTY_JS str_replace('{page}',$previous_page,$url) -themes/default/views/pager.html.php 27 DIRTY $from_to_msg -themes/default/views/pager.html.php 30 DIRTY_JS str_replace('{page}',$next_page,$url) -themes/default/views/pager.html.php 37 DIRTY_JS str_replace('{page}',$last_page,$url) -themes/default/views/photo.html.php 8 DIRTY_JS $theme->item()->width -themes/default/views/photo.html.php 8 DIRTY_JS $theme->item()->height -themes/default/views/photo.html.php 21 DIRTY_JS $previous_item->url() -themes/default/views/photo.html.php 31 DIRTY_JS $next_item->url() -themes/default/views/photo.html.php 43 DIRTY_JS $item->file_url() -themes/default/views/photo.html.php 45 DIRTY $item->resize_img(array("id"=>"gPhotoId-{$item->id}","class"=>"gResize")) +themes/admin_wind/views/admin.html.php 15 DIRTY_JS $theme->url() +themes/admin_wind/views/admin.html.php 32 DIRTY $theme->admin_head() +themes/admin_wind/views/admin.html.php 36 DIRTY $theme->admin_page_top() +themes/admin_wind/views/admin.html.php 44 DIRTY $theme->admin_header_top() +themes/admin_wind/views/admin.html.php 49 DIRTY_JS item::root()->url() +themes/admin_wind/views/admin.html.php 53 DIRTY $theme->admin_menu() +themes/admin_wind/views/admin.html.php 55 DIRTY $theme->admin_header_bottom() +themes/admin_wind/views/admin.html.php 62 DIRTY $content +themes/admin_wind/views/admin.html.php 68 DIRTY $sidebar +themes/admin_wind/views/admin.html.php 73 DIRTY $theme->admin_footer() +themes/admin_wind/views/admin.html.php 75 DIRTY $theme->admin_credits() +themes/admin_wind/views/admin.html.php 79 DIRTY $theme->admin_page_bottom() +themes/admin_wind/views/block.html.php 3 DIRTY_ATTR $anchor +themes/admin_wind/views/block.html.php 5 DIRTY $id +themes/admin_wind/views/block.html.php 5 DIRTY_ATTR $css_id +themes/admin_wind/views/block.html.php 13 DIRTY $title +themes/admin_wind/views/block.html.php 16 DIRTY $content +themes/admin_wind/views/pager.html.php 13 DIRTY_JS str_replace('{page}',1,$url) +themes/admin_wind/views/pager.html.php 20 DIRTY_JS str_replace('{page}',$previous_page,$url) +themes/admin_wind/views/pager.html.php 27 DIRTY $from_to_msg +themes/admin_wind/views/pager.html.php 30 DIRTY_JS str_replace('{page}',$next_page,$url) +themes/admin_wind/views/pager.html.php 37 DIRTY_JS str_replace('{page}',$last_page,$url) +themes/wind/views/album.html.php 16 DIRTY_ATTR $child->id +themes/wind/views/album.html.php 16 DIRTY_ATTR $item_class +themes/wind/views/album.html.php 18 DIRTY_JS $child->url() +themes/wind/views/album.html.php 19 DIRTY $child->thumb_img(array("class"=>"gThumbnail")) +themes/wind/views/album.html.php 23 DIRTY_JS $child->url() +themes/wind/views/block.html.php 3 DIRTY_ATTR $anchor +themes/wind/views/block.html.php 5 DIRTY_ATTR $css_id +themes/wind/views/block.html.php 6 DIRTY $title +themes/wind/views/block.html.php 8 DIRTY $content +themes/wind/views/dynamic.html.php 11 DIRTY_ATTR $child->is_album()?"gAlbum":"" +themes/wind/views/dynamic.html.php 13 DIRTY_JS $child->url() +themes/wind/views/dynamic.html.php 14 DIRTY_ATTR $child->id +themes/wind/views/dynamic.html.php 15 DIRTY_ATTR $child->thumb_url() +themes/wind/views/dynamic.html.php 16 DIRTY_ATTR $child->thumb_width +themes/wind/views/dynamic.html.php 17 DIRTY_ATTR $child->thumb_height +themes/wind/views/movie.html.php 8 DIRTY_JS $previous_item->url() +themes/wind/views/movie.html.php 18 DIRTY_JS $next_item->url() +themes/wind/views/movie.html.php 28 DIRTY $item->movie_img(array("class"=>"gMovie","id"=>"gMovieId-{$item->id}")) +themes/wind/views/page.html.php 9 DIRTY $page_title +themes/wind/views/page.html.php 32 DIRTY_JS $theme->url() +themes/wind/views/page.html.php 41 DIRTY $new_width +themes/wind/views/page.html.php 42 DIRTY $new_height +themes/wind/views/page.html.php 43 DIRTY $thumb_proportion +themes/wind/views/page.html.php 82 DIRTY $header_text +themes/wind/views/page.html.php 84 DIRTY_JS item::root()->url() +themes/wind/views/page.html.php 102 DIRTY_JS $parent->url($parent==$theme->item()->parent()?"show={$theme->item()->id}":null) +themes/wind/views/page.html.php 117 DIRTY $content +themes/wind/views/page.html.php 123 DIRTY newView("sidebar.html") +themes/wind/views/page.html.php 130 DIRTY $footer_text +themes/wind/views/pager.html.php 13 DIRTY_JS str_replace('{page}',1,$url) +themes/wind/views/pager.html.php 20 DIRTY_JS str_replace('{page}',$previous_page,$url) +themes/wind/views/pager.html.php 27 DIRTY $from_to_msg +themes/wind/views/pager.html.php 30 DIRTY_JS str_replace('{page}',$next_page,$url) +themes/wind/views/pager.html.php 37 DIRTY_JS str_replace('{page}',$last_page,$url) +themes/wind/views/photo.html.php 8 DIRTY_JS $theme->item()->width +themes/wind/views/photo.html.php 8 DIRTY_JS $theme->item()->height +themes/wind/views/photo.html.php 21 DIRTY_JS $previous_item->url() +themes/wind/views/photo.html.php 31 DIRTY_JS $next_item->url() +themes/wind/views/photo.html.php 43 DIRTY_JS $item->file_url() +themes/wind/views/photo.html.php 45 DIRTY $item->resize_img(array("id"=>"gPhotoId-{$item->id}","class"=>"gResize")) diff --git a/modules/gallery/views/admin_maintenance_show_log.html.php b/modules/gallery/views/admin_maintenance_show_log.html.php index 8ea1beb6..2dfef90f 100644 --- a/modules/gallery/views/admin_maintenance_show_log.html.php +++ b/modules/gallery/views/admin_maintenance_show_log.html.php @@ -2,8 +2,8 @@ <script type="text/javascript"> dismiss = function() { window.location.reload(); - } - download = function(){ + }; + download = function() { // send request $('<form action="<?= url::site("admin/maintenance/save_log/$task->id?csrf=$csrf") ?>" method="post"></form>'). appendTo('body').submit().remove(); diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index a0bb35f2..f5639439 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -1,7 +1,6 @@ <?php defined("SYSPATH") or die("No direct script access.") ?> <fieldset> <legend> <?= t('Edit Permissions') ?> </legend> - <table> <tr> <th> </th> @@ -12,7 +11,8 @@ <? foreach ($permissions as $permission): ?> <tr> - <td> <?= t($permission->display_name) ?> </td> + <td> <?= t($permission->display_name) ?> + </td> <? foreach ($groups as $group): ?> <? $intent = access::group_intent($group, $permission->name, $item) ?> <? $allowed = access::group_can($group, $permission->name, $item) ?> @@ -20,33 +20,34 @@ <? if ($lock): ?> <td class="gDenied"> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" title="<?= t('denied and locked through parent album')->for_html_attr() ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" + title="<?= t('denied and locked through parent album')->for_html_attr() ?>" + alt="<?= t('denied icon')->for_html_attr() ?>" /> <a href="javascript:show(<?= $lock->id ?>)" title="<?= t('click to go to parent album')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-lock.png') ?>" alt="<?= t('locked icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-lock.png")) ?>" alt="<?= t('locked icon')->for_html_attr() ?>" /> </a> </td> <? else: ?> <? if ($intent === access::INHERIT): ?> <? if ($allowed): ?> <td class="gAllowed"> - <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" - title="<?= t('allowed through parent album, click to allow explicitly')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-success-pale.png') ?>" alt="<?= t('passive allowed icon')->for_html_attr() ?>" /> + <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('allowed through parent album, click to allow explicitly')->for_html_attr() ?>"> + <img src="<?= url::file(gallery::find_file("images", "ico-success-pale.png")) ?>" alt="<?= t('passive allowed icon')->for_html_attr() ?>" /> </a> <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to deny')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-gray.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> </a> </td> <? else: ?> <td class="gDenied"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to allow')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success-gray.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> </a> <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('denied through parent album, click to deny explicitly')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-pale.png') ?>" alt="<?= t('passive denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-pale.png")) ?>" alt="<?= t('passive denied icon')->for_html_attr() ?>" /> </a> </td> <? endif ?> @@ -55,30 +56,30 @@ <td class="gDenied"> <a href="javascript:set('allow',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to allow')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-success-gray.png') ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success-gray.png")) ?>" alt="<?= t('inactive allowed icon')->for_html_attr() ?>" /> </a> <? if ($item->id == 1): ?> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon')->for_html_attr() ?>" title="<?= t('denied')->for_html_attr() ?>"/> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" title="<?= t('denied')->for_html_attr() ?>"/> <? else: ?> <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('denied, click to reset')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-denied.png') ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied.png")) ?>" alt="<?= t('denied icon')->for_html_attr() ?>" /> </a> <? endif ?> </td> <? elseif ($intent === access::ALLOW): ?> <td class="gAllowed"> <? if ($item->id == 1): ?> - <img src="<?= url::file('themes/default/images/ico-success.png') ?>" title="<?= t("allowed")->for_html_attr() ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" title="<?= t("allowed")->for_html_attr() ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> <? else: ?> <a href="javascript:set('reset',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('allowed, click to reset')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-success.png') ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-success.png")) ?>" alt="<?= t('allowed icon')->for_html_attr() ?>" /> </a> <? endif ?> <a href="javascript:set('deny',<?= $group->id ?>,<?= $permission->id ?>,<?= $item->id ?>)" title="<?= t('click to deny')->for_html_attr() ?>"> - <img src="<?= url::file('themes/default/images/ico-denied-gray.png') ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> + <img src="<?= url::file(gallery::find_file("images", "ico-denied-gray.png")) ?>" alt="<?= t('inactive denied icon')->for_html_attr() ?>" /> </a> </td> <? endif ?> diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php index 7f8a96df..acd2bee0 100644 --- a/modules/gallery/views/simple_uploader.html.php +++ b/modules/gallery/views/simple_uploader.html.php @@ -97,7 +97,7 @@ debug: false, // Button settings - button_image_url: <?= html::js_string(url::file("themes/default/images/select-photos-backg.png")) ?>, + button_image_url: <?= html::js_string(url::file(gallery::find_file("images", "select-photos-backg.png"))) ?>, button_width: "202", button_height: "45", button_placeholder_id: "gChooseFilesButtonPlaceholder", diff --git a/modules/watermark/helpers/watermark_graphics.php b/modules/watermark/helpers/watermark_graphics.php new file mode 100644 index 00000000..aef7586b --- /dev/null +++ b/modules/watermark/helpers/watermark_graphics.php @@ -0,0 +1,75 @@ +<?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 watermark_graphics_Core { + /** + * Overlay an image on top of the input file. + * + * Valid options are: file, mime_type, position, transparency_percent, padding + * + * Valid positions: northwest, north, northeast, + * west, center, east, + * southwest, south, southeast + * + * padding is in pixels + * + * @param string $input_file + * @param string $output_file + * @param array $options + */ + static function composite($input_file, $output_file, $options) { + try { + graphics::init_toolkit(); + + module::event("graphics_composite", $input_file, $output_file, $options); + + list ($width, $height) = getimagesize($input_file); + list ($w_width, $w_height) = getimagesize($options["file"]); + + $pad = isset($options["padding"]) ? $options["padding"] : 10; + $top = $pad; + $left = $pad; + $y_center = max($height / 2 - $w_height / 2, $pad); + $x_center = max($width / 2 - $w_width / 2, $pad); + $bottom = max($height - $w_height - $pad, $pad); + $right = max($width - $w_width - $pad, $pad); + + switch ($options["position"]) { + case "northwest": $x = $left; $y = $top; break; + case "north": $x = $x_center; $y = $top; break; + case "northeast": $x = $right; $y = $top; break; + case "west": $x = $left; $y = $y_center; break; + case "center": $x = $x_center; $y = $y_center; break; + case "east": $x = $right; $y = $y_center; break; + case "southwest": $x = $left; $y = $bottom; break; + case "south": $x = $x_center; $y = $bottom; break; + case "southeast": $x = $right; $y = $bottom; break; + } + + Image::factory($input_file) + ->composite($options["file"], $x, $y, $options["transparency"]) + ->quality(module::get_var("gallery", "image_quality")) + ->save($output_file); + + module::event("graphics_composite_completed", $input_file, $output_file, $options); + } catch (ErrorException $e) { + Kohana::log("error", $e->get_message()); + } + } +} diff --git a/themes/admin_default/css/fix-ie.css b/themes/admin_wind/css/fix-ie.css index 6bc2334c..6bc2334c 100644 --- a/themes/admin_default/css/fix-ie.css +++ b/themes/admin_wind/css/fix-ie.css diff --git a/themes/admin_default/css/screen.css b/themes/admin_wind/css/screen.css index de6d436e..de6d436e 100644 --- a/themes/admin_default/css/screen.css +++ b/themes/admin_wind/css/screen.css diff --git a/themes/admin_default/images/avatar.jpg b/themes/admin_wind/images/avatar.jpg Binary files differindex 2e76b12b..2e76b12b 100644 --- a/themes/admin_default/images/avatar.jpg +++ b/themes/admin_wind/images/avatar.jpg diff --git a/themes/admin_default/images/ico-album.png b/themes/admin_wind/images/ico-album.png Binary files differindex affa1b84..affa1b84 100644 --- a/themes/admin_default/images/ico-album.png +++ b/themes/admin_wind/images/ico-album.png diff --git a/themes/admin_default/images/ico-error.png b/themes/admin_wind/images/ico-error.png Binary files differindex c37bd062..c37bd062 100644 --- a/themes/admin_default/images/ico-error.png +++ b/themes/admin_wind/images/ico-error.png diff --git a/themes/admin_default/images/ico-info.png b/themes/admin_wind/images/ico-info.png Binary files differindex 12cd1aef..12cd1aef 100644 --- a/themes/admin_default/images/ico-info.png +++ b/themes/admin_wind/images/ico-info.png diff --git a/themes/admin_default/images/ico-print.png b/themes/admin_wind/images/ico-print.png Binary files differindex b82a8e1e..b82a8e1e 100644 --- a/themes/admin_default/images/ico-print.png +++ b/themes/admin_wind/images/ico-print.png diff --git a/themes/admin_default/images/ico-separator.gif b/themes/admin_wind/images/ico-separator.gif Binary files differindex 3de2d0d3..3de2d0d3 100644 --- a/themes/admin_default/images/ico-separator.gif +++ b/themes/admin_wind/images/ico-separator.gif diff --git a/themes/admin_default/images/ico-success.png b/themes/admin_wind/images/ico-success.png Binary files differindex a9925a06..a9925a06 100644 --- a/themes/admin_default/images/ico-success.png +++ b/themes/admin_wind/images/ico-success.png diff --git a/themes/admin_default/images/ico-view-comments.png b/themes/admin_wind/images/ico-view-comments.png Binary files differindex e5d3630f..e5d3630f 100644 --- a/themes/admin_default/images/ico-view-comments.png +++ b/themes/admin_wind/images/ico-view-comments.png diff --git a/themes/admin_default/images/ico-view-fullsize.png b/themes/admin_wind/images/ico-view-fullsize.png Binary files differindex 0be23e9b..0be23e9b 100644 --- a/themes/admin_default/images/ico-view-fullsize.png +++ b/themes/admin_wind/images/ico-view-fullsize.png diff --git a/themes/admin_default/images/ico-view-hybrid.png b/themes/admin_wind/images/ico-view-hybrid.png Binary files differindex ee902e55..ee902e55 100644 --- a/themes/admin_default/images/ico-view-hybrid.png +++ b/themes/admin_wind/images/ico-view-hybrid.png diff --git a/themes/admin_default/images/ico-view-slideshow.png b/themes/admin_wind/images/ico-view-slideshow.png Binary files differindex 82f61f63..82f61f63 100644 --- a/themes/admin_default/images/ico-view-slideshow.png +++ b/themes/admin_wind/images/ico-view-slideshow.png diff --git a/themes/admin_default/images/ico-warning.png b/themes/admin_wind/images/ico-warning.png Binary files differindex 628cf2da..628cf2da 100644 --- a/themes/admin_default/images/ico-warning.png +++ b/themes/admin_wind/images/ico-warning.png diff --git a/themes/admin_default/js/ui.init.js b/themes/admin_wind/js/ui.init.js index 1e09fd9f..c6379c09 100644 --- a/themes/admin_default/js/ui.init.js +++ b/themes/admin_wind/js/ui.init.js @@ -20,7 +20,7 @@ $(document).ready(function(){ $(".gDialogLink").gallery_dialog(); // Initialize ajax links - $(".gDialogLink").gallery_ajax(); + $(".gAjaxLink").gallery_ajax(); // Initialize panels $(".gPanelLink").gallery_panel(); diff --git a/themes/admin_default/theme.info b/themes/admin_wind/theme.info index b3d9741d..4034b64a 100644 --- a/themes/admin_default/theme.info +++ b/themes/admin_wind/theme.info @@ -1,4 +1,4 @@ -name = "Gallery Default" +name = "Gallery Wind" description = "A crisp Site Administration theme with soft colors and drop down menus." version = 1 author = "Gallery Team" diff --git a/themes/admin_default/thumbnail.png b/themes/admin_wind/thumbnail.png Binary files differindex b07a4cc2..b07a4cc2 100644 --- a/themes/admin_default/thumbnail.png +++ b/themes/admin_wind/thumbnail.png diff --git a/themes/admin_default/views/admin.html.php b/themes/admin_wind/views/admin.html.php index ef15ed25..ef15ed25 100644 --- a/themes/admin_default/views/admin.html.php +++ b/themes/admin_wind/views/admin.html.php diff --git a/themes/admin_default/views/block.html.php b/themes/admin_wind/views/block.html.php index 6cbea76e..6cbea76e 100644 --- a/themes/admin_default/views/block.html.php +++ b/themes/admin_wind/views/block.html.php diff --git a/themes/admin_default/views/pager.html.php b/themes/admin_wind/views/pager.html.php index 5034ec19..5034ec19 100644 --- a/themes/admin_default/views/pager.html.php +++ b/themes/admin_wind/views/pager.html.php diff --git a/themes/default/css/fix-ie.css b/themes/wind/css/fix-ie.css index eee88c15..eee88c15 100644 --- a/themes/default/css/fix-ie.css +++ b/themes/wind/css/fix-ie.css diff --git a/themes/default/css/screen.css b/themes/wind/css/screen.css index 64ecf775..64ecf775 100644 --- a/themes/default/css/screen.css +++ b/themes/wind/css/screen.css diff --git a/themes/default/images/avatar.jpg b/themes/wind/images/avatar.jpg Binary files differindex acad9314..acad9314 100644 --- a/themes/default/images/avatar.jpg +++ b/themes/wind/images/avatar.jpg diff --git a/themes/default/images/ico-album.png b/themes/wind/images/ico-album.png Binary files differindex affa1b84..affa1b84 100644 --- a/themes/default/images/ico-album.png +++ b/themes/wind/images/ico-album.png diff --git a/themes/default/images/ico-denied-gray.png b/themes/wind/images/ico-denied-gray.png Binary files differindex 56db3ff5..56db3ff5 100644 --- a/themes/default/images/ico-denied-gray.png +++ b/themes/wind/images/ico-denied-gray.png diff --git a/themes/default/images/ico-denied-pale.png b/themes/wind/images/ico-denied-pale.png Binary files differindex 1e992230..1e992230 100644 --- a/themes/default/images/ico-denied-pale.png +++ b/themes/wind/images/ico-denied-pale.png diff --git a/themes/default/images/ico-denied.png b/themes/wind/images/ico-denied.png Binary files differindex 08f24936..08f24936 100644 --- a/themes/default/images/ico-denied.png +++ b/themes/wind/images/ico-denied.png diff --git a/themes/default/images/ico-error.png b/themes/wind/images/ico-error.png Binary files differindex c37bd062..c37bd062 100644 --- a/themes/default/images/ico-error.png +++ b/themes/wind/images/ico-error.png diff --git a/themes/default/images/ico-help.png b/themes/wind/images/ico-help.png Binary files differindex 5c870176..5c870176 100644 --- a/themes/default/images/ico-help.png +++ b/themes/wind/images/ico-help.png diff --git a/themes/default/images/ico-info.png b/themes/wind/images/ico-info.png Binary files differindex 12cd1aef..12cd1aef 100644 --- a/themes/default/images/ico-info.png +++ b/themes/wind/images/ico-info.png diff --git a/themes/default/images/ico-lock.png b/themes/wind/images/ico-lock.png Binary files differindex 2ebc4f6f..2ebc4f6f 100644 --- a/themes/default/images/ico-lock.png +++ b/themes/wind/images/ico-lock.png diff --git a/themes/default/images/ico-print.png b/themes/wind/images/ico-print.png Binary files differindex b82a8e1e..b82a8e1e 100644 --- a/themes/default/images/ico-print.png +++ b/themes/wind/images/ico-print.png diff --git a/themes/default/images/ico-separator.gif b/themes/wind/images/ico-separator.gif Binary files differindex 3de2d0d3..3de2d0d3 100644 --- a/themes/default/images/ico-separator.gif +++ b/themes/wind/images/ico-separator.gif diff --git a/themes/default/images/ico-success-gray.png b/themes/wind/images/ico-success-gray.png Binary files differindex 74b2032f..74b2032f 100644 --- a/themes/default/images/ico-success-gray.png +++ b/themes/wind/images/ico-success-gray.png diff --git a/themes/default/images/ico-success-pale.png b/themes/wind/images/ico-success-pale.png Binary files differindex dc8d1ded..dc8d1ded 100644 --- a/themes/default/images/ico-success-pale.png +++ b/themes/wind/images/ico-success-pale.png diff --git a/themes/default/images/ico-success.png b/themes/wind/images/ico-success.png Binary files differindex a9925a06..a9925a06 100644 --- a/themes/default/images/ico-success.png +++ b/themes/wind/images/ico-success.png diff --git a/themes/default/images/ico-view-comments.png b/themes/wind/images/ico-view-comments.png Binary files differindex e5d3630f..e5d3630f 100644 --- a/themes/default/images/ico-view-comments.png +++ b/themes/wind/images/ico-view-comments.png diff --git a/themes/default/images/ico-view-fullsize.png b/themes/wind/images/ico-view-fullsize.png Binary files differindex 0be23e9b..0be23e9b 100644 --- a/themes/default/images/ico-view-fullsize.png +++ b/themes/wind/images/ico-view-fullsize.png diff --git a/themes/default/images/ico-view-hybrid.png b/themes/wind/images/ico-view-hybrid.png Binary files differindex ee902e55..ee902e55 100644 --- a/themes/default/images/ico-view-hybrid.png +++ b/themes/wind/images/ico-view-hybrid.png diff --git a/themes/default/images/ico-view-slideshow.png b/themes/wind/images/ico-view-slideshow.png Binary files differindex 82f61f63..82f61f63 100644 --- a/themes/default/images/ico-view-slideshow.png +++ b/themes/wind/images/ico-view-slideshow.png diff --git a/themes/default/images/ico-warning.png b/themes/wind/images/ico-warning.png Binary files differindex 628cf2da..628cf2da 100644 --- a/themes/default/images/ico-warning.png +++ b/themes/wind/images/ico-warning.png diff --git a/themes/default/images/select-photos-backg.png b/themes/wind/images/select-photos-backg.png Binary files differindex 81c2d616..81c2d616 100644 --- a/themes/default/images/select-photos-backg.png +++ b/themes/wind/images/select-photos-backg.png diff --git a/themes/default/js/ui.init.js b/themes/wind/js/ui.init.js index 4eee1bb2..4eee1bb2 100644 --- a/themes/default/js/ui.init.js +++ b/themes/wind/js/ui.init.js diff --git a/themes/default/theme.info b/themes/wind/theme.info index 5f19d0d7..17ea7c20 100644 --- a/themes/default/theme.info +++ b/themes/wind/theme.info @@ -1,4 +1,4 @@ -name = "Gallery Default" +name = "Gallery Wind" description = "A crisp and distinctive theme that uses large fonts and icons for easy navigation and an enjoyable browsing experience." version = 1 author = "Gallery Team" diff --git a/themes/default/thumbnail.png b/themes/wind/thumbnail.png Binary files differindex c0594db2..c0594db2 100644 --- a/themes/default/thumbnail.png +++ b/themes/wind/thumbnail.png diff --git a/themes/default/views/album.html.php b/themes/wind/views/album.html.php index 01f7be50..01f7be50 100644 --- a/themes/default/views/album.html.php +++ b/themes/wind/views/album.html.php diff --git a/themes/default/views/block.html.php b/themes/wind/views/block.html.php index e8cff833..e8cff833 100644 --- a/themes/default/views/block.html.php +++ b/themes/wind/views/block.html.php diff --git a/themes/default/views/dynamic.html.php b/themes/wind/views/dynamic.html.php index 9ed9d69b..9ed9d69b 100644 --- a/themes/default/views/dynamic.html.php +++ b/themes/wind/views/dynamic.html.php diff --git a/themes/default/views/movie.html.php b/themes/wind/views/movie.html.php index 910814dd..910814dd 100644 --- a/themes/default/views/movie.html.php +++ b/themes/wind/views/movie.html.php diff --git a/themes/default/views/page.html.php b/themes/wind/views/page.html.php index 19d8cc00..19d8cc00 100644 --- a/themes/default/views/page.html.php +++ b/themes/wind/views/page.html.php diff --git a/themes/default/views/pager.html.php b/themes/wind/views/pager.html.php index 7cdc9bb0..7cdc9bb0 100644 --- a/themes/default/views/pager.html.php +++ b/themes/wind/views/pager.html.php diff --git a/themes/default/views/photo.html.php b/themes/wind/views/photo.html.php index b0096043..b0096043 100644 --- a/themes/default/views/photo.html.php +++ b/themes/wind/views/photo.html.php diff --git a/themes/default/views/sidebar.html.php b/themes/wind/views/sidebar.html.php index 04379eb6..04379eb6 100644 --- a/themes/default/views/sidebar.html.php +++ b/themes/wind/views/sidebar.html.php |