diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-08-27 20:56:03 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-08-27 20:56:03 -0700 |
commit | 084c2717c0ddff6c5caa79c62abb3cdb9b4aea31 (patch) | |
tree | af0fc03f042d11715cbbb3d137390d7df706ec3c /modules/gallery | |
parent | dc21cf36b606048dc24532407d39bc8f5b4211fa (diff) | |
parent | 246f5b59cb0e525a5ff6eaffce6b13e9af7e70b2 (diff) |
Merge branch 'master' into bharat_dev
Diffstat (limited to 'modules/gallery')
56 files changed, 904 insertions, 302 deletions
diff --git a/modules/gallery/config/locale.php b/modules/gallery/config/locale.php index 0509e45f..bce7fb49 100644 --- a/modules/gallery/config/locale.php +++ b/modules/gallery/config/locale.php @@ -29,13 +29,14 @@ $config['language'] = array('en_US', 'English_United States'); /** - * Locale timezone. Defaults to use the server timezone. + * Locale timezone. Set in 'Advanced' settings, falling back to the server's zone. * @see http://php.net/timezones */ -$config['timezone'] = ini_get('date.timezone'); -if (empty($config['timezone'])) { - // This is a required field. Pick something as a default. - $config['timezone'] = "America/Los_Angeles"; +if (file_exists(VARPATH . "database.php")) { + $config['timezone'] = module::get_var("gallery", "timezone", date_default_timezone_get()); +} else { + // Gallery3 is not installed yet -- don't make module::get_var() calls. + $config['timezone'] = date_default_timezone_get(); } // i18n settings diff --git a/modules/gallery/controllers/admin_graphics.php b/modules/gallery/controllers/admin_graphics.php index a2d19d4a..a8a7cdc0 100644 --- a/modules/gallery/controllers/admin_graphics.php +++ b/modules/gallery/controllers/admin_graphics.php @@ -40,6 +40,8 @@ class Admin_Graphics_Controller extends Admin_Controller { $msg = t("Changed graphics toolkit to: %toolkit", array("toolkit" => $tk->$toolkit_id->name)); message::success($msg); log::success("graphics", $msg); + + module::event("graphics_toolkit_change", $toolkit_id); } url::redirect("admin/graphics"); diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php index 787785ea..b712d14f 100644 --- a/modules/gallery/controllers/admin_modules.php +++ b/modules/gallery/controllers/admin_modules.php @@ -19,6 +19,9 @@ */ class Admin_Modules_Controller extends Admin_Controller { public function index() { + // If modules need upgrading, this will get recreated in module::available() + site_status::clear("upgrade_now"); + $view = new Admin_View("admin.html"); $view->page_title = t("Modules"); $view->content = new View("admin_modules.html"); @@ -103,9 +106,6 @@ class Admin_Modules_Controller extends Admin_Controller { module::event("module_change", $changes); - // If modules need upgrading, this will get recreated - site_status::clear("upgrade_now"); - // @todo this type of collation is questionable from an i18n perspective if ($activated_names) { message::success(t("Activated: %names", array("names" => join(", ", $activated_names)))); diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index 055e063c..d9323ea0 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -59,6 +59,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value); module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value); module::set_var("gallery", "favicon_url", $form->edit_theme->favicon_url->value); + module::set_var("gallery", "apple_touch_icon_url", $form->edit_theme->apple_touch_icon_url->value); module::event("theme_edit_form_completed", $form); @@ -77,8 +78,10 @@ class Admin_Theme_Options_Controller extends Admin_Controller { $group = $form->group("edit_theme")->label(t("Theme layout")); $group->input("page_size")->label(t("Items per page"))->id("g-page-size") ->rules("required|valid_digit") + ->callback(array($this, "_valididate_page_size")) ->error_messages("required", t("You must enter a number")) ->error_messages("valid_digit", t("You must enter a number")) + ->error_messages("valid_min_value", t("The value must be greater than zero")) ->value(module::get_var("gallery", "page_size")); $group->input("thumb_size")->label(t("Thumbnail size (in pixels)"))->id("g-thumb-size") ->rules("required|valid_digit") @@ -93,6 +96,9 @@ class Admin_Theme_Options_Controller extends Admin_Controller { $group->input("favicon_url")->label(t("URL (or relative path) to your favicon.ico")) ->id("g-favicon") ->value(module::get_var("gallery", "favicon_url")); + $group->input("apple_touch_icon_url")->label(t("URL (or relative path) to your Apple Touch icon")) + ->id("g-apple-touch") + ->value(module::get_var("gallery", "apple_touch_icon_url")); $group->textarea("header_text")->label(t("Header text"))->id("g-header-text") ->value(module::get_var("gallery", "header_text")); $group->textarea("footer_text")->label(t("Footer text"))->id("g-footer-text") @@ -102,9 +108,15 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::event("theme_edit_form", $form); - $group = $form->group("buttons"); $group->submit("")->value(t("Save")); return $form; } + + function _valididate_page_size($input) { + if ($input->value < 1) { + $input->add_error("valid_min_value", true); + } + + } } diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php index cd8a5530..9cdc3db5 100644 --- a/modules/gallery/controllers/admin_themes.php +++ b/modules/gallery/controllers/admin_themes.php @@ -25,6 +25,9 @@ class Admin_Themes_Controller extends Admin_Controller { $view->content->admin = module::get_var("gallery", "active_admin_theme"); $view->content->site = module::get_var("gallery", "active_site_theme"); $view->content->themes = $this->_get_themes(); + + site_status::clear("missing_site_theme"); + site_status::clear("missing_admin_theme"); print $view; } diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index ccf6c1cb..8aa3bb35 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -69,12 +69,32 @@ class Albums_Controller extends Items_Controller { "item" => $album, "children" => $album->viewable()->children($page_size, $offset), "parents" => $album->parents()->as_array(), // view calls empty() on this + "breadcrumbs" => Breadcrumb::array_from_item_parents($album), "children_count" => $children_count)); $template->content = new View("album.html"); - $album->increment_view_count(); print $template; + item::set_display_context_callback("Albums_Controller::get_display_context"); + } + + static function get_display_context($item) { + $where = array(array("type", "!=", "album")); + $position = item::get_position($item, $where); + if ($position > 1) { + list ($previous_item, $ignore, $next_item) = + $item->parent()->viewable()->children(3, $position - 2, $where); + } else { + $previous_item = null; + list ($next_item) = $item->parent()->viewable()->children(1, $position, $where); + } + + return array("position" => $position, + "previous_item" => $previous_item, + "next_item" => $next_item, + "sibling_count" => $item->parent()->viewable()->children_count($where), + "parents" => $item->parents()->as_array(), + "breadcrumbs" => Breadcrumb::array_from_item_parents($item)); } public function create($parent_id) { diff --git a/modules/gallery/controllers/login.php b/modules/gallery/controllers/login.php index b203b7d3..fdf5d7b7 100644 --- a/modules/gallery/controllers/login.php +++ b/modules/gallery/controllers/login.php @@ -42,8 +42,9 @@ class Login_Controller extends Controller { public function html() { $view = new Theme_View("page.html", "other", "login"); - $view->page_title = t("Login"); - $view->content = auth::get_login_form("login/auth_html"); + $view->page_title = t("Log in to Gallery"); + $view->content = new View("login_ajax.html"); + $view->content->form = auth::get_login_form("login/auth_html"); print $view; } diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index 8e81c594..76263dc0 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -27,27 +27,11 @@ class Movies_Controller extends Items_Controller { access::required("view", $movie); - $where = array(array("type", "!=", "album")); - $position = item::get_position($movie, $where); - if ($position > 1) { - list ($previous_item, $ignore, $next_item) = - $movie->parent()->viewable()->children(3, $position - 2, $where); - } else { - $previous_item = null; - list ($next_item) = $movie->parent()->viewable()->children(1, $position, $where); - } - $template = new Theme_View("page.html", "item", "movie"); - $template->set_global( - array("item" => $movie, - "children" => array(), - "children_count" => 0, - "parents" => $movie->parents()->as_array(), - "next_item" => $next_item, - "previous_item" => $previous_item, - "sibling_count" => $movie->parent()->viewable()->children_count($where), - "position" => $position)); - + $template->set_global(array("item" => $movie, + "children" => array(), + "children_count" => 0)); + $template->set_global(item::get_display_context($movie)); $template->content = new View("movie.html"); $movie->increment_view_count(); diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index 054300a1..7e78b205 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -27,27 +27,11 @@ class Photos_Controller extends Items_Controller { access::required("view", $photo); - $where = array(array("type", "!=", "album")); - $position = item::get_position($photo, $where); - if ($position > 1) { - list ($previous_item, $ignore, $next_item) = - $photo->parent()->viewable()->children(3, $position - 2, $where); - } else { - $previous_item = null; - list ($next_item) = $photo->parent()->viewable()->children(1, $position, $where); - } - $template = new Theme_View("page.html", "item", "photo"); - $template->set_global( - array("item" => $photo, - "children" => array(), - "children_count" => 0, - "parents" => $photo->parents()->as_array(), - "next_item" => $next_item, - "previous_item" => $previous_item, - "sibling_count" => $photo->parent()->viewable()->children_count($where), - "position" => $position)); - + $template->set_global(array("item" => $photo, + "children" => array(), + "children_count" => 0)); + $template->set_global(item::get_display_context($photo)); $template->content = new View("photo.html"); $photo->increment_view_count(); diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php index da4768fd..b6576ec0 100644 --- a/modules/gallery/controllers/quick.php +++ b/modules/gallery/controllers/quick.php @@ -36,8 +36,8 @@ class Quick_Controller extends Controller { } if ($degrees) { - $tmpfile = tempnam(TMPPATH, "rotate") . "." . - pathinfo($item->file_path(), PATHINFO_EXTENSION); + $tmpfile = system::temp_filename("rotate", + pathinfo($item->file_path(), PATHINFO_EXTENSION)); gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees), $item); $item->set_data_file($tmpfile); $item->save(); diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php index 6b1455e4..9c2bf7d7 100644 --- a/modules/gallery/controllers/uploader.php +++ b/modules/gallery/controllers/uploader.php @@ -51,7 +51,7 @@ class Uploader_Controller extends Controller { $file_validation = new Validation($_FILES); $file_validation->add_rules( "Filedata", "upload::valid", "upload::required", - "upload::type[gif,jpg,jpeg,png,flv,mp4,m4v]"); + "upload::type[" . implode(",", legal_file::get_extensions()) . "]"); if ($form->validate() && $file_validation->validate()) { $temp_filename = upload::save("Filedata"); diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css index 275a3d7d..ecf89565 100644 --- a/modules/gallery/css/gallery.css +++ b/modules/gallery/css/gallery.css @@ -29,12 +29,12 @@ #g-add-photos-canvas object, #g-add-photos-button { - left: 137px; - margin: .5em 0; + left: 90px; + margin: .5em 0; padding: .4em 1em; position: absolute; top: 0; - width: 175px; + width: 300px; } #g-add-photos-canvas object { diff --git a/modules/gallery/helpers/MY_num.php b/modules/gallery/helpers/MY_num.php index 9787044c..842a2ee3 100644 --- a/modules/gallery/helpers/MY_num.php +++ b/modules/gallery/helpers/MY_num.php @@ -37,4 +37,18 @@ class num extends num_Core { return $val; } + + /** + * Convert a size value as accepted by PHP's shorthand to bytes. + * ref: http://us2.php.net/manual/en/function.ini-get.php + * ref: http://us2.php.net/manual/en/faq.using.php#faq.using.shorthandbytes + */ + static function convert_to_human_readable($num) { + foreach (array("G" => 1e9, "M" => 1e6, "K" => 1e3) as $k => $v) { + if ($num > $v) { + $num = round($num / $v) . $k; + } + } + return $num; + } } diff --git a/modules/gallery/helpers/encoding.php b/modules/gallery/helpers/encoding.php new file mode 100644 index 00000000..7d5add34 --- /dev/null +++ b/modules/gallery/helpers/encoding.php @@ -0,0 +1,35 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2011 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 encoding_Core { + static function convert_to_utf8($value) { + if (function_exists("mb_detect_encoding")) { + // Rely on mb_detect_encoding()'s strict mode + $src_encoding = mb_detect_encoding($value, mb_detect_order(), true); + if ($src_encoding != "UTF-8") { + if (function_exists("mb_convert_encoding") && $src_encoding) { + $value = mb_convert_encoding($value, "UTF-8", $src_encoding); + } else { + $value = utf8_encode($value); + } + } + } + return $value; + } +}
\ No newline at end of file diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 1fafdef7..cbd9b33c 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -193,19 +193,25 @@ class gallery_Core { */ static function version_string() { if (gallery::RELEASE_CHANNEL == "git") { + $build_number = gallery::build_number(); return sprintf( - "%s (branch %s build %s)", gallery::VERSION, gallery::RELEASE_BRANCH, - gallery::build_number()); + "%s (branch %s, %s)", gallery::VERSION, gallery::RELEASE_BRANCH, + $build_number ? " build $build_number" : "unknown build number"); } else { return sprintf("%s (%s)", gallery::VERSION, gallery::CODE_NAME); } } /** - * Return the contents of the .build_number file, which should be a single integer. + * Return the contents of the .build_number file, which should be a single integer + * or return null if the .build_number file is missing. */ static function build_number() { - $result = parse_ini_file(DOCROOT . ".build_number"); - return $result["build_number"]; + $build_file = DOCROOT . ".build_number"; + if (file_exists($build_file)) { + $result = parse_ini_file(DOCROOT . ".build_number"); + return $result["build_number"]; + } + return null; } }
\ No newline at end of file diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index b9ccf25b..49d16246 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -82,9 +82,13 @@ class gallery_block_Core { break; case "block_adder": - $block->css_id = "g-block-adder"; - $block->title = t("Dashboard content"); - $block->content = gallery_block::get_add_block_form(); + if ($form = gallery_block::get_add_block_form()) { + $block->css_id = "g-block-adder"; + $block->title = t("Dashboard content"); + $block->content = $form; + } else { + $block = ""; + } break; case "language": @@ -112,16 +116,28 @@ class gallery_block_Core { $block->content->version_info = upgrade_checker::version_info(); $block->content->auto_check_enabled = upgrade_checker::auto_check_enabled(); $block->content->new_version = upgrade_checker::get_upgrade_message(); + $block->content->build_number = gallery::build_number(); } return $block; } static function get_add_block_form() { + $available_blocks = block_manager::get_available_admin_blocks(); + + $active = array(); + foreach (array_merge(block_manager::get_active("dashboard_sidebar"), + block_manager::get_active("dashboard_center")) as $b) { + unset($available_blocks[implode(":", $b)]); + } + + if (!$available_blocks) { + return; + } + $form = new Forge("admin/dashboard/add_block", "", "post", array("id" => "g-add-dashboard-block-form")); $group = $form->group("add_block")->label(t("Add Block")); - $group->dropdown("id")->label(t("Available Blocks")) - ->options(block_manager::get_available_admin_blocks()); + $group->dropdown("id")->label(t("Available blocks"))->options($available_blocks); $group->submit("center")->value(t("Add to center")); $group->submit("sidebar")->value(t("Add to sidebar")); return $form; diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 07817187..fbdb4ad5 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -539,9 +539,9 @@ class gallery_event_Core { $v = new View("user_profile_info.html"); $fields = array("name" => t("Name"), "locale" => t("Language Preference"), - "email" => t("Email"), "full_name" => t("Full name"), "url" => "Web site"); + "email" => t("Email"), "full_name" => t("Full name"), "url" => t("Web site")); if (!$data->user->guest) { - $fields = array("name" => t("Name"), "full_name" => t("Full name"), "url" => "Web site"); + $fields = array("name" => t("Name"), "full_name" => t("Full name"), "url" => t("Web site")); } $v->user_profile_data = array(); foreach ($fields as $field => $label) { @@ -549,6 +549,8 @@ class gallery_event_Core { $value = $data->user->$field; if ($field == "locale") { $value = locales::display_name($value); + } elseif ($field == "url") { + $value = html::mark_clean(html::anchor($data->user->$field)); } $v->user_profile_data[(string) $label] = $value; } diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 01c59eaa..7a9af402 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -304,14 +304,16 @@ class gallery_installer { module::set_var("gallery", "maintenance_mode", 0); module::set_var("gallery", "visible_title_length", 15); module::set_var("gallery", "favicon_url", "lib/images/favicon.ico"); + module::set_var("gallery", "apple_touch_icon_url", "lib/images/apple-touch-icon.png"); module::set_var("gallery", "email_from", ""); module::set_var("gallery", "email_reply_to", ""); module::set_var("gallery", "email_line_length", 70); module::set_var("gallery", "email_header_separator", serialize("\n")); module::set_var("gallery", "show_user_profiles_to", "registered_users"); module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin"); + module::set_var("gallery", "timezone", null); - module::set_version("gallery", 46); + module::set_version("gallery", 49); } static function upgrade($version) { @@ -677,6 +679,19 @@ class gallery_installer { module::set_var("gallery", "upgrade_checker_auto_enabled", true); module::set_version("gallery", $version = 46); } + + if ($version == 46) { + module::set_var("gallery", "apple_touch_icon_url", "lib/images/apple-touch-icon.png"); + module::set_version("gallery", $version = 47); + } + + if ($version == 47 || $version == 48) { + // Add configuration variable to set timezone. Defaults to the currently + // used timezone (from PHP configuration). Note that in v48 we werew + // setting this value incorrectly, so we're going to stomp this value for v49. + module::set_var("gallery", "timezone", null); + module::set_version("gallery", $version = 49); + } } static function uninstall() { diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php index 612872e6..9af67118 100644 --- a/modules/gallery/helpers/gallery_rss.php +++ b/modules/gallery/helpers/gallery_rss.php @@ -21,6 +21,14 @@ class gallery_rss_Core { static function available_feeds($item, $tag) { $feeds["gallery/latest"] = t("Latest photos and movies"); + + if ($item) { + $feed_item = $item -> is_album() ? $item : $item->parent(); + + $feeds["gallery/album/{$feed_item->id}"] = + t("%title photos and movies", array("title" => $feed_item->title)); + } + return $feeds; } diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index c4a82390..e07839d9 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -64,7 +64,7 @@ class gallery_theme_Core { if ($session->get("l10n_mode", false)) { $buf .= $theme->css("l10n_client.css"); $buf .= $theme->script("jquery.cookie.js"); - $buf .=$theme->script("l10n_client.js"); + $buf .= $theme->script("l10n_client.js"); } return $buf; } diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index 04501132..3548faa1 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -176,17 +176,25 @@ class graphics_Core { } if (!empty($ops["thumb"])) { + if (file_exists($item->thumb_path())) { + $item->thumb_dirty = 0; + } else { + copy(MODPATH . "gallery/images/missing_photo.png", $item->thumb_path()); + } $dims = getimagesize($item->thumb_path()); $item->thumb_width = $dims[0]; $item->thumb_height = $dims[1]; - $item->thumb_dirty = 0; } if (!empty($ops["resize"])) { + if (file_exists($item->resize_path())) { + $item->resize_dirty = 0; + } else { + copy(MODPATH . "gallery/images/missing_photo.png", $item->resize_path()); + } $dims = getimagesize($item->resize_path()); $item->resize_width = $dims[0]; $item->resize_height = $dims[1]; - $item->resize_dirty = 0; } $item->save(); } catch (Exception $e) { @@ -316,10 +324,10 @@ class graphics_Core { // ImageMagick & GraphicsMagick $magick_kits = array( "imagemagick" => array( - "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v", + "name" => "ImageMagick", "binary" => "convert", "version_arg" => "-v", "version_regex" => "/Version: \S+ (\S+)/"), "graphicsmagick" => array( - "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version", + "name" => "GraphicsMagick", "binary" => "gm", "version_arg" => "version", "version_regex" => "/\S+ (\S+)/")); // Loop through the kits foreach ($magick_kits as $index => $settings) { @@ -328,7 +336,8 @@ class graphics_Core { $toolkits->$index->name = $settings["name"]; if ($path) { if (@is_file($path) && - preg_match($settings["version_regex"], shell_exec($settings["version"]), $matches)) { + preg_match( + $settings["version_regex"], shell_exec($path . " " . $settings["version_arg"]), $matches)) { $version = $matches[1]; $toolkits->$index->installed = true; @@ -423,4 +432,23 @@ class graphics_Core { return true; } + + /** + * Return the max file size that this graphics toolkit can handle. + */ + static function max_filesize() { + if (module::get_var("gallery", "graphics_toolkit") == "gd") { + $memory_limit = trim(ini_get("memory_limit")); + $memory_limit_bytes = num::convert_to_bytes($memory_limit); + + // GD expands images in memory and uses 4 bytes of RAM for every byte + // in the file. + $max_filesize = $memory_limit_bytes / 4; + $max_filesize_human_readable = num::convert_to_human_readable($max_filesize); + return array($max_filesize, $max_filesize_human_readable); + } + + // Some arbitrarily large size + return array(1000000000, "1G"); + } } diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php index 1a5c631e..494c6db4 100644 --- a/modules/gallery/helpers/item.php +++ b/modules/gallery/helpers/item.php @@ -152,8 +152,18 @@ class item_Core { * @param string $filename */ static function convert_filename_to_slug($filename) { - $result = pathinfo($filename, PATHINFO_FILENAME); + $result = str_replace("&", "-and-", $filename); + $result = str_replace(" ", "-", $result); + + // It's not easy to extend the text helper since it's called by the Input class which is + // referenced in hooks/init_gallery, so it's + if (class_exists("transliterate")) { + $result = transliterate::utf8_to_ascii($result); + } else { + $result = text::transliterate_to_ascii($result); + } $result = preg_replace("/[^A-Za-z0-9-_]+/", "-", $result); + $result = preg_replace("/-+/", "-", $result); return trim($result, "-"); } @@ -392,4 +402,21 @@ class item_Core { return $position; } + + /** + * Set the display context callback for any future item renders. + */ + static function set_display_context_callback() { + Cache::instance()->set("display_context_" . $sid = Session::instance()->id(), func_get_args()); + } + + /** + * Call the display context callback for the given item + */ + static function get_display_context($item) { + $args = Cache::instance()->get("display_context_" . $sid = Session::instance()->id()); + $callback = $args[0]; + $args[0] = $item; + return call_user_func_array($callback, $args); + } }
\ No newline at end of file diff --git a/modules/gallery/helpers/legal_file.php b/modules/gallery/helpers/legal_file.php new file mode 100644 index 00000000..6f66c85c --- /dev/null +++ b/modules/gallery/helpers/legal_file.php @@ -0,0 +1,83 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2011 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 legal_file_Core { + /** + * Create a default list of allowed photo extensions and then let modules modify it. + */ + static function get_photo_extensions() { + $extensions_wrapper = new stdClass(); + $extensions_wrapper->extensions = array("gif", "jpg", "jpeg", "png"); + module::event("legal_photo_extensions", $extensions_wrapper); + return $extensions_wrapper->extensions; + } + + /** + * Create a default list of allowed movie extensions and then let modules modify it. + */ + static function get_movie_extensions() { + $extensions_wrapper = new stdClass(); + $extensions_wrapper->extensions = array("flv", "mp4", "m4v"); + module::event("legal_movie_extensions", $extensions_wrapper); + return $extensions_wrapper->extensions; + } + + /** + * Create a merged list of all allowed photo and movie extensions. + */ + static function get_extensions() { + $extensions = legal_file::get_photo_extensions(); + if (movie::find_ffmpeg()) { + $extensions = array_merge($extensions, legal_file::get_movie_extensions()); + } + return $extensions; + } + + /** + * Create a merged list of all photo and movie filename filters, + * (e.g. "*.gif"), based on allowed extensions. + */ + static function get_filters() { + $filters = array(); + foreach (legal_file::get_extensions() as $extension) { + array_push($filters, "*." . $extension, "*." . strtoupper($extension)); + } + return $filters; + } + + /** + * Create a default list of allowed photo MIME types and then let modules modify it. + */ + static function get_photo_types() { + $types_wrapper = new stdClass(); + $types_wrapper->types = array("image/jpeg", "image/gif", "image/png"); + module::event("legal_photo_types", $types_wrapper); + return $types_wrapper->types; + } + + /** + * Create a default list of allowed movie MIME types and then let modules modify it. + */ + static function get_movie_types() { + $types_wrapper = new stdClass(); + $types_wrapper->types = array("video/flv", "video/x-flv", "video/mp4"); + module::event("legal_movie_types", $types_wrapper); + return $types_wrapper->types; + } +} diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index 37f7f68a..4b7d4a5f 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -101,7 +101,7 @@ class module_Core { $m->locked = false; if ($m->active && $m->version != $m->code_version) { - site_status::warning(t("Some of your modules are out of date. <a href=\"%upgrader_url\">Upgrade now!</a>", array("upgrader_url" => url::site("upgrader"))), "upgrade_now"); + site_status::warning(t("Some of your modules are out of date. <a href=\"%upgrader_url\">Upgrade now!</a>", array("upgrader_url" => url::abs_site("upgrader"))), "upgrade_now"); } } diff --git a/modules/gallery/helpers/random.php b/modules/gallery/helpers/random.php index 6016df7b..06542e8c 100644 --- a/modules/gallery/helpers/random.php +++ b/modules/gallery/helpers/random.php @@ -19,7 +19,7 @@ */ class random_Core { /** - * Return a random 32 bit hash value. + * Return a random 32 byte hash value. * @param string extra entropy data */ static function hash($entropy="") { @@ -27,14 +27,6 @@ class random_Core { } /** - * Return a random hexadecimal string of the given length. - * @param int the desired length of the string - */ - static function string($length) { - return substr(random::hash(), 0, $length); - } - - /** * Return a random floating point number between 0 and 1 */ static function percent() { diff --git a/modules/gallery/helpers/system.php b/modules/gallery/helpers/system.php index c39c7227..4110b4ed 100644 --- a/modules/gallery/helpers/system.php +++ b/modules/gallery/helpers/system.php @@ -40,4 +40,25 @@ class system_Core { } return null; } + + /** + * Create a file with a unique file name. + * This helper is similar to the built-in tempnam. + * It allows the caller to specify a prefix and an extension. + * It always places the file in TMPPATH. + */ + static function temp_filename($prefix="", $extension="") { + do { + $basename = tempnam(TMPPATH, $prefix); + if (!$basename) { + return false; + } + $filename = "$basename.$extension"; + $success = !file_exists($filename) && @rename($basename, $filename); + if (!$success) { + @unlink($basename); + } + } while (!$success); + return $filename; + } }
\ No newline at end of file diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index f285834c..37707f28 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -41,11 +41,34 @@ class theme_Core { $config = Kohana_Config::instance(); $modules = $config->get("core.modules"); + + // Normally Router::find_uri() strips off the url suffix for us, but we're working off of the + // PATH_INFO here so we need to strip it off manually + if ($suffix = Kohana::config("core.url_suffix")) { + $path = preg_replace("#" . preg_quote($suffix) . "$#u", "", $path); + } + self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7); self::$site_theme_name = module::get_var("gallery", "active_site_theme"); + + // If the site theme doesn't exist, fall back to wind. + if (!file_exists(THEMEPATH . self::$site_theme_name . "/theme.info")) { + site_status::error(t("Theme '%name' is missing. Falling back to the Wind theme.", + array("name" => self::$site_theme_name)), "missing_site_theme"); + module::set_var("gallery", "active_site_theme", self::$site_theme_name = "wind"); + } + if (self::$is_admin) { // Load the admin theme self::$admin_theme_name = module::get_var("gallery", "active_admin_theme"); + + // If the admin theme doesn't exist, fall back to admin_wind. + if (!file_exists(THEMEPATH . self::$admin_theme_name . "/theme.info")) { + site_status::error(t("Admin theme '%name' is missing! Falling back to the Wind theme.", + array("name" => self::$admin_theme_name)), "missing_admin_theme"); + module::set_var("gallery", "active_admin_theme", self::$admin_theme_name = "admin_wind"); + } + array_unshift($modules, THEMEPATH . self::$admin_theme_name); // If the site theme has an admin subdir, load that as a module so that diff --git a/modules/gallery/images/missing_photo.png b/modules/gallery/images/missing_photo.png Binary files differnew file mode 100644 index 00000000..67786275 --- /dev/null +++ b/modules/gallery/images/missing_photo.png diff --git a/modules/gallery/libraries/Breadcrumb.php b/modules/gallery/libraries/Breadcrumb.php new file mode 100644 index 00000000..e151890d --- /dev/null +++ b/modules/gallery/libraries/Breadcrumb.php @@ -0,0 +1,70 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2011 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 Breadcrumb_Core { + public $title; + public $url; + public $first; + public $last; + + static function instance($title, $url) { + return new Breadcrumb($title, $url); + } + + public function __construct($title, $url) { + $this->title = $title; + $this->url = $url; + $this->first = false; + $this->last = false; + } + + /** + * Return an array of Breadcrumb instances build from the parents of a given item. + * The first and last Breadcrumb instances will be marked first/last as appropriate. + * Each breadcrumb will have a ?show= query parameter that refers to the id of the next + * item in line. + * + * @return array Breadcrumb instances + */ + static function array_from_item_parents($item) { + if ($item->id == item::root()->id) { + return array(); + } + + $bc = array_merge($item->parents()->as_array(), array($item)); + for ($i = 0; $i < count($bc) - 1; $i++) { + $bc[$i] = new Breadcrumb($bc[$i]->title, $bc[$i]->url("show={$bc[$i+1]->id}")); + } + $bc[$i] = new Breadcrumb($item->title, $item->url()); + + $bc[0]->set_first(); + end($bc)->set_last(); + return $bc; + } + + public function set_first() { + $this->first = true; + return $this; + } + + public function set_last() { + $this->last = true; + return $this; + } +} diff --git a/modules/gallery/libraries/Form_Uploadify.php b/modules/gallery/libraries/Form_Uploadify.php index 27ab9684..450320b3 100644 --- a/modules/gallery/libraries/Form_Uploadify.php +++ b/modules/gallery/libraries/Form_Uploadify.php @@ -47,7 +47,22 @@ class Form_Uploadify_Core extends Form_Input { $v->script_data = $this->data["script_data"]; $v->simultaneous_upload_limit = module::get_var("gallery", "simultaneous_upload_limit"); $v->movies_allowed = (bool) movie::find_ffmpeg(); + $v->extensions = legal_file::get_filters(); $v->suhosin_session_encrypt = (bool) ini_get("suhosin.session.encrypt"); + + list ($toolkit_max_filesize_bytes, $toolkit_max_filesize) = graphics::max_filesize(); + + $upload_max_filesize = trim(ini_get("upload_max_filesize")); + $upload_max_filesize_bytes = num::convert_to_bytes($upload_max_filesize); + + if ($upload_max_filesize_bytes < $toolkit_max_filesize_bytes) { + $v->size_limit_bytes = $upload_max_filesize_bytes; + $v->size_limit = $upload_max_filesize; + } else { + $v->size_limit_bytes = $toolkit_max_filesize_bytes; + $v->size_limit = $toolkit_max_filesize; + } + return $v; } diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 562f7929..e04b9169 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -31,6 +31,52 @@ class Gallery_View_Core extends View { } /** + * Set up the data and render a pager. + * + * See themes/wind/views/pager.html for documentation on the variables generated here. + */ + public function paginator() { + $v = new View("paginator.html"); + $v->page_type = $this->page_type; + $v->page_subtype = $this->page_subtype; + $v->first_page_url = null; + $v->previous_page_url = null; + $v->next_page_url = null; + $v->last_page_url = null; + + if ($this->page_type == "collection") { + $v->page = $this->page; + $v->max_pages = $this->max_pages; + $v->total = $this->children_count; + + if ($this->page != 1) { + $v->first_page_url = url::site(url::merge(array("page" => 1))); + $v->previous_page_url = url::site(url::merge(array("page" => $this->page - 1))); + } + + if ($this->page != $this->max_pages) { + $v->next_page_url = url::site(url::merge(array("page" => $this->page + 1))); + $v->last_page_url = url::site(url::merge(array("page" => $this->max_pages))); + } + + $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; + $v->last_visible_position = min($this->page * $this->page_size, $v->total); + } else if ($this->page_type == "item") { + $v->position = $this->position; + $v->total = $this->sibling_count; + if ($this->previous_item) { + $v->previous_page_url = $this->previous_item->url(); + } + + if ($this->next_item) { + $v->next_page_url = $this->next_item->url(); + } + } + + return $v; + } + + /** * Begin gather up scripts or css files so that they can be combined into a single request. * * @param $types a comma separated list of types to combine, eg "script,css" @@ -111,6 +157,8 @@ class Gallery_View_Core extends View { $contents = $cache->get($key); if (empty($contents)) { + module::event("before_combine", $type, $this->combine_queue[$type][$group]); + $contents = ""; foreach (array_keys($this->combine_queue[$type][$group]) as $path) { if ($type == "css") { @@ -120,6 +168,8 @@ class Gallery_View_Core extends View { } } + module::event("after_combine", $type, $contents); + $cache->set($key, $contents, array($type), 30 * 84600); $use_gzip = function_exists("gzencode") && @@ -128,9 +178,13 @@ class Gallery_View_Core extends View { $cache->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP), array($type, "gzip"), 30 * 84600); } + } unset($this->combine_queue[$type][$group]); + if (empty($this->combine_queue[$type])) { + unset($this->combine_queue[$type]); + } if ($type == "css") { return html::stylesheet("combined/css/$key", "screen,print,projection", true); @@ -158,6 +212,7 @@ class Gallery_View_Core extends View { $replace[] = "url('" . url::abs_file($relative) . "')"; } else { Kohana_Log::add("error", "Missing URL reference '{$match[1]}' in CSS file '$css_file'"); + } } $replace = str_replace(DIRECTORY_SEPARATOR, "/", $replace); diff --git a/modules/gallery/libraries/IdentityProvider.php b/modules/gallery/libraries/IdentityProvider.php index 153446e6..3f995923 100644 --- a/modules/gallery/libraries/IdentityProvider.php +++ b/modules/gallery/libraries/IdentityProvider.php @@ -110,11 +110,11 @@ class IdentityProvider_Core { Kohana_Log::add("error", "Error restoring original identity provider\n" . $e2->getMessage() . "\n" . $e2->getTraceAsString()); } - + message::error( t("Error attempting to enable \"%new_provider\" identity provider, reverted to \"%old_provider\" identity provider", array("new_provider" => $new_provider, "old_provider" => $current_provider))); - + $restore_already_running = false; } throw $e; @@ -260,14 +260,14 @@ class IdentityProvider_Core { /** * @see IdentityProvider_Driver::add_user_to_group. */ - public function add_user_to_group($user, $group_id) { - return $this->driver->add_user_to_group($user, $group_id); + public function add_user_to_group($user, $group) { + return $this->driver->add_user_to_group($user, $group); } /** * @see IdentityProvider_Driver::remove_user_to_group. */ - public function remove_user_from_group($user, $group_id) { - return $this->driver->remove_user_from_group($user, $group_id); + public function remove_user_from_group($user, $group) { + return $this->driver->remove_user_from_group($user, $group); } } // End Identity diff --git a/modules/gallery/libraries/InPlaceEdit.php b/modules/gallery/libraries/InPlaceEdit.php index 88c30494..739cbb61 100644 --- a/modules/gallery/libraries/InPlaceEdit.php +++ b/modules/gallery/libraries/InPlaceEdit.php @@ -56,8 +56,12 @@ class InPlaceEdit_Core { } public function validate() { - $post = Validation::factory($_POST) - ->add_callbacks("input", $this->callback); + $post = Validation::factory($_POST); + + if (!empty($this->callback)) { + $post->add_callbacks("input", $this->callback); + } + foreach ($this->rules as $rule) { $post->add_rules("input", $rule); } diff --git a/modules/gallery/libraries/Theme_View.php b/modules/gallery/libraries/Theme_View.php index d0b35d3e..13e58004 100644 --- a/modules/gallery/libraries/Theme_View.php +++ b/modules/gallery/libraries/Theme_View.php @@ -38,6 +38,7 @@ class Theme_View_Core extends Gallery_View { $this->item = null; $this->tag = null; $this->set_global(array("theme" => $this, + "theme_info" => theme::get_info($this->theme_name), "user" => identity::active_user(), "page_type" => $page_type, "page_subtype" => $page_subtype, @@ -142,52 +143,6 @@ class Theme_View_Core extends Gallery_View { } /** - * Set up the data and render a pager. - * - * See themes/wind/views/pager.html for documentation on the variables generated here. - */ - public function paginator() { - $v = new View("paginator.html"); - $v->page_type = $this->page_type; - $v->page_subtype = $this->page_subtype; - $v->first_page_url = null; - $v->previous_page_url = null; - $v->next_page_url = null; - $v->last_page_url = null; - - if ($this->page_type == "collection") { - $v->page = $this->page; - $v->max_pages = $this->max_pages; - $v->total = $this->children_count; - - if ($this->page != 1) { - $v->first_page_url = url::site(url::merge(array("page" => 1))); - $v->previous_page_url = url::site(url::merge(array("page" => $this->page - 1))); - } - - if ($this->page != $this->max_pages) { - $v->next_page_url = url::site(url::merge(array("page" => $this->page + 1))); - $v->last_page_url = url::site(url::merge(array("page" => $this->max_pages))); - } - - $v->first_visible_position = ($this->page - 1) * $this->page_size + 1; - $v->last_visible_position = min($this->page * $this->page_size, $v->total); - } else if ($this->page_type == "item") { - $v->position = $this->position; - $v->total = $this->sibling_count; - if ($this->previous_item) { - $v->previous_page_url = $this->previous_item->url(); - } - - if ($this->next_item) { - $v->next_page_url = $this->next_item->url(); - } - } - - return $v; - } - - /** * Print out any site wide status information. */ public function site_status() { diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php index 8f4bc5e4..93e97af6 100644 --- a/modules/gallery/models/item.php +++ b/modules/gallery/models/item.php @@ -336,9 +336,7 @@ class Item_Model_Core extends ORM_MPTT { // Make an url friendly slug from the name, if necessary if (empty($this->slug)) { - $tmp = pathinfo($this->name, PATHINFO_FILENAME); - $tmp = preg_replace("/[^A-Za-z0-9-_]+/", "-", $tmp); - $this->slug = trim($tmp, "-"); + $this->slug = item::convert_filename_to_slug(pathinfo($this->name, PATHINFO_FILENAME)); // If the filename is all invalid characters, then the slug may be empty here. Pick a // random value. @@ -410,6 +408,27 @@ class Item_Model_Core extends ORM_MPTT { // If any significant fields have changed, load up a copy of the original item and // keep it around. $original = ORM::factory("item", $this->id); + + // Preserve the extension of the data file. Many helpers, (e.g. ImageMagick), assume + // the MIME type from the extension. So when we adopt the new data file, it's important + // to adopt the new extension. That ensures that the item's extension is always + // appropriate for its data. We don't try to preserve the name of the data file, though, + // because the name is typically a temporary randomly-generated name. + if (isset($this->data_file)) { + $extension = pathinfo($this->data_file, PATHINFO_EXTENSION); + $new_name = pathinfo($this->name, PATHINFO_FILENAME) . ".$extension"; + if (!empty($extension) && strcmp($this->name, $new_name)) { + $this->name = $new_name; + } + if ($this->is_photo()) { + list ($this->width, $this->height, $this->mime_type, $extension) = + photo::get_file_metadata($this->data_file); + } else if ($this->is_movie()) { + list ($this->width, $this->height, $this->mime_type, $extension) = + movie::get_file_metadata($this->data_file); + } + } + if (array_intersect($this->changed, array("parent_id", "name", "slug"))) { $original->_build_relative_caches(); $this->relative_path_cache = null; @@ -431,8 +450,19 @@ class Item_Model_Core extends ORM_MPTT { } if ($original->parent_id != $this->parent_id || $original->name != $this->name) { + $this->_build_relative_caches(); + // If there is a data file, then we want to preserve both the old data and the new data. + // (Third-party event handlers would like access to both). The old data file will be + // accessible via the $original item, and the new one via $this item. But in that case, + // we don't want to rename the original as below, because the old data would end up being + // clobbered by the new data file. Also, the rename isn't necessary, because the new item + // data is coming from the data file anyway. So we only perform the rename if there isn't + // a data file. Another way to solve this would be to copy the original file rather than + // conditionally rename it, but a copy would cost far more than the rename. + if (!isset($this->data_file)) { + @rename($original->file_path(), $this->file_path()); + } // Move all of the items associated data files - @rename($original->file_path(), $this->file_path()); if ($this->is_album()) { @rename(dirname($original->resize_path()), dirname($this->resize_path())); @rename(dirname($original->thumb_path()), dirname($this->thumb_path())); @@ -462,8 +492,6 @@ class Item_Model_Core extends ORM_MPTT { } // Replace the data file, if requested. - // @todo: we don't handle the case where you swap in a file of a different mime type - // should we prevent that in validation? or in set_data_file() if ($this->data_file && ($this->is_photo() || $this->is_movie())) { copy($this->data_file, $this->file_path()); @@ -483,6 +511,9 @@ class Item_Model_Core extends ORM_MPTT { // Null out the data file variable here, otherwise this event will trigger another // save() which will think that we're doing another file move. $this->data_file = null; + if ($original->file_path() != $this->file_path()) { + @unlink($original->file_path()); + } module::event("item_updated_data_file", $this); } } @@ -519,6 +550,8 @@ class Item_Model_Core extends ORM_MPTT { $this->name = "$base_name-$rand"; } $this->slug = "$base_slug-$rand"; + $this->relative_path_cache = null; + $this->relative_url_cache = null; } } @@ -770,16 +803,7 @@ class Item_Model_Core extends ORM_MPTT { } if ($this->is_movie() || $this->is_photo()) { - if ($this->loaded()) { - // Existing items can't change their extension - $original = ORM::factory("item", $this->id); - $new_ext = pathinfo($this->name, PATHINFO_EXTENSION); - $old_ext = pathinfo($original->name, PATHINFO_EXTENSION); - if (strcasecmp($new_ext, $old_ext)) { - $v->add_error("name", "illegal_data_file_extension"); - return; - } - } else { + if (!$this->loaded()) { // New items must have an extension $ext = pathinfo($this->name, PATHINFO_EXTENSION); if (!$ext) { @@ -787,9 +811,10 @@ class Item_Model_Core extends ORM_MPTT { return; } - if ($this->is_movie() && !preg_match("/^(flv|mp4|m4v)$/i", $ext)) { - $v->add_error("name", "illegal_data_file_extension"); - } else if ($this->is_photo() && !preg_match("/^(gif|jpg|jpeg|png)$/i", $ext)) { + if ($this->is_photo() && + !in_array(strtolower($ext), array_map("strtolower", legal_file::get_photo_extensions())) || + $this->is_movie() && + !in_array(strtolower($ext), array_map("strtolower", legal_file::get_movie_extensions()))) { $v->add_error("name", "illegal_data_file_extension"); } } @@ -815,17 +840,6 @@ class Item_Model_Core extends ORM_MPTT { } else if (filesize($this->data_file) == 0) { $v->add_error("name", "empty_data_file"); } - - if ($this->loaded()) { - if ($this->is_photo()) { - list ($a, $b, $mime_type) = photo::get_file_metadata($this->data_file); - } else if ($this->is_movie()) { - list ($a, $b, $mime_type) = movie::get_file_metadata($this->data_file); - } - if ($mime_type != $this->mime_type) { - $v->add_error("name", "cant_change_mime_type"); - } - } } /** @@ -879,9 +893,9 @@ class Item_Model_Core extends ORM_MPTT { switch($field) { case "mime_type": if ($this->is_movie()) { - $legal_values = array("video/flv", "video/x-flv", "video/mp4"); - } if ($this->is_photo()) { - $legal_values = array("image/jpeg", "image/gif", "image/png"); + $legal_values = legal_file::get_movie_types(); + } else if ($this->is_photo()) { + $legal_values = legal_file::get_photo_types(); } break; diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 4c0c8866..42345531 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,7 @@ name = "Gallery 3" description = "Gallery core application" -version = 46 +version = 49 +author_name = "Gallery Team" +author_url = "http://codex.gallery2.org/Gallery:Team" +info_url = "http://codex.gallery2.org/Gallery3:Modules:gallery" +discuss_url = "http://gallery.menalto.com/forum_module_gallery" diff --git a/modules/gallery/tests/Albums_Controller_Test.php b/modules/gallery/tests/Albums_Controller_Test.php index d9983cc2..2ff017d7 100644 --- a/modules/gallery/tests/Albums_Controller_Test.php +++ b/modules/gallery/tests/Albums_Controller_Test.php @@ -31,7 +31,7 @@ class Albums_Controller_Test extends Gallery_Unit_Test_Case { $album = test::random_album(); // Randomize to avoid conflicts. - $new_name = "new_name_" . random::string(6); + $new_name = "new_name_" . test::random_string(6); $_POST["name"] = $new_name; $_POST["title"] = "new title"; diff --git a/modules/gallery/tests/Breadcrumb_Test.php b/modules/gallery/tests/Breadcrumb_Test.php new file mode 100644 index 00000000..ed2e5608 --- /dev/null +++ b/modules/gallery/tests/Breadcrumb_Test.php @@ -0,0 +1,36 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2011 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 Breadcrumb_Test extends Gallery_Unit_Test_Case { + private $album; + private $item; + + public function build_breadcrumbs_for_item_test() { + $album = test::random_album(); + $item = test::random_photo($album); + + $expected = array(); + $expected[] = Breadcrumb::instance( + item::root()->title, item::root()->url("show={$album->id}"))->set_first(); + $expected[] = + Breadcrumb::instance($album->title, $album->url("show={$item->id}")); + $expected[] = Breadcrumb::instance($item->title, $item->url())->set_last(); + $this->assert_equal($expected, Breadcrumb::array_from_item_parents($item)); + } +}
\ No newline at end of file diff --git a/modules/gallery/tests/File_Structure_Test.php b/modules/gallery/tests/File_Structure_Test.php index 69c4bbf9..1d1ff5ce 100644 --- a/modules/gallery/tests/File_Structure_Test.php +++ b/modules/gallery/tests/File_Structure_Test.php @@ -101,6 +101,7 @@ class File_Structure_Test extends Gallery_Unit_Test_Case { $expected_4 = array("<?php defined('SYSPATH') or die('No direct script access.');\n"); } else if (strpos($path, MODPATH . "forge") === 0 || strpos($path, MODPATH . "exif/lib") === 0 || + strpos($path, MODPATH . "gallery_unit_test/vendor") === 0 || strpos($path, MODPATH . "gallery/lib/HTMLPurifier") === 0 || $path == MODPATH . "user/lib/PasswordHash.php" || $path == DOCROOT . "var/database.php") { diff --git a/modules/gallery/tests/Gallery_Filters.php b/modules/gallery/tests/Gallery_Filters.php index e0208ed3..b008b593 100644 --- a/modules/gallery/tests/Gallery_Filters.php +++ b/modules/gallery/tests/Gallery_Filters.php @@ -38,6 +38,7 @@ class GalleryCodeFilterIterator extends FilterIterator { strpos($path_name, MODPATH . "forge") !== false || strpos($path_name, MODPATH . "gallery/views/kohana_error_page.php") !== false || strpos($path_name, MODPATH . "gallery/views/kohana_profiler.php") !== false || + strpos($path_name, MODPATH . "gallery_unit_test/vendor") !== false || strpos($path_name, MODPATH . "gallery_unit_test/views/kohana_error_page.php") !== false || strpos($path_name, MODPATH . "gallery_unit_test/views/kohana_unit_test_cli.php") !== false || strpos($path_name, MODPATH . "unit_test") !== false || diff --git a/modules/gallery/tests/Item_Helper_Test.php b/modules/gallery/tests/Item_Helper_Test.php index 4d5aed41..2fde7cc0 100644 --- a/modules/gallery/tests/Item_Helper_Test.php +++ b/modules/gallery/tests/Item_Helper_Test.php @@ -49,6 +49,10 @@ class Item_Helper_Test extends Gallery_Unit_Test_Case { public function convert_filename_to_slug_test() { $this->assert_equal("foo", item::convert_filename_to_slug("{[foo]}")); $this->assert_equal("foo-bar", item::convert_filename_to_slug("{[foo!@#!$@#^$@($!(@bar]}")); + $this->assert_equal("english-text", item::convert_filename_to_slug("english text")); + $this->assert_equal("new-line", item::convert_filename_to_slug("new \n line")); + $this->assert_equal("foo-and-bar", item::convert_filename_to_slug("foo&bar")); + $this->assert_equal("special", item::convert_filename_to_slug("šṗëçîąļ")); } public function move_test() { diff --git a/modules/gallery/tests/Item_Model_Test.php b/modules/gallery/tests/Item_Model_Test.php index 968d7510..19ab8ec4 100644 --- a/modules/gallery/tests/Item_Model_Test.php +++ b/modules/gallery/tests/Item_Model_Test.php @@ -394,15 +394,34 @@ class Item_Model_Test extends Gallery_Unit_Test_Case { $this->assert_equal(20337, filesize($photo->file_path())); } - public function replacement_data_file_must_be_same_mime_type_test() { + public function replace_data_file_type_test() { // Random photo is modules/gallery/tests/test.jpg $photo = test::random_photo(); + $this->assert_equal(1024, $photo->width); + $this->assert_equal(768, $photo->height); + $this->assert_equal(6232, filesize($photo->file_path())); + $this->assert_equal("image/jpeg", $photo->mime_type); + $orig_name = $photo->name; + + // Random photo is gallery/images/graphicsmagick.png is 104x76 and 1486 bytes $photo->set_data_file(MODPATH . "gallery/images/graphicsmagick.png"); + $photo->save(); + + $this->assert_equal(104, $photo->width); + $this->assert_equal(76, $photo->height); + $this->assert_equal(1486, filesize($photo->file_path())); + $this->assert_equal("image/png", $photo->mime_type); + $this->assert_equal("png", pathinfo($photo->name, PATHINFO_EXTENSION)); + $this->assert_equal(pathinfo($orig_name, PATHINFO_FILENAME), pathinfo($photo->name, PATHINFO_FILENAME)); + } + public function unsafe_data_file_replacement_test() { try { + $photo = test::random_photo(); + $photo->set_data_file(MODPATH . "gallery/tests/Item_Model_Test.php"); $photo->save(); } catch (ORM_Validation_Exception $e) { - $this->assert_same(array("name" => "cant_change_mime_type"), $e->validation->errors()); + $this->assert_same(array("mime_type" => "invalid"), $e->validation->errors()); return; // pass } $this->assert_true(false, "Shouldn't get here"); diff --git a/modules/gallery/tests/Num_Helper_Test.php b/modules/gallery/tests/Num_Helper_Test.php new file mode 100644 index 00000000..a22f9359 --- /dev/null +++ b/modules/gallery/tests/Num_Helper_Test.php @@ -0,0 +1,32 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2011 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 Num_Helper_Test extends Gallery_Unit_Test_Case { + public function convert_to_bytes_test() { + $this->assert_equal(5 * 1024, num::convert_to_bytes("5K")); + $this->assert_equal(3 * 1024*1024, num::convert_to_bytes("3M")); + $this->assert_equal(4 * 1024*1024*1024, num::convert_to_bytes("4G")); + } + + public function convert_to_human_readable_test() { + $this->assert_equal("6K", num::convert_to_human_readable(5615)); + $this->assert_equal("1M", num::convert_to_human_readable(1205615)); + $this->assert_equal("3G", num::convert_to_human_readable(3091205615)); + } +}
\ No newline at end of file diff --git a/modules/gallery/libraries/MY_Pagination.php b/modules/gallery/tests/System_Helper_Test.php index e697c0bd..b6c00f4c 100644 --- a/modules/gallery/libraries/MY_Pagination.php +++ b/modules/gallery/tests/System_Helper_Test.php @@ -17,19 +17,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -class Pagination extends Pagination_Core { - public function render($style=NULL) { - // Hide single page pagination - if ($this->auto_hide === TRUE AND $this->total_pages <= 1) { - return ""; - } - - if ($style === NULL) { - // Use default style - $style = $this->style; - } - - // Return rendered pagination view - return View::factory("pager.html", get_object_vars($this))->render(); +class System_Helper_Test extends Gallery_Unit_Test_Case { + public function temp_filename_test() { + $filename = system::temp_filename("file", "ext"); + $this->assert_true(file_exists($filename), "File not created"); + unlink($filename); + $this->assert_pattern($filename, "|/file.*\\.ext$|"); } } diff --git a/modules/gallery/tests/controller_auth_data.txt b/modules/gallery/tests/controller_auth_data.txt index f1192071..e35708c0 100644 --- a/modules/gallery/tests/controller_auth_data.txt +++ b/modules/gallery/tests/controller_auth_data.txt @@ -1,6 +1,7 @@ modules/comment/controllers/admin_manage_comments.php queue DIRTY_CSRF modules/comment/helpers/comment_rss.php feed DIRTY_AUTH modules/digibug/controllers/digibug.php print_proxy DIRTY_CSRF|DIRTY_AUTH +modules/g2_import/controllers/admin_g2_import.php autocomplete DIRTY_CSRF modules/g2_import/controllers/g2.php map DIRTY_CSRF modules/gallery/controllers/admin.php __call DIRTY_AUTH modules/gallery/controllers/albums.php index DIRTY_AUTH diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt index 0c812fb4..df087669 100644 --- a/modules/gallery/tests/xss_data.txt +++ b/modules/gallery/tests/xss_data.txt @@ -5,21 +5,22 @@ modules/comment/views/admin_block_recent_comments.html.php 4 DIRTY_ATTR text modules/comment/views/admin_block_recent_comments.html.php 5 DIRTY_ATTR $comment->author()->avatar_url(32,$theme->url(,true)) modules/comment/views/admin_block_recent_comments.html.php 10 DIRTY gallery::date_time($comment->created) modules/comment/views/admin_comments.html.php 5 DIRTY $form -modules/comment/views/admin_manage_comments.html.php 43 DIRTY $menu->render() -modules/comment/views/admin_manage_comments.html.php 107 DIRTY_ATTR $comment->id -modules/comment/views/admin_manage_comments.html.php 107 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/comment/views/admin_manage_comments.html.php 110 DIRTY_ATTR $comment->author()->avatar_url(40,$theme->url(,true)) -modules/comment/views/admin_manage_comments.html.php 123 DIRTY_JS $item->url() -modules/comment/views/admin_manage_comments.html.php 125 DIRTY_ATTR $item->thumb_url() -modules/comment/views/admin_manage_comments.html.php 127 DIRTY photo::img_dimensions($item->thumb_width,$item->thumb_height,75) -modules/comment/views/admin_manage_comments.html.php 135 DIRTY gallery::date($comment->created) -modules/comment/views/admin_manage_comments.html.php 142 DIRTY_JS $comment->id -modules/comment/views/admin_manage_comments.html.php 151 DIRTY_JS $comment->id -modules/comment/views/admin_manage_comments.html.php 160 DIRTY_JS $comment->id -modules/comment/views/admin_manage_comments.html.php 169 DIRTY_JS $comment->id -modules/comment/views/admin_manage_comments.html.php 176 DIRTY_JS $comment->id -modules/comment/views/admin_manage_comments.html.php 184 DIRTY_JS $comment->id -modules/comment/views/admin_manage_comments.html.php 197 DIRTY $pager +modules/comment/views/admin_manage_comments.html.php 45 DIRTY $menu->render() +modules/comment/views/admin_manage_comments_queue.html.php 40 DIRTY $theme->paginator() +modules/comment/views/admin_manage_comments_queue.html.php 55 DIRTY_ATTR $comment->id +modules/comment/views/admin_manage_comments_queue.html.php 55 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/comment/views/admin_manage_comments_queue.html.php 58 DIRTY_ATTR $comment->author()->avatar_url(40,$fallback_avatar_url) +modules/comment/views/admin_manage_comments_queue.html.php 75 DIRTY_JS $item->url() +modules/comment/views/admin_manage_comments_queue.html.php 77 DIRTY_ATTR $item->thumb_url() +modules/comment/views/admin_manage_comments_queue.html.php 79 DIRTY photo::img_dimensions($item->thumb_width,$item->thumb_height,75) +modules/comment/views/admin_manage_comments_queue.html.php 87 DIRTY gallery::date($comment->created) +modules/comment/views/admin_manage_comments_queue.html.php 94 DIRTY_JS $comment->id +modules/comment/views/admin_manage_comments_queue.html.php 103 DIRTY_JS $comment->id +modules/comment/views/admin_manage_comments_queue.html.php 116 DIRTY_JS $comment->id +modules/comment/views/admin_manage_comments_queue.html.php 125 DIRTY_JS $comment->id +modules/comment/views/admin_manage_comments_queue.html.php 132 DIRTY_JS $comment->id +modules/comment/views/admin_manage_comments_queue.html.php 141 DIRTY_JS $comment->id +modules/comment/views/admin_manage_comments_queue.html.php 155 DIRTY $theme->paginator() modules/comment/views/comment.html.php 2 DIRTY_ATTR $comment->id; modules/comment/views/comment.html.php 5 DIRTY_ATTR $comment->author()->avatar_url(40,$theme->url(,true)) modules/comment/views/comment.mrss.php 10 DIRTY $feed->uri @@ -42,7 +43,8 @@ modules/digibug/views/digibug_form.html.php 4 DIRTY form:: modules/digibug/views/digibug_form.html.php 6 DIRTY form::hidden($key,$value) modules/exif/views/exif_dialog.html.php 14 DIRTY $details[$i]["caption"] modules/exif/views/exif_dialog.html.php 21 DIRTY $details[$i]["caption"] -modules/g2_import/views/admin_g2_import.html.php 9 DIRTY $form +modules/g2_import/views/admin_g2_import.html.php 7 DIRTY_JS url::site("__ARGS__") +modules/g2_import/views/admin_g2_import.html.php 52 DIRTY $form modules/gallery/views/admin_advanced_settings.html.php 21 DIRTY_ATTR text::alternate("g-odd","g-even") modules/gallery/views/admin_advanced_settings.html.php 22 DIRTY $var->module_name modules/gallery/views/admin_block_log_entries.html.php 4 DIRTY_ATTR log::severity_class($entry->severity) @@ -77,30 +79,35 @@ modules/gallery/views/admin_languages.html.php 62 DIRTY form:: modules/gallery/views/admin_languages.html.php 63 DIRTY $display_name modules/gallery/views/admin_languages.html.php 65 DIRTY form::radio("default_locale",$code,($default_locale==$code),((isset($installed_locales[$code]))?'':'disabled="disabled"')) modules/gallery/views/admin_languages.html.php 113 DIRTY $share_translations_form -modules/gallery/views/admin_maintenance.html.php 40 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_maintenance.html.php 40 DIRTY_ATTR log::severity_class($task->severity) -modules/gallery/views/admin_maintenance.html.php 41 DIRTY_ATTR log::severity_class($task->severity) -modules/gallery/views/admin_maintenance.html.php 42 DIRTY $task->name -modules/gallery/views/admin_maintenance.html.php 45 DIRTY $task->description -modules/gallery/views/admin_maintenance.html.php 86 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_maintenance.html.php 86 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" -modules/gallery/views/admin_maintenance.html.php 87 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" -modules/gallery/views/admin_maintenance.html.php 88 DIRTY gallery::date_time($task->updated) -modules/gallery/views/admin_maintenance.html.php 91 DIRTY $task->name -modules/gallery/views/admin_maintenance.html.php 106 DIRTY $task->status -modules/gallery/views/admin_maintenance.html.php 162 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_maintenance.html.php 162 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" -modules/gallery/views/admin_maintenance.html.php 163 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" -modules/gallery/views/admin_maintenance.html.php 164 DIRTY gallery::date_time($task->updated) -modules/gallery/views/admin_maintenance.html.php 167 DIRTY $task->name -modules/gallery/views/admin_maintenance.html.php 179 DIRTY $task->status +modules/gallery/views/admin_maintenance.html.php 42 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_maintenance.html.php 42 DIRTY_ATTR log::severity_class($task->severity) +modules/gallery/views/admin_maintenance.html.php 43 DIRTY_ATTR log::severity_class($task->severity) +modules/gallery/views/admin_maintenance.html.php 44 DIRTY $task->name +modules/gallery/views/admin_maintenance.html.php 47 DIRTY $task->description +modules/gallery/views/admin_maintenance.html.php 88 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_maintenance.html.php 88 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" +modules/gallery/views/admin_maintenance.html.php 89 DIRTY_ATTR $task->state=="stalled"?"g-warning":"" +modules/gallery/views/admin_maintenance.html.php 90 DIRTY gallery::date_time($task->updated) +modules/gallery/views/admin_maintenance.html.php 93 DIRTY $task->name +modules/gallery/views/admin_maintenance.html.php 108 DIRTY $task->status +modules/gallery/views/admin_maintenance.html.php 164 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_maintenance.html.php 164 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" +modules/gallery/views/admin_maintenance.html.php 165 DIRTY_ATTR $task->state=="success"?"g-success":"g-error" +modules/gallery/views/admin_maintenance.html.php 166 DIRTY gallery::date_time($task->updated) +modules/gallery/views/admin_maintenance.html.php 169 DIRTY $task->name +modules/gallery/views/admin_maintenance.html.php 181 DIRTY $task->status modules/gallery/views/admin_maintenance_show_log.html.php 8 DIRTY_JS url::site("admin/maintenance/save_log/$task->id?csrf=$csrf") modules/gallery/views/admin_maintenance_show_log.html.php 13 DIRTY $task->name modules/gallery/views/admin_maintenance_task.html.php 75 DIRTY $task->name modules/gallery/views/admin_modules.html.php 51 DIRTY access::csrf_form_field() -modules/gallery/views/admin_modules.html.php 60 DIRTY_ATTR text::alternate("g-odd","g-even") -modules/gallery/views/admin_modules.html.php 63 DIRTY form::checkbox($data,'1',module::is_active($module_name)) -modules/gallery/views/admin_modules.html.php 65 DIRTY $module_info->version +modules/gallery/views/admin_modules.html.php 61 DIRTY_ATTR text::alternate("g-odd","g-even") +modules/gallery/views/admin_modules.html.php 64 DIRTY form::checkbox($data,'1',module::is_active($module_name)) +modules/gallery/views/admin_modules.html.php 66 DIRTY $module_info->version +modules/gallery/views/admin_modules.html.php 74 DIRTY_JS $module_info->author_url +modules/gallery/views/admin_modules.html.php 81 DIRTY_ATTR $module_info->author_name +modules/gallery/views/admin_modules.html.php 85 DIRTY $module_info->author_name +modules/gallery/views/admin_modules.html.php 93 DIRTY_JS $module_info->info_url +modules/gallery/views/admin_modules.html.php 106 DIRTY_JS $module_info->discuss_url modules/gallery/views/admin_modules_confirm.html.php 11 DIRTY_ATTR $css_class modules/gallery/views/admin_modules_confirm.html.php 11 DIRTY $message modules/gallery/views/admin_modules_confirm.html.php 16 DIRTY access::csrf_form_field() @@ -114,12 +121,17 @@ modules/gallery/views/admin_themes.html.php 3 DIRTY_JS url::s modules/gallery/views/admin_themes.html.php 5 DIRTY_JS $csrf modules/gallery/views/admin_themes.html.php 22 DIRTY $themes[$site]->name modules/gallery/views/admin_themes.html.php 24 DIRTY $themes[$site]->description -modules/gallery/views/admin_themes.html.php 38 DIRTY $info->name -modules/gallery/views/admin_themes.html.php 40 DIRTY $info->description -modules/gallery/views/admin_themes.html.php 60 DIRTY $themes[$admin]->name -modules/gallery/views/admin_themes.html.php 62 DIRTY $themes[$admin]->description -modules/gallery/views/admin_themes.html.php 76 DIRTY $info->name -modules/gallery/views/admin_themes.html.php 78 DIRTY $info->description +modules/gallery/views/admin_themes.html.php 39 DIRTY $info->name +modules/gallery/views/admin_themes.html.php 41 DIRTY $info->description +modules/gallery/views/admin_themes.html.php 62 DIRTY $themes[$admin]->name +modules/gallery/views/admin_themes.html.php 64 DIRTY $themes[$admin]->description +modules/gallery/views/admin_themes.html.php 79 DIRTY $info->name +modules/gallery/views/admin_themes.html.php 81 DIRTY $info->description +modules/gallery/views/admin_themes_buttonset.html.php 7 DIRTY_JS $info['author_url'] +modules/gallery/views/admin_themes_buttonset.html.php 14 DIRTY_ATTR $info['author_name'] +modules/gallery/views/admin_themes_buttonset.html.php 18 DIRTY $info['author_name'] +modules/gallery/views/admin_themes_buttonset.html.php 26 DIRTY_JS $info['info_url'] +modules/gallery/views/admin_themes_buttonset.html.php 39 DIRTY_JS $info['discuss_url'] modules/gallery/views/admin_themes_preview.html.php 8 DIRTY_ATTR $url modules/gallery/views/error_404.html.php 14 DIRTY $login_form modules/gallery/views/error_admin.html.php 178 DIRTY @gallery_block::get("platform_info") @@ -172,9 +184,11 @@ modules/gallery/views/form_uploadify.html.php 16 DIRTY_JS url::s modules/gallery/views/form_uploadify.html.php 24 DIRTY_JS $flash_minimum_version modules/gallery/views/form_uploadify.html.php 28 DIRTY_JS url::file("lib/uploadify/uploadify.swf") modules/gallery/views/form_uploadify.html.php 29 DIRTY_JS url::site("uploader/add_photo/{$album->id}") +modules/gallery/views/form_uploadify.html.php 31 DIRTY_JS implode(";",$extensions) modules/gallery/views/form_uploadify.html.php 33 DIRTY_JS url::file("lib/uploadify/cancel.png") modules/gallery/views/form_uploadify.html.php 34 DIRTY_JS $simultaneous_upload_limit -modules/gallery/views/form_uploadify.html.php 160 DIRTY_ATTR request::protocol() +modules/gallery/views/form_uploadify.html.php 35 DIRTY_JS $size_limit_bytes +modules/gallery/views/form_uploadify.html.php 162 DIRTY_ATTR request::protocol() modules/gallery/views/in_place_edit.html.php 2 DIRTY form::open($action,array("method"=>"post","id"=>"g-in-place-edit-form","class"=>"g-short-form")) modules/gallery/views/in_place_edit.html.php 3 DIRTY access::csrf_form_field() modules/gallery/views/in_place_edit.html.php 6 DIRTY form::input("input",$form["input"]," class=\"textbox\"") @@ -248,7 +262,7 @@ modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $permi modules/gallery/views/permissions_form.html.php 80 DIRTY_JS $item->id modules/gallery/views/quick_delete_confirm.html.php 11 DIRTY $form modules/gallery/views/reauthenticate.html.php 9 DIRTY $form -modules/gallery/views/upgrade_checker_block.html.php 17 DIRTY $new_version +modules/gallery/views/upgrade_checker_block.html.php 19 DIRTY $new_version modules/gallery/views/upgrader.html.php 76 DIRTY_ATTR $done?"muted":"" modules/gallery/views/upgrader.html.php 94 DIRTY_ATTR $done?"muted":"" modules/gallery/views/upgrader.html.php 102 DIRTY_ATTR $module->version==$module->code_version?"current":"upgradeable" @@ -330,8 +344,9 @@ modules/search/views/search.html.php 27 DIRTY_ATTR $ite modules/search/views/search.html.php 28 DIRTY_JS $item->url() modules/search/views/search.html.php 29 DIRTY $item->thumb_img() modules/search/views/search.html.php 40 DIRTY $theme->paginator() -modules/server_add/views/admin_server_add.html.php 5 DIRTY $form -modules/server_add/views/admin_server_add.html.php 15 DIRTY_ATTR $id +modules/server_add/views/admin_server_add.html.php 8 DIRTY_JS url::site("__ARGS__") +modules/server_add/views/admin_server_add.html.php 19 DIRTY $form +modules/server_add/views/admin_server_add.html.php 30 DIRTY_ATTR $id 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)?"g-directory":"g-file" modules/server_add/views/server_add_tree_dialog.html.php 3 DIRTY_JS url::site("server_add/children?path=__PATH__") @@ -354,7 +369,7 @@ modules/user/views/admin_users.html.php 73 DIRTY_ATTR $use modules/user/views/admin_users.html.php 74 DIRTY_ATTR $user->avatar_url(20,$theme->url(,true)) modules/user/views/admin_users.html.php 88 DIRTY ($user->last_login==0)?"":gallery::date($user->last_login) modules/user/views/admin_users.html.php 91 DIRTY db::build()->from("items")->where("owner_id","=",$user->id)->count_records() -modules/user/views/admin_users.html.php 113 DIRTY $pager +modules/user/views/admin_users.html.php 113 DIRTY $theme->paginator() modules/user/views/admin_users.html.php 132 DIRTY_ATTR $group->id modules/user/views/admin_users.html.php 132 DIRTY_ATTR ($group->special?"g-default-group":"") modules/user/views/admin_users.html.php 134 DIRTY $v @@ -365,31 +380,30 @@ modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $wid modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $height modules/watermark/views/admin_watermarks.html.php 20 DIRTY_ATTR $url themes/admin_wind/views/admin.html.php 4 DIRTY $theme->html_attributes() -themes/admin_wind/views/admin.html.php 31 DIRTY $theme->admin_head() -themes/admin_wind/views/admin.html.php 40 DIRTY_JS $theme->url() -themes/admin_wind/views/admin.html.php 45 DIRTY $theme->get_combined("script") -themes/admin_wind/views/admin.html.php 48 DIRTY $theme->get_combined("css") -themes/admin_wind/views/admin.html.php 52 DIRTY $theme->admin_page_top() -themes/admin_wind/views/admin.html.php 60 DIRTY $theme->admin_header_top() -themes/admin_wind/views/admin.html.php 61 DIRTY_JS item::root()->url() -themes/admin_wind/views/admin.html.php 64 DIRTY $theme->user_menu() -themes/admin_wind/views/admin.html.php 67 DIRTY $theme->admin_menu() -themes/admin_wind/views/admin.html.php 70 DIRTY $theme->admin_header_bottom() -themes/admin_wind/views/admin.html.php 77 DIRTY $content -themes/admin_wind/views/admin.html.php 83 DIRTY $sidebar -themes/admin_wind/views/admin.html.php 88 DIRTY $theme->admin_footer() -themes/admin_wind/views/admin.html.php 91 DIRTY $theme->admin_credits() -themes/admin_wind/views/admin.html.php 96 DIRTY $theme->admin_page_bottom() +themes/admin_wind/views/admin.html.php 34 DIRTY $theme->admin_head() +themes/admin_wind/views/admin.html.php 46 DIRTY_JS $theme->url() +themes/admin_wind/views/admin.html.php 51 DIRTY $theme->get_combined("css") +themes/admin_wind/views/admin.html.php 54 DIRTY $theme->get_combined("script") +themes/admin_wind/views/admin.html.php 58 DIRTY $theme->admin_page_top() +themes/admin_wind/views/admin.html.php 66 DIRTY $theme->admin_header_top() +themes/admin_wind/views/admin.html.php 67 DIRTY_JS item::root()->url() +themes/admin_wind/views/admin.html.php 70 DIRTY $theme->user_menu() +themes/admin_wind/views/admin.html.php 73 DIRTY $theme->admin_menu() +themes/admin_wind/views/admin.html.php 76 DIRTY $theme->admin_header_bottom() +themes/admin_wind/views/admin.html.php 83 DIRTY $content +themes/admin_wind/views/admin.html.php 89 DIRTY $sidebar +themes/admin_wind/views/admin.html.php 94 DIRTY $theme->admin_footer() +themes/admin_wind/views/admin.html.php 97 DIRTY $theme->admin_credits() +themes/admin_wind/views/admin.html.php 102 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/admin_wind/views/paginator.html.php 35 DIRTY_JS $first_page_url +themes/admin_wind/views/paginator.html.php 44 DIRTY_JS $previous_page_url +themes/admin_wind/views/paginator.html.php 70 DIRTY_JS $next_page_url +themes/admin_wind/views/paginator.html.php 79 DIRTY_JS $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() @@ -414,19 +428,19 @@ themes/wind/views/page.html.php 4 DIRTY $theme themes/wind/views/page.html.php 10 DIRTY $page_title themes/wind/views/page.html.php 13 DIRTY $theme->item()->title themes/wind/views/page.html.php 17 DIRTY item::root()->title -themes/wind/views/page.html.php 31 DIRTY $new_width -themes/wind/views/page.html.php 32 DIRTY $new_height -themes/wind/views/page.html.php 33 DIRTY $thumb_proportion -themes/wind/views/page.html.php 70 DIRTY_JS $theme->url() -themes/wind/views/page.html.php 75 DIRTY $theme->get_combined("script") -themes/wind/views/page.html.php 78 DIRTY $theme->get_combined("css") -themes/wind/views/page.html.php 88 DIRTY $header_text -themes/wind/views/page.html.php 90 DIRTY_JS item::root()->url() -themes/wind/views/page.html.php 94 DIRTY $theme->user_menu() -themes/wind/views/page.html.php 115 DIRTY_JS $parent->url($parent->id==$theme->item()->parent_id?"show={$theme->item()->id}":null) -themes/wind/views/page.html.php 136 DIRTY $content -themes/wind/views/page.html.php 142 DIRTY newView("sidebar.html") -themes/wind/views/page.html.php 149 DIRTY $footer_text +themes/wind/views/page.html.php 32 DIRTY $new_width +themes/wind/views/page.html.php 33 DIRTY $new_height +themes/wind/views/page.html.php 34 DIRTY $thumb_proportion +themes/wind/views/page.html.php 74 DIRTY_JS $theme->url() +themes/wind/views/page.html.php 79 DIRTY $theme->get_combined("css") +themes/wind/views/page.html.php 82 DIRTY $theme->get_combined("script") +themes/wind/views/page.html.php 92 DIRTY $header_text +themes/wind/views/page.html.php 94 DIRTY_JS item::root()->url() +themes/wind/views/page.html.php 98 DIRTY $theme->user_menu() +themes/wind/views/page.html.php 119 DIRTY_JS $parent->url($parent->id==$theme->item()->parent_id?"show={$theme->item()->id}":null) +themes/wind/views/page.html.php 140 DIRTY $content +themes/wind/views/page.html.php 146 DIRTY newView("sidebar.html") +themes/wind/views/page.html.php 153 DIRTY $footer_text themes/wind/views/paginator.html.php 33 DIRTY_JS $first_page_url themes/wind/views/paginator.html.php 42 DIRTY_JS $previous_page_url themes/wind/views/paginator.html.php 70 DIRTY_JS $next_page_url diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php index d8c96187..d3765d19 100644 --- a/modules/gallery/views/admin_block_welcome.html.php +++ b/modules/gallery/views/admin_block_welcome.html.php @@ -2,7 +2,7 @@ <p> <?= t("This is your administration dashboard and it provides a quick overview of status messages, recent updates, and frequently used options. Add or remove blocks and rearrange them to tailor to your needs. The admin menu provides quick access to all of Gallery 3's options and settings. Here are a few of the most used options to get you started.") ?> </p> -<ul> +<ul class="g-text"> <li> <?= t("General Settings - choose your <a href=\"%graphics_url\">graphics</a> and <a href=\"%language_url\">language</a> settings.", array("graphics_url" => html::mark_clean(url::site("admin/graphics")), diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index 01d1ce3f..eef087e1 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -51,7 +51,7 @@ <? foreach ($available_locales as $code => $display_name): ?> <? if ($i == (int) (count($available_locales)/2)): ?> </table> - <table> + <table class="g-left"> <tr> <th> <?= t("Installed") ?> </th> <th> <?= t("Language") ?> </th> diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php index c28def1d..230e9353 100644 --- a/modules/gallery/views/admin_maintenance.html.php +++ b/modules/gallery/views/admin_maintenance.html.php @@ -3,7 +3,9 @@ <h1> <?= t("Maintenance") ?> </h1> <div class="g-block-content"> <div id="g-maintenance-mode"> + <p> <?= t("When you're performing maintenance on your Gallery, you can enable <b>maintenance mode</b> which prevents any non-admin from accessing your Gallery. Some of the tasks below will automatically put your Gallery in maintenance mode for you.") ?> + </p> <ul id="g-action-status" class="g-message-block"> <? if (module::get_var("gallery", "maintenance_mode")): ?> <li class="g-warning"> diff --git a/modules/gallery/views/admin_modules.html.php b/modules/gallery/views/admin_modules.html.php index f4ae965c..03993bb2 100644 --- a/modules/gallery/views/admin_modules.html.php +++ b/modules/gallery/views/admin_modules.html.php @@ -6,7 +6,7 @@ dataType: "json", success: function(data) { if (data.reload) { - window.location.reload(); + window.location = "<? url::site("/admin/modules") ?>"; } else { $("body").append('<div id="g-dialog">' + data.dialog + '</div>'); $("#g-dialog").dialog({ @@ -43,7 +43,7 @@ </script> <h1> <?= t("Gallery Modules") ?> </h1> <p> - <?= t("Power up your Gallery by adding more modules! Each module provides new cool features.") ?> + <?= t("Power up your Gallery by <a href=\"%url\">adding more modules</a>! Each module provides new cool features.", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Modules")) ?> </p> <div class="g-block-content"> @@ -55,6 +55,7 @@ <th style="width: 8em"> <?= t("Name") ?> </th> <th> <?= t("Version") ?> </th> <th> <?= t("Description") ?> </th> + <th style="width: 60px"> <?= t("Details") ?> </th> </tr> <? foreach ($available as $module_name => $module_info): ?> <tr class="<?= text::alternate("g-odd", "g-even") ?>"> @@ -64,6 +65,55 @@ <td> <?= t($module_info->name) ?> </td> <td> <?= $module_info->version ?> </td> <td> <?= t($module_info->description) ?> </td> + <td style="white-space: nowrap"> + <ul class="g-buttonset"> + <li> + <a target="_blank" + <? if (isset($module_info->author_url)): ?> + class="ui-state-default ui-icon ui-icon-person ui-corner-left" + href="<?= $module_info->author_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" + href="#" + <? endif ?> + + <? if (isset($module_info->author_name)): ?> + title="<?= $module_info->author_name ?>" + <? endif ?> + > + <? if (isset($module_info->author_name)): ?> + <?= $module_info->author_name ?> + <? endif ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($module_info->info_url)): ?> + class="ui-state-default ui-icon ui-icon-info" + href="<?= $module_info->info_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-info" + href="#" + <? endif ?> + > + <?= t("info") ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($module_info->discuss_url)): ?> + class="ui-state-default ui-icon ui-icon-comment ui-corner-right" + href="<?= $module_info->discuss_url ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" + href="#" + <? endif ?> + > + <?= t("discuss") ?> + </a> + </li> + </ul> + </td> </tr> <? endforeach ?> </table> diff --git a/modules/gallery/views/admin_themes.html.php b/modules/gallery/views/admin_themes.html.php index d14e8bd4..9d53779f 100644 --- a/modules/gallery/views/admin_themes.html.php +++ b/modules/gallery/views/admin_themes.html.php @@ -10,7 +10,7 @@ <div class="g-block ui-helper-clearfix"> <h1> <?= t("Theme choice") ?> </h1> <p> - <?= t("Gallery allows you to choose a theme for browsing your Gallery, as well as a special theme for the administration interface. Click a theme to preview and activate it.") ?> + <?= t("Make your Gallery beautiful <a href=\"%url\">with a new theme</a>! There are separate themes for the regular site and for the administration interface. Click a theme below to preview and activate it.", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Themes")) ?> </p> <div class="g-block-content"> @@ -23,6 +23,7 @@ <p> <?= $themes[$site]->description ?> </p> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $themes[$site]; print $v; ?> </div> <h2> <?= t("Available Gallery themes") ?> </h2> @@ -40,13 +41,14 @@ <?= $info->description ?> </p> </a> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $info; print $v; ?> </div> <? $count++ ?> <? endforeach ?> <? if (!$count): ?> <p> - <?= t("There are no other site themes available.") ?> + <?= t("There are no other site themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Themes")) ?> </p> <? endif ?> </div> @@ -61,6 +63,7 @@ <p> <?= $themes[$admin]->description ?> </p> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $themes[$admin]; print $v; ?> </div> <h2> <?= t("Available admin themes") ?> </h2> @@ -78,17 +81,18 @@ <?= $info->description ?> </p> </a> + <? $v = new View("admin_themes_buttonset.html"); $v->info = $info; print $v; ?> </div> <? $count++ ?> <? endforeach ?> <? if (!$count): ?> <p> - <?= t("There are no other admin themes available.") ?> + <?= t("There are no other admin themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Themes")) ?> </p> <? endif ?> </div> </div> </div> -</div>
\ No newline at end of file +</div> diff --git a/modules/gallery/views/admin_themes_buttonset.html.php b/modules/gallery/views/admin_themes_buttonset.html.php new file mode 100644 index 00000000..bf474a26 --- /dev/null +++ b/modules/gallery/views/admin_themes_buttonset.html.php @@ -0,0 +1,48 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<ul class="g-buttonset"> + <li> + <a target="_blank" + <? if (isset($info['author_url'])): ?> + class="ui-state-default ui-icon ui-icon-person ui-corner-left" + href="<?= $info['author_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-person ui-corner-left" + href="#" + <? endif ?> + + <? if (isset($info['author_name'])): ?> + title="<?= $info['author_name'] ?>" + <? endif ?> + > + <? if (isset($info['author_name'])): ?> + <?= $info['author_name'] ?> + <? endif ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['info_url'])): ?> + class="ui-state-default ui-icon ui-icon-info" + href="<?= $info['info_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-info" + href="#" + <? endif ?> + > + <?= t("info") ?> + </a> + </li> + <li> + <a target="_blank" + <? if (isset($info['discuss_url'])): ?> + class="ui-state-default ui-icon ui-icon-comment ui-corner-right" + href="<?= $info['discuss_url'] ?>" + <? else: ?> + class="ui-state-disabled ui-icon ui-icon-comment ui-corner-right" + href="#" + <? endif ?> + > + <?= t("discuss") ?> + </a> + </li> +</ul> diff --git a/modules/gallery/views/form_uploadify.html.php b/modules/gallery/views/form_uploadify.html.php index 77b6d493..ba4a3621 100644 --- a/modules/gallery/views/form_uploadify.html.php +++ b/modules/gallery/views/form_uploadify.html.php @@ -28,10 +28,11 @@ uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>", script: "<?= url::site("uploader/add_photo/{$album->id}") ?>", scriptData: <?= json_encode($script_data) ?>, - fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.GIF;*.JPG;*.JPEG;*.PNG<? if ($movies_allowed): ?>;*.flv;*.mp4;*.m4v;*.FLV;*.MP4;*.M4V<? endif ?>", + fileExt: "<?= implode(";", $extensions) ?>", fileDesc: <?= t("Photos and movies")->for_js() ?>, cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>", simUploadLimit: <?= $simultaneous_upload_limit ?>, + sizeLimit: <?= $size_limit_bytes ?>, wmode: "transparent", hideButton: true, /* should be true */ auto: true, @@ -66,26 +67,30 @@ return true; }, onError: function(event, queueID, fileObj, errorObj) { - var msg = " - "; if (errorObj.type == "HTTP") { if (errorObj.info == "500") { - msg += <?= t("Unable to process this file")->for_js() ?>; - // Server error - check server logs + error_msg = <?= t("Unable to process this photo")->for_js() ?>; } else if (errorObj.info == "404") { - msg += <?= t("The upload script was not found.")->for_js() ?>; - // Server script not found + error_msg = <?= t("The upload script was not found")->for_js() ?>; + } else if (errorObj.info == "400") { + error_msg = <?= t("This photo is too large (max is %size bytes)", + array("size" => $size_limit))->for_js() ?>; } else { - // Server Error: status: errorObj.info - msg += (<?= t("Server error: __INFO__")->for_js() ?>.replace("__INFO__", errorObj.info)); + msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?> + .replace("__INFO__", errorObj.info) + .replace("__TYPE__", errorObj.type)); } } else if (errorObj.type == "File Size") { - var sizelimit = $("#g-uploadify").uploadifySettings(sizeLimit); - msg += fileObj.name+' '+errorObj.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB'; + error_msg = <?= t("This photo is too large (max is %size bytes)", + array("size" => $size_limit))->for_js() ?>; } else { - msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?> - .replace("__INFO__", errorObj.info) - .replace("__TYPE__", errorObj.type)); + error_msg = <?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?> + .replace("__INFO__", errorObj.info) + .replace("__TYPE__", errorObj.type); } + msg = " - <a target=\"_blank\" href=\"http://codex.gallery2.org/Gallery3:Troubleshooting:Uploading\">" + + error_msg + "</a>"; + $("#g-add-photos-status ul").append( "<li id=\"q" + queueID + "\" class=\"g-error\">" + fileObj.name + msg + "</li>"); $("#g-uploadify").uploadifyCancel(queueID); @@ -131,10 +136,7 @@ <? endif ?> <div> - <p> - <?= t("Photos will be uploaded to album: ") ?> - </p> - <ul class="g-breadcrumbs ui-helper-clearfix"> + <ul class="g-breadcrumbs"> <? foreach ($album->parents() as $i => $parent): ?> <li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li> <? endforeach ?> @@ -143,7 +145,7 @@ </div> <div id="g-add-photos-canvas"> - <button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos...") ?></button> + <button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos (%size max per file)...", array("size" => $size_limit)) ?></button> <span id="g-uploadify"></span> </div> <div id="g-add-photos-status"> diff --git a/modules/gallery/views/movieplayer.html.php b/modules/gallery/views/movieplayer.html.php index 5c280a36..96d6532c 100644 --- a/modules/gallery/views/movieplayer.html.php +++ b/modules/gallery/views/movieplayer.html.php @@ -22,5 +22,5 @@ } } } - ) + ).ipad(); </script> diff --git a/modules/gallery/views/upgrade_checker_block.html.php b/modules/gallery/views/upgrade_checker_block.html.php index b04887b2..c984d99f 100644 --- a/modules/gallery/views/upgrade_checker_block.html.php +++ b/modules/gallery/views/upgrade_checker_block.html.php @@ -6,8 +6,10 @@ <p> <? if (gallery::RELEASE_CHANNEL == "release"): ?> <?= t("You are using the official Gallery %version release, code named <i>%code_name</i>.", array("version" => gallery::VERSION, "code_name" => gallery::CODE_NAME)) ?> + <? elseif (isset($build_number)): ?> + <?= t("You are using an experimental snapshot of Gallery %version (build %build_number on branch %branch).", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => $build_number)) ?> <? else: ?> - <?= t("You are using an experimental snapshot of Gallery %version (build %build_number on branch %branch).", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => gallery::build_number())) ?> + <?= t("You are using an experimental snapshot of Gallery %version (branch %branch) but your gallery3/.build_number file is missing so we don't know what build you have. You should probably upgrade so that you have that file.", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => $build_number)) ?> <? endif ?> </p> diff --git a/modules/gallery/views/upgrader.html.php b/modules/gallery/views/upgrader.html.php index ad2e3421..70d37dd1 100644 --- a/modules/gallery/views/upgrader.html.php +++ b/modules/gallery/views/upgrader.html.php @@ -27,7 +27,7 @@ <div id="done" style="display: none"> <h1> <?= t("That's it!") ?> </h1> <p> - <?= t("Your <a href=\"%url\">Gallery</a> is up to date.", + <?= t("Your Gallery is up to date.<br/><a href=\"%url\">Return to your Gallery</a>", array("url" => html::mark_clean(url::base()))) ?> </p> </div> |