From 9364f0d931883bb5f17f22c4003ee59256f9efb6 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Wed, 5 Jan 2011 23:31:50 +0100 Subject: Allow '..' segment in photo/album paths through file_proxy (as is not forbidden in other places like add album/item) and explitely look for /../ instead Note: directory path can't end in '.' forcibly so this shall be fine Fixes Ticket #1518 --- modules/gallery/controllers/file_proxy.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 22854fbd..5ce9b458 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -45,7 +45,7 @@ class File_Proxy_Controller extends Controller { $file_uri = substr($request_uri, strlen($var_uri)); // Make sure that we don't leave the var dir - if (strpos($file_uri, "..") !== false) { + if (strpos($file_uri, "/../") !== false) { throw new Kohana_404_Exception(); } -- cgit v1.2.3 From 24c0b69847d4144c29e557fa654c30247e628a9c Mon Sep 17 00:00:00 2001 From: Jérémy Subtil Date: Sun, 9 Jan 2011 00:22:46 +0100 Subject: Fixed item controllers so that any item position is computed correctly, when some other items belonging to the same parent album are not viewable. Changed depracated calls to item_Model::get_position() to item::get_position(). --- modules/gallery/controllers/albums.php | 2 +- modules/gallery/controllers/movies.php | 4 ++-- modules/gallery/controllers/photos.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 25df0da7..3435465c 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -37,7 +37,7 @@ class Albums_Controller extends Items_Controller { if ($show) { $child = ORM::factory("item", $show); - $index = $album->get_position($child); + $index = item::get_position($child); if ($index) { $page = ceil($index / $page_size); if ($page == 1) { diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php index bf50abd5..7c85dd98 100644 --- a/modules/gallery/controllers/movies.php +++ b/modules/gallery/controllers/movies.php @@ -28,10 +28,10 @@ class Movies_Controller extends Items_Controller { access::required("view", $movie); $where = array(array("type", "!=", "album")); - $position = $movie->parent()->get_position($movie, $where); + $position = item::get_position($movie, $where); if ($position > 1) { list ($previous_item, $ignore, $next_item) = - $movie->parent()->children(3, $position - 2, $where); + $movie->parent()->viewable()->children(3, $position - 2, $where); } else { $previous_item = null; list ($next_item) = $movie->parent()->viewable()->children(1, $position, $where); diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index d500a92e..4578747d 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -28,10 +28,10 @@ class Photos_Controller extends Items_Controller { access::required("view", $photo); $where = array(array("type", "!=", "album")); - $position = $photo->parent()->get_position($photo, $where); + $position = item::get_position($photo, $where); if ($position > 1) { list ($previous_item, $ignore, $next_item) = - $photo->parent()->children(3, $position - 2, $where); + $photo->parent()->viewable()->children(3, $position - 2, $where); } else { $previous_item = null; list ($next_item) = $photo->parent()->viewable()->children(1, $position, $where); -- cgit v1.2.3 From d557b2a63e2ea424965fb53be9f6b76ad3f18015 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 10 Jan 2011 14:50:30 -0800 Subject: Allow File_Proxy_Controller to run in private gallery mode since it does all the right permission checks. This prevents a hotlink to a private photo in a private gallery from kicking the user out to a login page. Fixes #1594. --- modules/gallery/controllers/file_proxy.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 22854fbd..c6051dfd 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -27,6 +27,7 @@ * input is sanitized against the database before we perform any file I/O. */ class File_Proxy_Controller extends Controller { + const ALLOW_PRIVATE_GALLERY = true; public function __call($function, $args) { // request_uri: gallery3/var/trunk/albums/foo/bar.jpg $request_uri = rawurldecode(Input::instance()->server("REQUEST_URI")); -- cgit v1.2.3 From 7f6d87166df138073d85dd5201de8b9d19bc6cd2 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Tue, 11 Jan 2011 23:16:05 +0100 Subject: Removed check as input value is compared against dataset of validated values, and request is only processed further in case of a match. => this is unnecessary --- modules/gallery/controllers/file_proxy.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 5ce9b458..47e1e483 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -44,11 +44,6 @@ class File_Proxy_Controller extends Controller { $file_uri = substr($request_uri, strlen($var_uri)); - // Make sure that we don't leave the var dir - if (strpos($file_uri, "/../") !== false) { - throw new Kohana_404_Exception(); - } - list ($type, $path) = explode("/", $file_uri, 2); if ($type != "resizes" && $type != "albums" && $type != "thumbs") { throw new Kohana_404_Exception(); -- cgit v1.2.3 From 049f2af1c982bb12fee6e5512e4830f63d06d343 Mon Sep 17 00:00:00 2001 From: Joe7 Date: Wed, 12 Jan 2011 00:05:11 +0100 Subject: Returning 2 flags from l10n_client::validate_api_key(), 1 to reflect if connection was built up properly (just a boolean, not distuingishing between reasons in case of a failure), the other to reflect API validating success status. Using this presenting a slightly more meaningfull error msg to user in case the connection would fail. Fixes Ticket #1504 --- modules/gallery/controllers/admin_languages.php | 11 +++++++---- modules/gallery/helpers/l10n_client.php | 8 ++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index 573ededf..e9be2a88 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -74,9 +74,11 @@ class Admin_Languages_Controller extends Admin_Controller { private function _save_api_key($form) { $new_key = $form->sharing->api_key->value; - if ($new_key && !l10n_client::validate_api_key($new_key)) { - $form->sharing->api_key->add_error("invalid", 1); - $valid = false; + if ($new_key) { + list($connected, $valid) = l10n_client::validate_api_key($new_key); + if (!$valid) { + $form->sharing->api_key->add_error($connected ? "invalid" : "noconn", 1); + } } else { $valid = true; } @@ -119,7 +121,8 @@ class Admin_Languages_Controller extends Admin_Controller { array("server-link" => html::mark_clean(html::anchor($server_link)))) : t("API key")) ->value($api_key) - ->error_messages("invalid", t("The API key you provided is invalid.")); + ->error_messages("invalid", t("The API key you provided is invalid.")) + ->error_messages("noconn", t("Could not connect to remote server to validate the API key.")); $group->submit("save")->value(t("Save settings")); if ($api_key && $this->_outgoing_translations_count()) { // TODO: UI improvement: hide API key / save button when API key is set. diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php index 8c2685a8..2af5c8d0 100644 --- a/modules/gallery/helpers/l10n_client.php +++ b/modules/gallery/helpers/l10n_client.php @@ -60,10 +60,14 @@ class l10n_client_Core { "client_token" => l10n_client::client_token(), "signature" => $signature, "uid" => l10n_client::server_uid($api_key))); + if (!isset($response_data) && !isset($response_status)) { + return array(false, false); + } + if (!remote::success($response_status)) { - return false; + return array(true, false); } - return true; + return array(true, true); } /** -- cgit v1.2.3 From ee53744aa73b06f262122b6236014618fe6d742c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 11 Jan 2011 16:59:57 -0800 Subject: Two improvements to Joe's fix for #1504: 1) Trap all exceptions, eg dns or connectivity issues and report back in the form (but put the stack trace in the logs) 2) Rename "noconn" to "no_connection" --- modules/gallery/controllers/admin_languages.php | 5 +++-- modules/gallery/helpers/l10n_client.php | 15 ++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index e9be2a88..f96a0eb7 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -77,7 +77,7 @@ class Admin_Languages_Controller extends Admin_Controller { if ($new_key) { list($connected, $valid) = l10n_client::validate_api_key($new_key); if (!$valid) { - $form->sharing->api_key->add_error($connected ? "invalid" : "noconn", 1); + $form->sharing->api_key->add_error($connected ? "invalid" : "no_connection", 1); } } else { $valid = true; @@ -122,7 +122,8 @@ class Admin_Languages_Controller extends Admin_Controller { : t("API key")) ->value($api_key) ->error_messages("invalid", t("The API key you provided is invalid.")) - ->error_messages("noconn", t("Could not connect to remote server to validate the API key.")); + ->error_messages( + "no_connection", t("Could not connect to remote server to validate the API key.")); $group->submit("save")->value(t("Save settings")); if ($api_key && $this->_outgoing_translations_count()) { // TODO: UI improvement: hide API key / save button when API key is set. diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php index 2af5c8d0..8fc66b68 100644 --- a/modules/gallery/helpers/l10n_client.php +++ b/modules/gallery/helpers/l10n_client.php @@ -55,11 +55,16 @@ class l10n_client_Core { $url = self::_server_url("status"); $signature = self::_sign($version, $api_key); - list ($response_data, $response_status) = remote::post( - $url, array("version" => $version, - "client_token" => l10n_client::client_token(), - "signature" => $signature, - "uid" => l10n_client::server_uid($api_key))); + try { + list ($response_data, $response_status) = remote::post( + $url, array("version" => $version, + "client_token" => l10n_client::client_token(), + "signature" => $signature, + "uid" => l10n_client::server_uid($api_key))); + } catch (ErrorException $e) { + // Log the error, but then return a "can't make connection" error + Kohana_Log::add("error", $e->getMessage() . "\n" . $e->getTraceAsString()); + } if (!isset($response_data) && !isset($response_status)) { return array(false, false); } -- cgit v1.2.3 From 09d34696a12ae15f6c7378a64b2359465b2d7277 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 11 Jan 2011 17:54:33 -0800 Subject: Update comments to annotate what data is where during the process. Follow-on for #1518. --- modules/gallery/controllers/file_proxy.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php index 0400d7c4..98f4e839 100644 --- a/modules/gallery/controllers/file_proxy.php +++ b/modules/gallery/controllers/file_proxy.php @@ -29,9 +29,11 @@ class File_Proxy_Controller extends Controller { const ALLOW_PRIVATE_GALLERY = true; public function __call($function, $args) { - // request_uri: gallery3/var/trunk/albums/foo/bar.jpg + // request_uri: gallery3/var/albums/foo/bar.jpg?m=1234 $request_uri = rawurldecode(Input::instance()->server("REQUEST_URI")); + // get rid of query parameters + // request_uri: gallery3/var/albums/foo/bar.jpg $request_uri = preg_replace("/\?.*/", "", $request_uri); // var_uri: gallery3/var/ @@ -43,8 +45,11 @@ class File_Proxy_Controller extends Controller { throw new Kohana_404_Exception(); } + // file_uri: albums/foo/bar.jpg $file_uri = substr($request_uri, strlen($var_uri)); + // type: albums + // path: foo/bar.jpg list ($type, $path) = explode("/", $file_uri, 2); if ($type != "resizes" && $type != "albums" && $type != "thumbs") { throw new Kohana_404_Exception(); -- cgit v1.2.3 From 70abfb2a20734802c922c0e9917d2a1778aef3f2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 16 Jan 2011 22:16:09 -0800 Subject: Upgrade checking code is now here, along with a bump of the Gallery module to v46. There's a new block in the admin dashboard which controls whether automatic checking happens, and lets you check immediately. If a newer version is detected, a site status message appears for admins providing upgrade instructions. Automatic checking is not yet implemented (even though the UI claims that it exists). This is all for #1605. --- .../gallery/controllers/admin_upgrade_checker.php | 49 ++++++++++++ modules/gallery/helpers/gallery_block.php | 12 ++- modules/gallery/helpers/gallery_installer.php | 16 +++- modules/gallery/helpers/upgrade_checker.php | 91 ++++++++++++++++++++++ modules/gallery/module.info | 2 +- .../gallery/views/upgrade_checker_block.html.php | 45 +++++++++++ 6 files changed, 212 insertions(+), 3 deletions(-) create mode 100644 modules/gallery/controllers/admin_upgrade_checker.php create mode 100644 modules/gallery/helpers/upgrade_checker.php create mode 100644 modules/gallery/views/upgrade_checker_block.html.php (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_upgrade_checker.php b/modules/gallery/controllers/admin_upgrade_checker.php new file mode 100644 index 00000000..4b1467cd --- /dev/null +++ b/modules/gallery/controllers/admin_upgrade_checker.php @@ -0,0 +1,49 @@ +server("HTTP_REFERER")) { + url::redirect($referer); + } else { + url::redirect(item::root()->abs_url()); + } + } + + function set_auto($val) { + access::verify_csrf(); + module::set_var("gallery", "upgrade_checker_auto_enabled", (bool)$val); + + if ((bool)$val) { + message::success(t("Automatic upgrade checking is enabled.")); + } else { + message::success(t("Automatic upgrade checking is disabled.")); + } + url::redirect("admin/dashboard"); + } +} diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index 1d92d66d..2189a710 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -25,7 +25,9 @@ class gallery_block_Core { "log_entries" => t("Log entries"), "stats" => t("Gallery stats"), "platform_info" => t("Platform information"), - "project_news" => t("Gallery project news")); + "project_news" => t("Gallery project news"), + "upgrade_checker" => t("Check for Gallery upgrades") + ); } static function get_site_list() { @@ -101,6 +103,14 @@ class gallery_block_Core { $block = ""; } break; + + case "upgrade_checker": + $block = new Block(); + $block->css_id = "g-upgrade-available-block"; + $block->title = t("Check for Gallery upgrades"); + $block->content = new View("upgrade_checker_block.html"); + $block->content->version_info = upgrade_checker::version_info(); + $block->content->auto_check_enabled = upgrade_checker::auto_check_enabled(); } return $block; } diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 92e5b7b8..1ffe9bae 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -259,6 +259,7 @@ class gallery_installer { module::set_var("gallery", "default_locale", "en_US"); module::set_var("gallery", "image_quality", 75); module::set_var("gallery", "image_sharpen", 15); + module::set_var("gallery", "upgrade_checker_auto_enabled", true); // Add rules for generating our thumbnails and resizes graphics::add_rule( @@ -285,6 +286,7 @@ class gallery_installer { block_manager::add("dashboard_sidebar", "gallery", "platform_info"); block_manager::add("dashboard_sidebar", "gallery", "project_news"); block_manager::add("dashboard_center", "gallery", "welcome"); + block_manager::add("dashboard_center", "gallery", "upgrade_checker"); block_manager::add("dashboard_center", "gallery", "photo_stream"); block_manager::add("dashboard_center", "gallery", "log_entries"); @@ -309,7 +311,7 @@ class gallery_installer { 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_version("gallery", 45); + module::set_version("gallery", 46); } static function upgrade($version) { @@ -663,6 +665,18 @@ class gallery_installer { $db->query("ALTER TABLE {messages} CHANGE `value` `value` text default NULL"); module::set_version("gallery", $version = 45); } + + if ($version == 45) { + // Splice the upgrade_checker block into the admin dashboard at the top + // of the page, but under the welcome block if it's in the first position. + $blocks = block_manager::get_active("dashboard_center"); + $index = count($blocks) && current($blocks) == array("gallery", "welcome") ? 1 : 0; + array_splice($blocks, $index, 0, array(random::int() => array("gallery", "upgrade_checker"))); + block_manager::set_active("dashboard_center", $blocks); + + module::set_var("gallery", "upgrade_checker_auto_enabled", true); + module::set_version("gallery", $version = 46); + } } static function uninstall() { diff --git a/modules/gallery/helpers/upgrade_checker.php b/modules/gallery/helpers/upgrade_checker.php new file mode 100644 index 00000000..9311cf4a --- /dev/null +++ b/modules/gallery/helpers/upgrade_checker.php @@ -0,0 +1,91 @@ +get("upgrade_checker_version_info")); + } + + static function auto_check_enabled() { + return (bool)module::get_var("gallery", "upgrade_checker_auto_enabled"); + } + + static function fetch_version_info() { + $result = new stdClass(); + try { + list ($status, $headers, $body) = remote::do_request(upgrade_checker::CHECK_URL); + if ($status == "HTTP/1.1 200 OK") { + $result->status = "success"; + foreach (explode("\n", $body) as $line) { + if ($line) { + list($key, $val) = explode("=", $line, 2); + $result->data[$key] = $val; + } + } + } else { + $result->status = "error"; + } + } catch (Exception $e) { + Kohana_Log::add("error", + sprintf("%s in %s at line %s:\n%s", $e->getMessage(), $e->getFile(), + $e->getLine(), $e->getTraceAsString())); + } + $result->timestamp = time(); + Cache::instance()->set("upgrade_checker_version_info", serialize($result), null, 86400 * 365); + } + + static function check_for_upgrade() { + $version_info = upgrade_checker::version_info(); + $upgrade_available = false; + if ($version_info) { + if (gallery::RELEASE_CHANNEL == "release") { + if (version_compare($version_info->data["release_version"], gallery::VERSION, ">")) { + site_status::warning( + t("A newer version of Gallery is available! Upgrade now to version %version or wait until later.", + array("version" => $version_info->data["release_version"], + "upgrade-url" => $version_info->data["release_upgrade_url"], + "hide-url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__"))), + "upgrade_checker"); + $upgrade_available = true; + } + } else { + $branch = gallery::RELEASE_BRANCH; + if (isset($version_info->data["{$branch}_build_number"]) && + version_compare($version_info->data["{$branch}_build_number"], + gallery::build_number(), ">")) { + site_status::warning( + t("A newer version of Gallery is available! Upgrade now to version %version (build %build on branch %branch) or wait until later.", + array("version" => $version_info->data["{$branch}_version"], + "upgrade-url" => $version_info->data["{$branch}_upgrade_url"], + "build" => $version_info->data["{$branch}_build_number"], + "branch" => $branch, + "hide-url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__"))), + "upgrade_checker"); + $upgrade_available = true; + } + } + } + + if (!$upgrade_available) { + site_status::clear("upgrade_checker"); + } + } +} diff --git a/modules/gallery/module.info b/modules/gallery/module.info index b79df7be..4c0c8866 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 45 +version = 46 diff --git a/modules/gallery/views/upgrade_checker_block.html.php b/modules/gallery/views/upgrade_checker_block.html.php new file mode 100644 index 00000000..30e18305 --- /dev/null +++ b/modules/gallery/views/upgrade_checker_block.html.php @@ -0,0 +1,45 @@ + +

+ +

+ +

+ + %code_name.", array("version" => gallery::VERSION, "code_name" => gallery::CODE_NAME)) ?> + + gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => gallery::build_number())) ?> + +

+ +

+ "> + + + + "> + + + + "> + + + +

+ +

+ + + + + + + + + gallery::date_time($version_info->timestamp))) ?> + +

+ -- cgit v1.2.3 From 45caba09f81e53dfa4264bc74c4e6ed7935bd5f9 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 17 Jan 2011 20:03:11 -0800 Subject: Move the code that clears the upgrade_check site status message to the upgrader so that it's cleared any time we run an upgrade. Part of --- modules/gallery/controllers/upgrader.php | 3 +++ modules/gallery/helpers/gallery_installer.php | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index 66c71648..0932090f 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -94,6 +94,9 @@ class Upgrader_Controller extends Controller { // If the upgrade failed, this will get recreated site_status::clear("upgrade_now"); + // Clear any upgrade check strings, we are probably up to date. + site_status::clear("upgrade_check"); + if (php_sapi_name() == "cli") { if ($failed) { print "Upgrade completed ** WITH FAILURES **\n"; diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 41ed1c6e..1ffe9bae 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -677,9 +677,6 @@ class gallery_installer { module::set_var("gallery", "upgrade_checker_auto_enabled", true); module::set_version("gallery", $version = 46); } - - // Clear any upgrade check strings, we are probably up to date. - site_status::clear("upgrade_check"); } static function uninstall() { -- cgit v1.2.3 From 20ae106c22b9528d34fb85d09a7ab542e6c6c880 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 17 Jan 2011 21:15:33 -0800 Subject: Display a message in the "Check for Gallery upgrades" block when there's a newer version available, even if the user has dismissed the site status message. #1605. --- .../gallery/controllers/admin_upgrade_checker.php | 9 ++++++- modules/gallery/helpers/gallery_block.php | 1 + modules/gallery/helpers/upgrade_checker.php | 31 +++++++--------------- .../gallery/views/upgrade_checker_block.html.php | 8 ++++++ themes/admin_wind/css/screen.css | 2 +- 5 files changed, 27 insertions(+), 24 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_upgrade_checker.php b/modules/gallery/controllers/admin_upgrade_checker.php index 4b1467cd..456a982c 100644 --- a/modules/gallery/controllers/admin_upgrade_checker.php +++ b/modules/gallery/controllers/admin_upgrade_checker.php @@ -21,7 +21,14 @@ class Admin_Upgrade_Checker_Controller extends Admin_Controller { function check_now() { access::verify_csrf(); upgrade_checker::fetch_version_info(); - upgrade_checker::check_for_upgrade(); + $message = upgrade_checker::get_upgrade_message(); + if ($message) { + $message .= " [x]"; + site_status::info($message, "upgrade_checker"); + } else { + site_status::clear("upgrade_checker"); + } url::redirect("admin/dashboard"); } diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php index 2189a710..fed786cc 100644 --- a/modules/gallery/helpers/gallery_block.php +++ b/modules/gallery/helpers/gallery_block.php @@ -111,6 +111,7 @@ class gallery_block_Core { $block->content = new View("upgrade_checker_block.html"); $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(); } return $block; } diff --git a/modules/gallery/helpers/upgrade_checker.php b/modules/gallery/helpers/upgrade_checker.php index 0e72bb94..f92203c8 100644 --- a/modules/gallery/helpers/upgrade_checker.php +++ b/modules/gallery/helpers/upgrade_checker.php @@ -77,40 +77,27 @@ class upgrade_checker_Core { /** * Check the latest version info blob to see if it's time for an upgrade. */ - static function check_for_upgrade() { + static function get_upgrade_message() { $version_info = upgrade_checker::version_info(); - $upgrade_available = false; if ($version_info) { if (gallery::RELEASE_CHANNEL == "release") { if (version_compare($version_info->data["release_version"], gallery::VERSION, ">")) { - site_status::warning( - t("A newer version of Gallery is available! Upgrade now to version %version or wait until later.", - array("version" => $version_info->data["release_version"], - "upgrade-url" => $version_info->data["release_upgrade_url"], - "hide-url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__"))), - "upgrade_checker"); - $upgrade_available = true; + return t("A newer version of Gallery is available! Upgrade now to version %version", + array("version" => $version_info->data["release_version"], + "upgrade-url" => $version_info->data["release_upgrade_url"])); } } else { $branch = gallery::RELEASE_BRANCH; if (isset($version_info->data["branch_{$branch}_build_number"]) && version_compare($version_info->data["branch_{$branch}_build_number"], gallery::build_number(), ">")) { - site_status::warning( - t("A newer version of Gallery is available! Upgrade now to version %version (build %build on branch %branch) or wait until later.", - array("version" => $version_info->data["branch_{$branch}_version"], - "upgrade-url" => $version_info->data["branch_{$branch}_upgrade_url"], - "build" => $version_info->data["branch_{$branch}_build_number"], - "branch" => $branch, - "hide-url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__"))), - "upgrade_checker"); - $upgrade_available = true; + return t("A newer version of Gallery is available! Upgrade now to version %version (build %build on branch %branch)", + array("version" => $version_info->data["branch_{$branch}_version"], + "upgrade-url" => $version_info->data["branch_{$branch}_upgrade_url"], + "build" => $version_info->data["branch_{$branch}_build_number"], + "branch" => $branch)); } } } - - if (!$upgrade_available) { - site_status::clear("upgrade_checker"); - } } } diff --git a/modules/gallery/views/upgrade_checker_block.html.php b/modules/gallery/views/upgrade_checker_block.html.php index 30e18305..b04887b2 100644 --- a/modules/gallery/views/upgrade_checker_block.html.php +++ b/modules/gallery/views/upgrade_checker_block.html.php @@ -11,6 +11,14 @@

+ +
    +
  • + +
  • +
+ +

"> diff --git a/themes/admin_wind/css/screen.css b/themes/admin_wind/css/screen.css index 7d491cb7..a5376ff6 100644 --- a/themes/admin_wind/css/screen.css +++ b/themes/admin_wind/css/screen.css @@ -888,10 +888,10 @@ button { background-position: .4em .3em; border: 1px solid #ccc; padding: 0; + margin-bottom: 1em; } #g-action-status { - margin-bottom: 1em; } #g-action-status li, -- cgit v1.2.3 From 83bf1d767b9dac33ca1c2f01141358cd0b657523 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 17 Jan 2011 21:18:24 -0800 Subject: Fix typo: upgrade_check -> upgrade_checker #1605. --- modules/gallery/controllers/upgrader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php index 0932090f..6a34f19f 100644 --- a/modules/gallery/controllers/upgrader.php +++ b/modules/gallery/controllers/upgrader.php @@ -95,7 +95,7 @@ class Upgrader_Controller extends Controller { site_status::clear("upgrade_now"); // Clear any upgrade check strings, we are probably up to date. - site_status::clear("upgrade_check"); + site_status::clear("upgrade_checker"); if (php_sapi_name() == "cli") { if ($failed) { -- cgit v1.2.3 From 56e6cb998f9b2f55af88fef426f8a69cc0058cb2 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 17 Jan 2011 21:37:51 -0800 Subject: Change the [x] close box to "(remind me later)". #1605. --- modules/gallery/controllers/admin_upgrade_checker.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/modules/gallery/controllers/admin_upgrade_checker.php b/modules/gallery/controllers/admin_upgrade_checker.php index 456a982c..366bd64e 100644 --- a/modules/gallery/controllers/admin_upgrade_checker.php +++ b/modules/gallery/controllers/admin_upgrade_checker.php @@ -23,8 +23,9 @@ class Admin_Upgrade_Checker_Controller extends Admin_Controller { upgrade_checker::fetch_version_info(); $message = upgrade_checker::get_upgrade_message(); if ($message) { - $message .= " [x]"; + $message .= t( + " (remind me later)", + array("url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__"))); site_status::info($message, "upgrade_checker"); } else { site_status::clear("upgrade_checker"); -- cgit v1.2.3 From 423daa52d55a5298b461384baedc995eee09a0d1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 21 Jan 2011 23:01:06 -0800 Subject: Update copyright to 2011. --- application/Bootstrap.php | 2 +- application/config/config.php | 2 +- index.php | 2 +- installer/cli.php | 2 +- installer/index.php | 2 +- installer/installer.php | 2 +- installer/web.php | 2 +- modules/akismet/controllers/admin_akismet.php | 2 +- modules/akismet/helpers/akismet.php | 2 +- modules/akismet/helpers/akismet_event.php | 2 +- modules/akismet/helpers/akismet_installer.php | 2 +- modules/akismet/tests/Akismet_Helper_Test.php | 2 +- modules/comment/controllers/admin_comments.php | 2 +- modules/comment/controllers/admin_manage_comments.php | 2 +- modules/comment/controllers/comments.php | 2 +- modules/comment/helpers/comment.php | 2 +- modules/comment/helpers/comment_block.php | 2 +- modules/comment/helpers/comment_event.php | 2 +- modules/comment/helpers/comment_installer.php | 2 +- modules/comment/helpers/comment_rest.php | 2 +- modules/comment/helpers/comment_rss.php | 2 +- modules/comment/helpers/comment_theme.php | 2 +- modules/comment/helpers/comments_rest.php | 2 +- modules/comment/helpers/item_comments_rest.php | 2 +- modules/comment/models/comment.php | 2 +- modules/comment/tests/Comment_Event_Test.php | 2 +- modules/comment/tests/Comment_Helper_Test.php | 2 +- modules/comment/tests/Comment_Model_Test.php | 2 +- modules/digibug/config/digibug.php | 2 +- modules/digibug/controllers/admin_digibug.php | 2 +- modules/digibug/controllers/digibug.php | 2 +- modules/digibug/helpers/digibug_event.php | 2 +- modules/digibug/helpers/digibug_installer.php | 2 +- modules/digibug/helpers/digibug_theme.php | 2 +- modules/digibug/models/digibug_proxy.php | 2 +- modules/digibug/tests/Digibug_Controller_Test.php | 2 +- modules/exif/controllers/exif.php | 2 +- modules/exif/helpers/exif.php | 2 +- modules/exif/helpers/exif_event.php | 2 +- modules/exif/helpers/exif_installer.php | 2 +- modules/exif/helpers/exif_task.php | 2 +- modules/exif/helpers/exif_theme.php | 2 +- modules/exif/models/exif_key.php | 2 +- modules/exif/models/exif_record.php | 2 +- modules/exif/tests/Exif_Test.php | 2 +- modules/g2_import/controllers/admin_g2_import.php | 2 +- modules/g2_import/controllers/g2.php | 2 +- modules/g2_import/helpers/g2_import.php | 2 +- modules/g2_import/helpers/g2_import_event.php | 2 +- modules/g2_import/helpers/g2_import_installer.php | 2 +- modules/g2_import/helpers/g2_import_task.php | 2 +- modules/g2_import/libraries/G2_Import_Exception.php | 2 +- modules/g2_import/models/g2_map.php | 2 +- modules/gallery/config/cache.php | 2 +- modules/gallery/config/cookie.php | 2 +- modules/gallery/config/database.php | 2 +- modules/gallery/config/locale.php | 2 +- modules/gallery/config/log_file.php | 2 +- modules/gallery/config/routes.php | 2 +- modules/gallery/config/session.php | 2 +- modules/gallery/config/upload.php | 2 +- modules/gallery/config/user_agents.php | 2 +- modules/gallery/controllers/admin.php | 2 +- modules/gallery/controllers/admin_advanced_settings.php | 2 +- modules/gallery/controllers/admin_dashboard.php | 2 +- modules/gallery/controllers/admin_graphics.php | 2 +- modules/gallery/controllers/admin_languages.php | 2 +- modules/gallery/controllers/admin_maintenance.php | 2 +- modules/gallery/controllers/admin_modules.php | 2 +- modules/gallery/controllers/admin_sidebar.php | 2 +- modules/gallery/controllers/admin_theme_options.php | 2 +- modules/gallery/controllers/admin_themes.php | 2 +- modules/gallery/controllers/admin_upgrade_checker.php | 2 +- modules/gallery/controllers/albums.php | 2 +- modules/gallery/controllers/combined.php | 2 +- modules/gallery/controllers/file_proxy.php | 2 +- modules/gallery/controllers/items.php | 2 +- modules/gallery/controllers/l10n_client.php | 2 +- modules/gallery/controllers/login.php | 2 +- modules/gallery/controllers/logout.php | 2 +- modules/gallery/controllers/movies.php | 2 +- modules/gallery/controllers/packager.php | 2 +- modules/gallery/controllers/permissions.php | 2 +- modules/gallery/controllers/photos.php | 2 +- modules/gallery/controllers/quick.php | 2 +- modules/gallery/controllers/reauthenticate.php | 2 +- modules/gallery/controllers/upgrader.php | 2 +- modules/gallery/controllers/uploader.php | 2 +- modules/gallery/controllers/user_profile.php | 2 +- modules/gallery/controllers/welcome_message.php | 2 +- modules/gallery/helpers/MY_html.php | 2 +- modules/gallery/helpers/MY_num.php | 2 +- modules/gallery/helpers/MY_remote.php | 2 +- modules/gallery/helpers/MY_url.php | 2 +- modules/gallery/helpers/access.php | 2 +- modules/gallery/helpers/album.php | 2 +- modules/gallery/helpers/auth.php | 2 +- modules/gallery/helpers/batch.php | 2 +- modules/gallery/helpers/block_manager.php | 2 +- modules/gallery/helpers/data_rest.php | 2 +- modules/gallery/helpers/dir.php | 2 +- modules/gallery/helpers/gallery.php | 2 +- modules/gallery/helpers/gallery_block.php | 2 +- modules/gallery/helpers/gallery_error.php | 2 +- modules/gallery/helpers/gallery_event.php | 2 +- modules/gallery/helpers/gallery_graphics.php | 2 +- modules/gallery/helpers/gallery_installer.php | 2 +- modules/gallery/helpers/gallery_rss.php | 2 +- modules/gallery/helpers/gallery_task.php | 2 +- modules/gallery/helpers/gallery_theme.php | 2 +- modules/gallery/helpers/graphics.php | 2 +- modules/gallery/helpers/identity.php | 2 +- modules/gallery/helpers/item.php | 2 +- modules/gallery/helpers/item_rest.php | 2 +- modules/gallery/helpers/items_rest.php | 2 +- modules/gallery/helpers/json.php | 2 +- modules/gallery/helpers/l10n_client.php | 2 +- modules/gallery/helpers/l10n_scanner.php | 2 +- modules/gallery/helpers/locales.php | 2 +- modules/gallery/helpers/log.php | 2 +- modules/gallery/helpers/message.php | 2 +- modules/gallery/helpers/model_cache.php | 2 +- modules/gallery/helpers/module.php | 2 +- modules/gallery/helpers/movie.php | 2 +- modules/gallery/helpers/photo.php | 2 +- modules/gallery/helpers/random.php | 2 +- modules/gallery/helpers/site_status.php | 2 +- modules/gallery/helpers/system.php | 2 +- modules/gallery/helpers/task.php | 2 +- modules/gallery/helpers/theme.php | 2 +- modules/gallery/helpers/tree_rest.php | 2 +- modules/gallery/helpers/upgrade_checker.php | 2 +- modules/gallery/helpers/user_profile.php | 2 +- modules/gallery/helpers/xml.php | 2 +- modules/gallery/hooks/init_gallery.php | 2 +- modules/gallery/libraries/Admin_View.php | 2 +- modules/gallery/libraries/Block.php | 2 +- modules/gallery/libraries/Form_Script.php | 2 +- modules/gallery/libraries/Form_Uploadify.php | 2 +- modules/gallery/libraries/Form_Uploadify_buttons.php | 2 +- modules/gallery/libraries/Gallery_I18n.php | 2 +- modules/gallery/libraries/Gallery_View.php | 2 +- modules/gallery/libraries/IdentityProvider.php | 2 +- modules/gallery/libraries/InPlaceEdit.php | 2 +- modules/gallery/libraries/MY_Database.php | 2 +- modules/gallery/libraries/MY_Forge.php | 2 +- modules/gallery/libraries/MY_Input.php | 2 +- modules/gallery/libraries/MY_Kohana_Exception.php | 2 +- modules/gallery/libraries/MY_ORM.php | 2 +- modules/gallery/libraries/MY_Pagination.php | 2 +- modules/gallery/libraries/MY_View.php | 2 +- modules/gallery/libraries/Menu.php | 2 +- modules/gallery/libraries/ORM_MPTT.php | 2 +- modules/gallery/libraries/SafeString.php | 2 +- modules/gallery/libraries/Sendmail.php | 2 +- modules/gallery/libraries/Task_Definition.php | 2 +- modules/gallery/libraries/Theme_View.php | 2 +- modules/gallery/libraries/drivers/Cache/Database.php | 2 +- modules/gallery/libraries/drivers/IdentityProvider.php | 2 +- modules/gallery/models/access_cache.php | 2 +- modules/gallery/models/access_intent.php | 2 +- modules/gallery/models/cache.php | 2 +- modules/gallery/models/failed_auth.php | 2 +- modules/gallery/models/graphics_rule.php | 2 +- modules/gallery/models/incoming_translation.php | 2 +- modules/gallery/models/item.php | 2 +- modules/gallery/models/log.php | 2 +- modules/gallery/models/message.php | 2 +- modules/gallery/models/module.php | 2 +- modules/gallery/models/outgoing_translation.php | 2 +- modules/gallery/models/permission.php | 2 +- modules/gallery/models/task.php | 2 +- modules/gallery/models/theme.php | 2 +- modules/gallery/models/var.php | 2 +- modules/gallery/tests/Access_Helper_Test.php | 2 +- modules/gallery/tests/Albums_Controller_Test.php | 2 +- modules/gallery/tests/Cache_Test.php | 2 +- modules/gallery/tests/Controller_Auth_Test.php | 2 +- modules/gallery/tests/Database_Test.php | 2 +- modules/gallery/tests/Dir_Helper_Test.php | 2 +- modules/gallery/tests/DrawForm_Test.php | 2 +- modules/gallery/tests/File_Structure_Test.php | 4 ++-- modules/gallery/tests/Gallery_Filters.php | 2 +- modules/gallery/tests/Gallery_I18n_Test.php | 2 +- modules/gallery/tests/Gallery_Installer_Test.php | 2 +- modules/gallery/tests/Html_Helper_Test.php | 2 +- modules/gallery/tests/Input_Library_Test.php | 2 +- modules/gallery/tests/Item_Helper_Test.php | 2 +- modules/gallery/tests/Item_Model_Test.php | 2 +- modules/gallery/tests/Item_Rest_Helper_Test.php | 2 +- modules/gallery/tests/Items_Rest_Helper_Test.php | 2 +- modules/gallery/tests/Kohana_Exception_Test.php | 2 +- modules/gallery/tests/Locales_Helper_Test.php | 2 +- modules/gallery/tests/Menu_Test.php | 2 +- modules/gallery/tests/ORM_MPTT_Test.php | 2 +- modules/gallery/tests/Photos_Controller_Test.php | 2 +- modules/gallery/tests/SafeString_Test.php | 2 +- modules/gallery/tests/Sendmail_Test.php | 2 +- modules/gallery/tests/Url_Security_Test.php | 2 +- modules/gallery/tests/Var_Test.php | 2 +- modules/gallery/tests/Xss_Security_Test.php | 2 +- modules/gallery_unit_test/controllers/gallery_unit_test.php | 2 +- modules/gallery_unit_test/helpers/MY_request.php | 2 +- modules/gallery_unit_test/helpers/test.php | 2 +- modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php | 2 +- modules/image_block/helpers/image_block_block.php | 2 +- modules/image_block/helpers/image_block_installer.php | 2 +- modules/info/helpers/info_block.php | 2 +- modules/info/helpers/info_installer.php | 2 +- modules/info/helpers/info_theme.php | 2 +- modules/kohana23_compat/config/pagination.php | 2 +- modules/kohana23_compat/libraries/MY_Database_Builder.php | 2 +- modules/kohana23_compat/libraries/Pagination.php | 2 +- modules/notification/controllers/notification.php | 2 +- modules/notification/helpers/notification.php | 2 +- modules/notification/helpers/notification_event.php | 2 +- modules/notification/helpers/notification_installer.php | 2 +- modules/notification/models/pending_notification.php | 2 +- modules/notification/models/subscription.php | 2 +- modules/organize/controllers/organize.php | 2 +- modules/organize/helpers/organize_event.php | 2 +- modules/organize/helpers/organize_installer.php | 2 +- modules/recaptcha/controllers/admin_recaptcha.php | 2 +- modules/recaptcha/helpers/recaptcha.php | 2 +- modules/recaptcha/helpers/recaptcha_event.php | 2 +- modules/recaptcha/helpers/recaptcha_installer.php | 2 +- modules/recaptcha/helpers/recaptcha_theme.php | 2 +- modules/recaptcha/libraries/Form_Recaptcha.php | 2 +- modules/rest/controllers/rest.php | 2 +- modules/rest/helpers/registry_rest.php | 2 +- modules/rest/helpers/rest.php | 2 +- modules/rest/helpers/rest_event.php | 2 +- modules/rest/helpers/rest_installer.php | 2 +- modules/rest/libraries/Rest_Exception.php | 2 +- modules/rest/models/user_access_key.php | 2 +- modules/rest/tests/Rest_Controller_Test.php | 2 +- modules/rss/controllers/rss.php | 2 +- modules/rss/helpers/rss.php | 2 +- modules/rss/helpers/rss_block.php | 2 +- modules/search/controllers/search.php | 2 +- modules/search/helpers/search.php | 2 +- modules/search/helpers/search_event.php | 2 +- modules/search/helpers/search_installer.php | 2 +- modules/search/helpers/search_task.php | 2 +- modules/search/helpers/search_theme.php | 2 +- modules/search/models/search_record.php | 2 +- modules/server_add/controllers/admin_server_add.php | 2 +- modules/server_add/controllers/server_add.php | 2 +- modules/server_add/helpers/server_add.php | 2 +- modules/server_add/helpers/server_add_event.php | 2 +- modules/server_add/helpers/server_add_installer.php | 2 +- modules/server_add/helpers/server_add_theme.php | 2 +- modules/server_add/models/server_add_entry.php | 2 +- modules/slideshow/helpers/slideshow_event.php | 2 +- modules/slideshow/helpers/slideshow_installer.php | 2 +- modules/slideshow/helpers/slideshow_theme.php | 2 +- modules/tag/controllers/admin_tags.php | 2 +- modules/tag/controllers/tag.php | 2 +- modules/tag/controllers/tags.php | 2 +- modules/tag/helpers/item_tags_rest.php | 2 +- modules/tag/helpers/tag.php | 2 +- modules/tag/helpers/tag_block.php | 2 +- modules/tag/helpers/tag_event.php | 2 +- modules/tag/helpers/tag_installer.php | 2 +- modules/tag/helpers/tag_item_rest.php | 2 +- modules/tag/helpers/tag_items_rest.php | 2 +- modules/tag/helpers/tag_rest.php | 2 +- modules/tag/helpers/tag_rss.php | 2 +- modules/tag/helpers/tag_task.php | 2 +- modules/tag/helpers/tag_theme.php | 2 +- modules/tag/helpers/tags_rest.php | 2 +- modules/tag/models/tag.php | 2 +- modules/tag/tests/Tag_Item_Rest_Helper_Test.php | 2 +- modules/tag/tests/Tag_Rest_Helper_Test.php | 2 +- modules/tag/tests/Tag_Test.php | 2 +- modules/tag/tests/Tags_Rest_Helper_Test.php | 2 +- modules/user/config/identity.php | 2 +- modules/user/controllers/admin_users.php | 2 +- modules/user/controllers/password.php | 2 +- modules/user/controllers/users.php | 2 +- modules/user/helpers/group.php | 2 +- modules/user/helpers/user.php | 2 +- modules/user/helpers/user_event.php | 2 +- modules/user/helpers/user_installer.php | 2 +- modules/user/helpers/user_theme.php | 2 +- modules/user/libraries/drivers/IdentityProvider/Gallery.php | 2 +- modules/user/models/group.php | 2 +- modules/user/models/user.php | 2 +- modules/user/tests/No_Direct_ORM_Access_Test.php | 2 +- modules/user/tests/User_Groups_Test.php | 2 +- modules/user/tests/User_Installer_Test.php | 2 +- modules/watermark/controllers/admin_watermarks.php | 2 +- modules/watermark/helpers/watermark.php | 2 +- modules/watermark/helpers/watermark_event.php | 2 +- modules/watermark/helpers/watermark_installer.php | 2 +- 295 files changed, 296 insertions(+), 296 deletions(-) (limited to 'modules/gallery/controllers') diff --git a/application/Bootstrap.php b/application/Bootstrap.php index fbd83ce1..ff021fd5 100644 --- a/application/Bootstrap.php +++ b/application/Bootstrap.php @@ -1,7 +1,7 @@