From 3ec0ba956dced01a97f2ee7bd943d326c42350e3 Mon Sep 17 00:00:00 2001
From: Joe7
Date: Sat, 8 Jan 2011 19:39:23 +0100
Subject: Refactored graphics::detect_toolkits() so ImageMagick and
GraphicsMagick shares the same loop. Just as premarked as todo. Will make
https://sourceforge.net/apps/trac/gallery/ticket/1555#comment:3 an even
quicker task
---
modules/gallery/helpers/graphics.php | 76 ++++++++++++++----------------------
1 file changed, 29 insertions(+), 47 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index edba6b76..cb48ce82 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -318,55 +318,37 @@ class graphics_Core {
getenv("PATH"),
module::get_var("gallery", "extra_binary_paths")));
- // @todo: consider refactoring the two segments below into a loop since they are so
- // similar.
-
- // ImageMagick
- $path = exec("which convert");
- $toolkits->imagemagick->name = "ImageMagick";
- if ($path) {
- if (@is_file($path)) {
- preg_match('/Version: \S+ (\S+)/', `convert -v`, $matches);
- $version = $matches[1];
-
- $toolkits->imagemagick->installed = true;
- $toolkits->imagemagick->version = $version;
- $toolkits->imagemagick->binary = $path;
- $toolkits->imagemagick->dir = dirname($path);
- $toolkits->imagemagick->rotate = true;
- $toolkits->imagemagick->sharpen = true;
- } else {
- $toolkits->imagemagick->installed = false;
- $toolkits->imagemagick->error =
- t("ImageMagick is installed, but PHP's open_basedir restriction prevents Gallery from using it.");
- }
- } else {
- $toolkits->imagemagick->installed = false;
- $toolkits->imagemagick->error = t("We could not locate ImageMagick on your system.");
- }
-
- // GraphicsMagick
- $path = exec("which gm");
- $toolkits->graphicsmagick->name = "GraphicsMagick";
- if ($path) {
- if (@is_file($path)) {
- preg_match('/\S+ (\S+)/', `gm version`, $matches);
- $version = $matches[1];
-
- $toolkits->graphicsmagick->installed = true;
- $toolkits->graphicsmagick->version = $version;
- $toolkits->graphicsmagick->binary = $path;
- $toolkits->graphicsmagick->dir = dirname($path);
- $toolkits->graphicsmagick->rotate = true;
- $toolkits->graphicsmagick->sharpen = true;
+ // ImageMagick & GraphicsMagick
+ $magick_kits = array(
+ "imagemagick" => array(
+ "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v"),
+ "graphicsmagick" => array(
+ "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version"));
+ // Loop through the kits
+ foreach ( $magick_kits as $index => $settings ) {
+ $path = exec("which " . $settings["binary"]);
+ $toolkits->$index->name = $settings["name"];
+ if ($path) {
+ if (@is_file($path)) {
+ preg_match('/Version: \S+ (\S+)/', shell_exec($settings["version"]), $matches);
+ $version = $matches[1];
+
+ $toolkits->$index->installed = true;
+ $toolkits->$index->version = $version;
+ $toolkits->$index->binary = $path;
+ $toolkits->$index->dir = dirname($path);
+ $toolkits->$index->rotate = true;
+ $toolkits->$index->sharpen = true;
+ } else {
+ $toolkits->$index->installed = false;
+ $toolkits->$index->error =
+ t($settings["name"] . " is installed, but PHP's open_basedir restriction prevents Gallery from using it.");
+ }
} else {
- $toolkits->graphicsmagick->installed = false;
- $toolkits->graphicsmagick->error =
- t("GraphicsMagick is installed, but PHP's open_basedir restriction prevents Gallery from using it.");
+ $toolkits->$index->installed = false;
+ $toolkits->$index->error =
+ t("We could not locate " . $settings["name"] . " on your system.");
}
- } else {
- $toolkits->graphicsmagick->installed = false;
- $toolkits->graphicsmagick->error = t("We could not locate GraphicsMagick on your system.");
}
}
--
cgit v1.2.3
From 7dd63630d8f7fc46847388c307ecf160a729aafb Mon Sep 17 00:00:00 2001
From: Joe7
Date: Sat, 8 Jan 2011 19:44:46 +0100
Subject: Minor coding style fix
---
modules/gallery/helpers/graphics.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index cb48ce82..96a6ceba 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -325,7 +325,7 @@ class graphics_Core {
"graphicsmagick" => array(
"name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version"));
// Loop through the kits
- foreach ( $magick_kits as $index => $settings ) {
+ foreach ($magick_kits as $index => $settings) {
$path = exec("which " . $settings["binary"]);
$toolkits->$index->name = $settings["name"];
if ($path) {
--
cgit v1.2.3
From eecb24429115b5f1883971befe0de18ac718fc2a Mon Sep 17 00:00:00 2001
From: Joe7
Date: Sun, 9 Jan 2011 02:06:35 +0100
Subject: Made t() calls parsable by localization scanner
---
modules/gallery/helpers/graphics.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 96a6ceba..a30699e8 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -342,12 +342,14 @@ class graphics_Core {
} else {
$toolkits->$index->installed = false;
$toolkits->$index->error =
- t($settings["name"] . " is installed, but PHP's open_basedir restriction prevents Gallery from using it.");
+ t("%toolkit_name is installed, but PHP's open_basedir restriction prevents Gallery from using it.",
+ array("toolkit_name" => $settings["name"]));
}
} else {
$toolkits->$index->installed = false;
$toolkits->$index->error =
- t("We could not locate " . $settings["name"] . " on your system.");
+ t("We could not locate %toolkit_name on your system.",
+ array("toolkit_name" => $settings["name"]));
}
}
}
--
cgit v1.2.3
From 0d7e951aa5f7329edb25e821de95051668789bcd Mon Sep 17 00:00:00 2001
From: Jérémy Subtil
Date: Sat, 8 Jan 2011 22:57:09 +0100
Subject: Moved item_Model::get_position() method to the Item helper. It now
calls the viewable() method on every query.
---
modules/gallery/helpers/item.php | 85 ++++++++++++++++++++++++++++++++++++++++
modules/gallery/models/item.php | 79 ++-----------------------------------
2 files changed, 89 insertions(+), 75 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index 29dd8603..a2d5f74d 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -304,4 +304,89 @@ class item_Core {
->where("rand_key", "<", random::percent())
->order_by("rand_key", "DESC");
}
+
+ /**
+ * Find the position of the given item in its parent album. The resulting
+ * value is 1-indexed, so the first child in the album is at position 1.
+ */
+ static function get_position($item, $where=array()) {
+ $album = $item->parent();
+
+ if (!strcasecmp($album->sort_order, "DESC")) {
+ $comp = ">";
+ } else {
+ $comp = "<";
+ }
+ $query_model = ORM::factory("item");
+
+ // If the comparison column has NULLs in it, we can't use comparators on it
+ // and will have to deal with it the hard way.
+ $count = $query_model->viewable()
+ ->where("parent_id", "=", $album->id)
+ ->where($album->sort_column, "IS", null)
+ ->merge_where($where)
+ ->count_all();
+
+ if (empty($count)) {
+ // There are no NULLs in the sort column, so we can just use it directly.
+ $sort_column = $album->sort_column;
+
+ $position = $query_model->viewable()
+ ->where("parent_id", "=", $album->id)
+ ->where($sort_column, $comp, $item->$sort_column)
+ ->merge_where($where)
+ ->count_all();
+
+ // We stopped short of our target value in the sort (notice that we're
+ // using a < comparator above) because it's possible that we have
+ // duplicate values in the sort column. An equality check would just
+ // arbitrarily pick one of those multiple possible equivalent columns,
+ // which would mean that if you choose a sort order that has duplicates,
+ // it'd pick any one of them as the child's "position".
+ //
+ // Fix this by doing a 2nd query where we iterate over the equivalent
+ // columns and add them to our base value.
+ foreach ($query_model->viewable()
+ ->select("id")
+ ->where("parent_id", "=", $album->id)
+ ->where($sort_column, "=", $item->$sort_column)
+ ->merge_where($where)
+ ->order_by(array("id" => "ASC"))
+ ->find_all() as $row) {
+ $position++;
+ if ($row->id == $item->id) {
+ break;
+ }
+ }
+ } else {
+ // There are NULLs in the sort column, so we can't use MySQL comparators.
+ // Fall back to iterating over every child row to get to the current one.
+ // This can be wildly inefficient for really large albums, but it should
+ // be a rare case that the user is sorting an album with null values in
+ // the sort column.
+ //
+ // Reproduce the children() functionality here using Database directly to
+ // avoid loading the whole ORM for each row.
+ $order_by = array($album->sort_column => $album->sort_order);
+ // Use id as a tie breaker
+ if ($album->sort_column != "id") {
+ $order_by["id"] = "ASC";
+ }
+
+ $position = 0;
+ foreach ($query_model->viewable()
+ ->select("id")
+ ->where("parent_id", "=", $album->id)
+ ->merge_where($where)
+ ->order_by($order_by)
+ ->find_all() as $row) {
+ $position++;
+ if ($row->id == $item->id) {
+ break;
+ }
+ }
+ }
+
+ return $position;
+ }
}
\ No newline at end of file
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 88a444b4..47b062b8 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -546,83 +546,12 @@ class Item_Model_Core extends ORM_MPTT {
/**
* Find the position of the given child id in this album. The resulting value is 1-indexed, so
* the first child in the album is at position 1.
+ *
+ * This method stands as a backward compatibility for gallery 3.0, and will
+ * be deprecated in version 3.1.
*/
public function get_position($child, $where=array()) {
- if (!strcasecmp($this->sort_order, "DESC")) {
- $comp = ">";
- } else {
- $comp = "<";
- }
- $db = db::build();
-
- // If the comparison column has NULLs in it, we can't use comparators on it and will have to
- // deal with it the hard way.
- $count = $db->from("items")
- ->where("parent_id", "=", $this->id)
- ->where($this->sort_column, "IS", null)
- ->merge_where($where)
- ->count_records();
-
- if (empty($count)) {
- // There are no NULLs in the sort column, so we can just use it directly.
- $sort_column = $this->sort_column;
-
- $position = $db->from("items")
- ->where("parent_id", "=", $this->id)
- ->where($sort_column, $comp, $child->$sort_column)
- ->merge_where($where)
- ->count_records();
-
- // We stopped short of our target value in the sort (notice that we're using a < comparator
- // above) because it's possible that we have duplicate values in the sort column. An
- // equality check would just arbitrarily pick one of those multiple possible equivalent
- // columns, which would mean that if you choose a sort order that has duplicates, it'd pick
- // any one of them as the child's "position".
- //
- // Fix this by doing a 2nd query where we iterate over the equivalent columns and add them to
- // our base value.
- foreach ($db
- ->select("id")
- ->from("items")
- ->where("parent_id", "=", $this->id)
- ->where($sort_column, "=", $child->$sort_column)
- ->merge_where($where)
- ->order_by(array("id" => "ASC"))
- ->execute() as $row) {
- $position++;
- if ($row->id == $child->id) {
- break;
- }
- }
- } else {
- // There are NULLs in the sort column, so we can't use MySQL comparators. Fall back to
- // iterating over every child row to get to the current one. This can be wildly inefficient
- // for really large albums, but it should be a rare case that the user is sorting an album
- // with null values in the sort column.
- //
- // Reproduce the children() functionality here using Database directly to avoid loading the
- // whole ORM for each row.
- $order_by = array($this->sort_column => $this->sort_order);
- // Use id as a tie breaker
- if ($this->sort_column != "id") {
- $order_by["id"] = "ASC";
- }
-
- $position = 0;
- foreach ($db->select("id")
- ->from("items")
- ->where("parent_id", "=", $this->id)
- ->merge_where($where)
- ->order_by($order_by)
- ->execute() as $row) {
- $position++;
- if ($row->id == $child->id) {
- break;
- }
- }
- }
-
- return $position;
+ return item::get_position($child, $where);
}
/**
--
cgit v1.2.3
From bd6bd029a7c2e0247d4da931c49f3731498cd303 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 10 Jan 2011 14:04:15 -0800
Subject: Fix up the version detecting regex for GraphicsMagick and don't crash
if the regex doesn't return properly. Follow on to
3ec0ba956dced01a97f2ee7bd943d326c42350e3 for ticket #1595.
---
modules/gallery/helpers/graphics.php | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index a30699e8..29527705 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -321,16 +321,18 @@ class graphics_Core {
// ImageMagick & GraphicsMagick
$magick_kits = array(
"imagemagick" => array(
- "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v"),
+ "name" => "ImageMagick", "binary" => "convert", "version" => "convert -v",
+ "version_regex" => "/Version: \S+ (\S+)/"),
"graphicsmagick" => array(
- "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version"));
+ "name" => "GraphicsMagick", "binary" => "gm", "version" => "gm version",
+ "version_regex" => "/\S+ (\S+)/"));
// Loop through the kits
foreach ($magick_kits as $index => $settings) {
$path = exec("which " . $settings["binary"]);
$toolkits->$index->name = $settings["name"];
if ($path) {
- if (@is_file($path)) {
- preg_match('/Version: \S+ (\S+)/', shell_exec($settings["version"]), $matches);
+ if (@is_file($path) &&
+ preg_match($settings["version_regex"], shell_exec($settings["version"]), $matches)) {
$version = $matches[1];
$toolkits->$index->installed = true;
--
cgit v1.2.3
From 23eaec7063b81d4dae04ec3f5c311a0a2f228a05 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 10 Jan 2011 15:49:15 -0800
Subject: Stop using "which" to find binaries. Create system::find_binary()
which traverses the $PATH and returns any executable binary of the
appropriate name that it can find. Fixes #1555.
---
modules/gallery/helpers/graphics.php | 8 ++-----
modules/gallery/helpers/movie.php | 14 +++++-------
modules/gallery/helpers/system.php | 43 ++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 15 deletions(-)
create mode 100644 modules/gallery/helpers/system.php
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 29527705..18820ed7 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -313,11 +313,6 @@ class graphics_Core {
$toolkits->graphicsmagick->installed = false;
$toolkits->graphicsmagick->error = t("GraphicsMagick requires the exec function");
} else {
- gallery::set_path_env(
- array(module::get_var("gallery", "graphics_toolkit_path"),
- getenv("PATH"),
- module::get_var("gallery", "extra_binary_paths")));
-
// ImageMagick & GraphicsMagick
$magick_kits = array(
"imagemagick" => array(
@@ -328,7 +323,8 @@ class graphics_Core {
"version_regex" => "/\S+ (\S+)/"));
// Loop through the kits
foreach ($magick_kits as $index => $settings) {
- $path = exec("which " . $settings["binary"]);
+ $path = system::find_binary(
+ $settings["binary"], module::get_var("gallery", "graphics_toolkit_path"));
$toolkits->$index->name = $settings["name"];
if ($path) {
if (@is_file($path) &&
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 0895c5f4..dd0b437e 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -83,22 +83,18 @@ class movie_Core {
}
}
+ /**
+ * Return the path to the ffmpeg binary if one exists and is executable, or null.
+ */
static function find_ffmpeg() {
if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) {
- gallery::set_path_env(
- array(module::get_var("gallery", "graphics_toolkit_path"),
- getenv("PATH"),
- module::get_var("gallery", "extra_binary_paths")));
- if (function_exists("exec")) {
- $ffmpeg_path = exec("which ffmpeg");
- }
-
+ $ffmpeg_path = system::find_binary(
+ "ffmpeg", module::get_var("gallery", "graphics_toolkit_path"));
module::set_var("gallery", "ffmpeg_path", $ffmpeg_path);
}
return $ffmpeg_path;
}
-
/**
* Return the width, height, mime_type and extension of the given movie file.
*/
diff --git a/modules/gallery/helpers/system.php b/modules/gallery/helpers/system.php
new file mode 100644
index 00000000..4a6a3c0f
--- /dev/null
+++ b/modules/gallery/helpers/system.php
@@ -0,0 +1,43 @@
+
Date: Tue, 11 Jan 2011 01:04:10 -0800
Subject: Don't resize if the target size is the same as the original. Fixes
#1602.
---
modules/gallery/helpers/gallery_graphics.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/gallery_graphics.php b/modules/gallery/helpers/gallery_graphics.php
index fca18076..4cd7143e 100644
--- a/modules/gallery/helpers/gallery_graphics.php
+++ b/modules/gallery/helpers/gallery_graphics.php
@@ -56,7 +56,7 @@ class gallery_graphics_Core {
}
$dims = getimagesize($input_file);
- if (max($dims[0], $dims[1]) < min($options["width"], $options["height"])) {
+ if (max($dims[0], $dims[1]) <= min($options["width"], $options["height"])) {
// Image would get upscaled; do nothing
copy($input_file, $output_file);
} else {
--
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/helpers')
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 92db7f42181f6582763e7b5c56b18b989b061e21 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Tue, 11 Jan 2011 15:23:20 -0800
Subject: Update some comments.
---
modules/gallery/helpers/item.php | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index a2d5f74d..8aa14934 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -308,6 +308,9 @@ class item_Core {
/**
* Find the position of the given item in its parent album. The resulting
* value is 1-indexed, so the first child in the album is at position 1.
+ *
+ * @param Item_Model $item
+ * @param array $where an array of arrays, each compatible with ORM::where()
*/
static function get_position($item, $where=array()) {
$album = $item->parent();
@@ -338,14 +341,14 @@ class item_Core {
->count_all();
// We stopped short of our target value in the sort (notice that we're
- // using a < comparator above) because it's possible that we have
+ // using a inequality comparator above) because it's possible that we have
// duplicate values in the sort column. An equality check would just
// arbitrarily pick one of those multiple possible equivalent columns,
// which would mean that if you choose a sort order that has duplicates,
// it'd pick any one of them as the child's "position".
//
// Fix this by doing a 2nd query where we iterate over the equivalent
- // columns and add them to our base value.
+ // columns and add them to our position count.
foreach ($query_model->viewable()
->select("id")
->where("parent_id", "=", $album->id)
--
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/helpers')
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 ee13b934f46d67982e5eeea21f81ac58f166741c Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sat, 15 Jan 2011 13:14:43 -0800
Subject: Fix all the head() and admin_head() theme callbacks to return the
results of the $theme->css() and $theme->script() calls. This handles the
case where combining scripts/css returns HTML instead of putting it in the
queue for combination. Fixes #1611.
---
modules/comment/helpers/comment_theme.php | 8 +++-----
modules/digibug/helpers/digibug_theme.php | 2 +-
modules/gallery/helpers/gallery_theme.php | 27 +++++++++++++------------
modules/recaptcha/helpers/recaptcha_theme.php | 4 ++--
modules/server_add/helpers/server_add_theme.php | 18 ++++++++---------
modules/tag/helpers/tag_theme.php | 10 ++++-----
modules/user/helpers/user_theme.php | 8 ++++----
7 files changed, 38 insertions(+), 39 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php
index b993cdae..9cc93fa1 100644
--- a/modules/comment/helpers/comment_theme.php
+++ b/modules/comment/helpers/comment_theme.php
@@ -19,14 +19,12 @@
*/
class comment_theme_Core {
static function head($theme) {
- $theme->css("comment.css");
- $theme->script("comment.js");
- return "";
+ return $theme->css("comment.css")
+ . $theme->script("comment.js");
}
static function admin_head($theme) {
- $theme->css("comment.css");
- return "";
+ return $theme->css("comment.css");
}
static function photo_bottom($theme) {
diff --git a/modules/digibug/helpers/digibug_theme.php b/modules/digibug/helpers/digibug_theme.php
index d146e17d..1106910e 100644
--- a/modules/digibug/helpers/digibug_theme.php
+++ b/modules/digibug/helpers/digibug_theme.php
@@ -19,6 +19,6 @@
*/
class digibug_theme_Core {
static function head($theme) {
- $theme->script("digibug.js");
+ return $theme->script("digibug.js");
}
}
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index 978c69a6..ebf8f38e 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -21,9 +21,9 @@ class gallery_theme_Core {
static function head($theme) {
$session = Session::instance();
$buf = "";
- $theme->css("gallery.css");
+ $buf .= $theme->css("gallery.css");
if ($session->get("debug")) {
- $theme->css("debug.css");
+ $buf .= $theme->css("debug.css");
}
if (module::is_active("rss")) {
@@ -40,32 +40,33 @@ class gallery_theme_Core {
if (count(locales::installed())) {
// Needed by the languages block
- $theme->script("jquery.cookie.js");
+ $buf .= $theme->script("jquery.cookie.js");
}
if ($session->get("l10n_mode", false)) {
- $theme->css("l10n_client.css");
- $theme->script("jquery.cookie.js");
- $theme->script("l10n_client.js");
+ $buf .= $theme->css("l10n_client.css")
+ . $theme->script("jquery.cookie.js")
+ . $theme->script("l10n_client.js");
}
- $theme->css("uploadify/uploadify.css");
+ $buf .= $theme->css("uploadify/uploadify.css");
return $buf;
}
static function admin_head($theme) {
- $theme->css("gallery.css");
- $theme->script("gallery.panel.js");
+ $buf = $theme->css("gallery.css");
+ $buf .= $theme->script("gallery.panel.js");
$session = Session::instance();
if ($session->get("debug")) {
- $theme->css("debug.css");
+ $buf .= $theme->css("debug.css");
}
if ($session->get("l10n_mode", false)) {
- $theme->css("l10n_client.css");
- $theme->script("jquery.cookie.js");
- $theme->script("l10n_client.js");
+ $buf .= $theme->css("l10n_client.css");
+ $buf .= $theme->script("jquery.cookie.js");
+ $buf .=$theme->script("l10n_client.js");
}
+ return $buf;
}
static function page_bottom($theme) {
diff --git a/modules/recaptcha/helpers/recaptcha_theme.php b/modules/recaptcha/helpers/recaptcha_theme.php
index ee880986..3677a7c7 100644
--- a/modules/recaptcha/helpers/recaptcha_theme.php
+++ b/modules/recaptcha/helpers/recaptcha_theme.php
@@ -19,10 +19,10 @@
*/
class recaptcha_theme_Core {
static function head($theme) {
- $theme->css("recaptcha.css");
+ return $theme->css("recaptcha.css");
}
static function admin_head($theme) {
- $theme->css("recaptcha.css");
+ return $theme->css("recaptcha.css");
}
}
\ No newline at end of file
diff --git a/modules/server_add/helpers/server_add_theme.php b/modules/server_add/helpers/server_add_theme.php
index 53f78772..6395c2f0 100644
--- a/modules/server_add/helpers/server_add_theme.php
+++ b/modules/server_add/helpers/server_add_theme.php
@@ -20,24 +20,24 @@
class server_add_theme_Core {
static function head($theme) {
if (identity::active_user()->admin) {
- $theme->css("server_add.css");
- $theme->script("server_add.js");
+ return $theme->css("server_add.css")
+ . $theme->script("server_add.js");
}
}
static function admin_head($theme) {
- $head = array();
+ $buf = "";
if (strpos(Router::$current_uri, "admin/server_add") !== false) {
- $theme->css("server_add.css");
- $theme->css("jquery.autocomplete.css");
+ $buf .= $theme->css("server_add.css")
+ . $theme->css("jquery.autocomplete.css");
$base = url::site("__ARGS__");
$csrf = access::csrf_token();
- $head[] = "";
+ $buf .= "";
- $theme->script("jquery.autocomplete.js");
- $theme->script("admin.js");
+ $buf .= $theme->script("jquery.autocomplete.js")
+ . $theme->script("admin.js");
}
- return implode("\n", $head);
+ return $buf;
}
}
\ No newline at end of file
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index f731dbb7..3325a832 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -19,13 +19,13 @@
*/
class tag_theme_Core {
static function head($theme) {
- $theme->css("jquery.autocomplete.css");
- $theme->script("jquery.autocomplete.js");
- $theme->css("tag.css");
+ return $theme->css("jquery.autocomplete.css")
+ . $theme->script("jquery.autocomplete.js")
+ . $theme->css("tag.css");
}
static function admin_head($theme) {
- $theme->css("tag.css");
- $theme->script("gallery.in_place_edit.js");
+ return $theme->css("tag.css")
+ . $theme->script("gallery.in_place_edit.js");
}
}
\ No newline at end of file
diff --git a/modules/user/helpers/user_theme.php b/modules/user/helpers/user_theme.php
index 5a7161ed..70e96f70 100644
--- a/modules/user/helpers/user_theme.php
+++ b/modules/user/helpers/user_theme.php
@@ -19,12 +19,12 @@
*/
class user_theme_Core {
static function head($theme) {
- $theme->css("user.css");
- $theme->script("password_strength.js");
+ return $theme->css("user.css")
+ . $theme->script("password_strength.js");
}
static function admin_head($theme) {
- $theme->css("user.css");
- $theme->script("password_strength.js");
+ return $theme->css("user.css")
+ . $theme->script("password_strength.js");
}
}
\ No newline at end of file
--
cgit v1.2.3
From 0020f87d6a23ce00200074b678a9293d055e27a3 Mon Sep 17 00:00:00 2001
From: Joe7
Date: Sat, 15 Jan 2011 21:49:22 +0100
Subject: Fixed paging for albums ordered by random. MySql has problems when
comparing float values against -seemingly same- float input, see
http://dev.mysql.com/doc/refman/5.0/en/problems-with-float.html for details.
Fixes #1610
---
installer/install.sql | 4 ++--
modules/gallery/helpers/gallery_installer.php | 9 +++++++--
modules/gallery/module.info | 2 +-
3 files changed, 10 insertions(+), 5 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/installer/install.sql b/installer/install.sql
index 0ed7f2f3..07aae36d 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -160,7 +160,7 @@ CREATE TABLE {items} (
`name` varchar(255) DEFAULT NULL,
`owner_id` int(9) DEFAULT NULL,
`parent_id` int(9) NOT NULL,
- `rand_key` float DEFAULT NULL,
+ `rand_key` decimal(11,10) DEFAULT NULL,
`relative_path_cache` varchar(255) DEFAULT NULL,
`relative_url_cache` varchar(255) DEFAULT NULL,
`resize_dirty` tinyint(1) DEFAULT '1',
@@ -244,7 +244,7 @@ CREATE TABLE {modules} (
KEY `weight` (`weight`)
) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
-INSERT INTO {modules} VALUES (1,1,'gallery',43,1);
+INSERT INTO {modules} VALUES (1,1,'gallery',44,1);
INSERT INTO {modules} VALUES (2,1,'user',3,2);
INSERT INTO {modules} VALUES (3,1,'comment',3,3);
INSERT INTO {modules} VALUES (4,1,'organize',3,4);
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index f7b8da5f..3c7b1c84 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -92,7 +92,7 @@ class gallery_installer {
`name` varchar(255) default NULL,
`owner_id` int(9) default NULL,
`parent_id` int(9) NOT NULL,
- `rand_key` float default NULL,
+ `rand_key` decimal(11,10) default NULL,
`relative_path_cache` varchar(255) default NULL,
`relative_url_cache` varchar(255) default NULL,
`resize_dirty` boolean default 1,
@@ -309,7 +309,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", 43);
+ module::set_version("gallery", 44);
}
static function upgrade($version) {
@@ -653,6 +653,11 @@ class gallery_installer {
$db->query("ALTER TABLE {items} CHANGE `description` `description` text DEFAULT NULL");
module::set_version("gallery", $version = 43);
}
+
+ if ($version == 43) {
+ $db->query("ALTER TABLE {items} CHANGE `rand_key` `rand_key` DECIMAL(11, 10)");
+ module::set_version("gallery", $version = 44);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index eb579ab6..4c4e63a1 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 43
+version = 44
--
cgit v1.2.3
From ac44e9c930ec83545b37e1e31381919fbd849d26 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 16 Jan 2011 15:49:34 -0800
Subject: First step in setting up version checking.
We now have two types of packages (release, git). Instead of using
constants, we now have gallery::version_string() which returns the
current version string. If you're on a release package, then the
version string looks like:
3.0 (Santa Fe)
If you're on a git package, then the version string looks like this:
3.0.1 (branch 3.0.x build 3)
We track the build number in a new file in the gallery3 root called
BUILD_NUMBER which we will update periodically with the latest
build number for each branch.
---
BUILD_NUMBER | 1 +
modules/gallery/helpers/gallery.php | 25 +++++++++++++++++++++++-
modules/gallery/helpers/gallery_theme.php | 2 +-
modules/gallery/views/admin_block_stats.html.php | 2 +-
4 files changed, 27 insertions(+), 3 deletions(-)
create mode 100644 BUILD_NUMBER
(limited to 'modules/gallery/helpers')
diff --git a/BUILD_NUMBER b/BUILD_NUMBER
new file mode 100644
index 00000000..d00491fd
--- /dev/null
+++ b/BUILD_NUMBER
@@ -0,0 +1 @@
+1
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 282289b5..c4a6286c 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -18,7 +18,10 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class gallery_Core {
- const VERSION = "3.0+ (git)";
+ const VERSION = "3.0+";
+ const CODE_NAME = "";
+ const RELEASE_CHANNEL = "git";
+ const RELEASE_BRANCH = "master";
/**
* If Gallery is in maintenance mode, then force all non-admins to get routed to a "This site is
@@ -184,4 +187,24 @@ class gallery_Core {
}
putenv("PATH=" . implode(":", $path_env));
}
+
+ /**
+ * Return a string describing this version of Gallery and the type of release.
+ */
+ static function version_string() {
+ if (gallery::RELEASE_CHANNEL == "git") {
+ return sprintf(
+ "%s (branch %s build %s)", gallery::VERSION, gallery::RELEASE_BRANCH, gallery::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.
+ */
+ static function build_number() {
+ $lines = file(DOCROOT . "BUILD_NUMBER", FILE_IGNORE_NEW_LINES);
+ return $lines[0];
+ }
}
\ No newline at end of file
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index ebf8f38e..d75c6fc6 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -115,7 +115,7 @@ class gallery_theme_Core {
static function credits() {
$version_string = SafeString::of_safe_html(
- 'Gallery ' . gallery::VERSION . '');
+ 'Gallery ' . gallery::version_string() . '');
return "" .
t(module::get_var("gallery", "credits"),
array("url" => "http://gallery.menalto.com",
diff --git a/modules/gallery/views/admin_block_stats.html.php b/modules/gallery/views/admin_block_stats.html.php
index 1dec8ccd..c8c54765 100644
--- a/modules/gallery/views/admin_block_stats.html.php
+++ b/modules/gallery/views/admin_block_stats.html.php
@@ -1,7 +1,7 @@
-
- = t("Version: %version", array("version" => gallery::VERSION)) ?>
+ = t("Version: %version", array("version" => gallery::version_string())) ?>
-
= t("Albums: %count", array("count" => $album_count)) ?>
--
cgit v1.2.3
From b78b1090184dd863c984e54652935963cc502eb8 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 16 Jan 2011 17:10:30 -0800
Subject: Fix indentation.
---
modules/gallery/helpers/gallery.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index c4a6286c..31b342db 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -194,7 +194,8 @@ class gallery_Core {
static function version_string() {
if (gallery::RELEASE_CHANNEL == "git") {
return sprintf(
- "%s (branch %s build %s)", gallery::VERSION, gallery::RELEASE_BRANCH, gallery::build_number());
+ "%s (branch %s build %s)", gallery::VERSION, gallery::RELEASE_BRANCH,
+ gallery::build_number());
} else {
return sprintf("%s (%s)", gallery::VERSION, gallery::CODE_NAME);
}
--
cgit v1.2.3
From 84d576606d709dcccef2549fdb926d47494a876c Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 16 Jan 2011 21:46:03 -0800
Subject: Change the value column of the messages table from a varchar(255) to
a text. Fixes #1612.
---
modules/gallery/helpers/gallery_installer.php | 9 +++++++--
modules/gallery/module.info | 2 +-
2 files changed, 8 insertions(+), 3 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 3c7b1c84..92e5b7b8 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -136,7 +136,7 @@ class gallery_installer {
`id` int(9) NOT NULL auto_increment,
`key` varchar(255) default NULL,
`severity` varchar(32) default NULL,
- `value` varchar(255) default NULL,
+ `value` text default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`key`))
DEFAULT CHARSET=utf8;");
@@ -309,7 +309,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", 44);
+ module::set_version("gallery", 45);
}
static function upgrade($version) {
@@ -658,6 +658,11 @@ class gallery_installer {
$db->query("ALTER TABLE {items} CHANGE `rand_key` `rand_key` DECIMAL(11, 10)");
module::set_version("gallery", $version = 44);
}
+
+ if ($version == 44) {
+ $db->query("ALTER TABLE {messages} CHANGE `value` `value` text default NULL");
+ module::set_version("gallery", $version = 45);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/module.info b/modules/gallery/module.info
index 4c4e63a1..b79df7be 100644
--- a/modules/gallery/module.info
+++ b/modules/gallery/module.info
@@ -1,3 +1,3 @@
name = "Gallery 3"
description = "Gallery core application"
-version = 44
+version = 45
--
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/helpers')
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 @@
+
+
+ = t("Gallery can check to see if there is a new version available for you to use. It is a good idea to upgrade your Gallery to get the latest features and security fixes. Your privacy is important so no information about your Gallery is shared during this process. You can disable this feature below.") ?>
+
+
+
+ if (gallery::RELEASE_CHANNEL == "release"): ?>
+ = t("You are using the official Gallery %version release, code named %code_name.", array("version" => gallery::VERSION, "code_name" => gallery::CODE_NAME)) ?>
+ 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())) ?>
+ endif ?>
+
+
+
+ ">
+ = t("Check now") ?>
+
+ if ($auto_check_enabled): ?>
+ ">
+ = t("Disable automatic checking") ?>
+
+ else: ?>
+ ">
+ = t("Enable automatic checking") ?>
+
+ endif ?>
+
+
+
+ if ($auto_check_enabled): ?>
+ = t("Automatic upgrade checking is enabled.") ?>
+ else: ?>
+ = t("Automatic upgrade checking is disabled.") ?>
+ endif ?>
+ if (!$version_info): ?>
+ = t("No upgrade checks have been made yet.") ?>
+ else: ?>
+ = t("The last upgrade check was made on %date.",
+ array("date" => gallery::date_time($version_info->timestamp))) ?>
+ endif ?>
+
+
--
cgit v1.2.3
From 167f635a6ce5a71b35450844f9b5c647aa14bcc1 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 16 Jan 2011 23:06:19 -0800
Subject: Add arguments to random::int() to match mt_rand(). Follow on to
cd48b89f3166e7fa732b5cb06d33fba018af9127 for #1527.
---
modules/gallery/helpers/random.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/random.php b/modules/gallery/helpers/random.php
index a26762bd..dfc7558c 100644
--- a/modules/gallery/helpers/random.php
+++ b/modules/gallery/helpers/random.php
@@ -42,9 +42,13 @@ class random_Core {
}
/**
- * Return a random number between 0 and mt_getrandmax()
+ * Return a random number between $min and $max. If $min and $max are not specified,
+ * return a random number between 0 and mt_getrandmax()
*/
- static function int() {
+ static function int($min=null, $max=null) {
+ if ($min || $max) {
+ return mt_rand($min, $max);
+ }
return mt_rand();
}
}
\ No newline at end of file
--
cgit v1.2.3
From 66bb496b6c2ad9c5341644b2e303e694078374d1 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 16 Jan 2011 23:14:57 -0800
Subject: If the logged in user is an admin and it's been more than 7 days
since the last check and auto upgrade checking is enabled, fire off an XHR to
check for a possible upgrade. Finishes off #1605.
---
modules/gallery/helpers/gallery_installer.php | 3 +++
modules/gallery/helpers/gallery_theme.php | 20 ++++++++++++++++++--
modules/gallery/helpers/upgrade_checker.php | 25 +++++++++++++++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 1ffe9bae..41ed1c6e 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -677,6 +677,9 @@ 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() {
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index d75c6fc6..a6ca5eb7 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -76,13 +76,22 @@ class gallery_theme_Core {
$profiler = new Profiler();
$profiler->render();
}
+ $content = "";
if ($session->get("l10n_mode", false)) {
- return L10n_Client_Controller::l10n_form();
+ $content .= L10n_Client_Controller::l10n_form();
}
if ($session->get_once("after_install")) {
- return new View("welcome_message_loader.html");
+ $content .= new View("welcome_message_loader.html");
}
+
+ if (identity::active_user()->admin && upgrade_checker::should_auto_check()) {
+ $content .= '';
+ }
+ return $content;
}
static function admin_page_bottom($theme) {
@@ -107,6 +116,13 @@ class gallery_theme_Core {
setInterval("adminReauthCheck();", 60 * 1000);
';
+ if (upgrade_checker::should_auto_check()) {
+ $content .= '';
+ }
+
if ($session->get("l10n_mode", false)) {
$content .= "\n" . L10n_Client_Controller::l10n_form();
}
diff --git a/modules/gallery/helpers/upgrade_checker.php b/modules/gallery/helpers/upgrade_checker.php
index 9311cf4a..ef1308d7 100644
--- a/modules/gallery/helpers/upgrade_checker.php
+++ b/modules/gallery/helpers/upgrade_checker.php
@@ -19,15 +19,37 @@
*/
class upgrade_checker_Core {
const CHECK_URL = "http://gallery.menalto.com/versioncheck/gallery3";
+ const AUTO_CHECK_INTERVAL = 604800; // 7 days in seconds
+ /**
+ * Return the last version info blob retrieved from the Gallery website or
+ * null if no checks have been performed.
+ */
static function version_info() {
return unserialize(Cache::instance()->get("upgrade_checker_version_info"));
}
+ /**
+ * Return true if auto checking is enabled.
+ */
static function auto_check_enabled() {
return (bool)module::get_var("gallery", "upgrade_checker_auto_enabled");
}
+ /**
+ * Return true if it's time to auto check.
+ */
+ static function should_auto_check() {
+ if (upgrade_checker::auto_check_enabled() && random::int(1, 100) == 1) {
+ $version_info = upgrade_checker::version_info();
+ return (!$version_info || (time() - $version_info->timestamp) > AUTO_CHECK_INTERVAL);
+ }
+ return false;
+ }
+
+ /**
+ * Fech version info from the Gallery website.
+ */
static function fetch_version_info() {
$result = new stdClass();
try {
@@ -52,6 +74,9 @@ class upgrade_checker_Core {
Cache::instance()->set("upgrade_checker_version_info", serialize($result), null, 86400 * 365);
}
+ /**
+ * Check the latest version info blob to see if it's time for an upgrade.
+ */
static function check_for_upgrade() {
$version_info = upgrade_checker::version_info();
$upgrade_available = false;
--
cgit v1.2.3
From 14ae5d854400d632b63a331f541f180b8d1f3ea1 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 17 Jan 2011 17:07:32 -0800
Subject: Update version checking code to expect "branch_" as the prefix for
all branch related lines. For #1605.
---
modules/gallery/helpers/upgrade_checker.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/modules/gallery/helpers/upgrade_checker.php b/modules/gallery/helpers/upgrade_checker.php
index ef1308d7..0e72bb94 100644
--- a/modules/gallery/helpers/upgrade_checker.php
+++ b/modules/gallery/helpers/upgrade_checker.php
@@ -93,14 +93,14 @@ class upgrade_checker_Core {
}
} else {
$branch = gallery::RELEASE_BRANCH;
- if (isset($version_info->data["{$branch}_build_number"]) &&
- version_compare($version_info->data["{$branch}_build_number"],
+ 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}_version"],
- "upgrade-url" => $version_info->data["{$branch}_upgrade_url"],
- "build" => $version_info->data["{$branch}_build_number"],
+ 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");
--
cgit v1.2.3
From 29be21bb0deaf70558b1aa02a115e67daefea0bd Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 17 Jan 2011 17:27:16 -0800
Subject: Add BUILD_NUMBER to the security check in .htaccess Change
BUILD_NUMBER to be .ini format and add a big "do not edit" comment.
---
.htaccess | 2 +-
BUILD_NUMBER | 7 ++++++-
modules/gallery/helpers/gallery.php | 4 ++--
3 files changed, 9 insertions(+), 4 deletions(-)
(limited to 'modules/gallery/helpers')
diff --git a/.htaccess b/.htaccess
index 5a329520..771a8df0 100644
--- a/.htaccess
+++ b/.htaccess
@@ -29,7 +29,7 @@
# in your Apache2 config file before you uncomment this block or
# you'll get an "Internal Server Error".
#
-#
+#
# Order deny,allow
# Deny from all
#
diff --git a/BUILD_NUMBER b/BUILD_NUMBER
index 0691f67b..d32d51e9 100644
--- a/BUILD_NUMBER
+++ b/BUILD_NUMBER
@@ -1 +1,6 @@
-52
+; This file keeps track of the build number for the "master"
+; branch of gallery3. It's kept up to date by an automated
+; process. You don't need to edit it. In fact..
+;
+; DO NOT EDIT THIS FILE BY HAND!
+build_number=52
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 31b342db..7a60f56a 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -205,7 +205,7 @@ class gallery_Core {
* Return the contents of the BUILD_NUMBER file, which should be a single integer.
*/
static function build_number() {
- $lines = file(DOCROOT . "BUILD_NUMBER", FILE_IGNORE_NEW_LINES);
- return $lines[0];
+ $result = parse_ini_file(DOCROOT . "BUILD_NUMBER");
+ return $result["build_number"];
}
}
\ No newline at end of file
--
cgit v1.2.3
From 76411d7d6d481bc2ab51e24ec2dbf003f43ce40b Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 17 Jan 2011 17:33:10 -0800
Subject: Rename BUILD_NUMBER to .build_number so it's not so loud.
---
.build_number | 6 ++++++
.gitattributes | 2 +-
BUILD_NUMBER | 6 ------
modules/gallery/helpers/gallery.php | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
create mode 100644 .build_number
delete mode 100644 BUILD_NUMBER
(limited to 'modules/gallery/helpers')
diff --git a/.build_number b/.build_number
new file mode 100644
index 00000000..d32d51e9
--- /dev/null
+++ b/.build_number
@@ -0,0 +1,6 @@
+; This file keeps track of the build number for the "master"
+; branch of gallery3. It's kept up to date by an automated
+; process. You don't need to edit it. In fact..
+;
+; DO NOT EDIT THIS FILE BY HAND!
+build_number=52
diff --git a/.gitattributes b/.gitattributes
index 9122eeb1..fdf9d072 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,2 +1,2 @@
-BUILD_NUMBER merge=merge-keep-ours
+.build_number merge=merge-keep-ours
diff --git a/BUILD_NUMBER b/BUILD_NUMBER
deleted file mode 100644
index d32d51e9..00000000
--- a/BUILD_NUMBER
+++ /dev/null
@@ -1,6 +0,0 @@
-; This file keeps track of the build number for the "master"
-; branch of gallery3. It's kept up to date by an automated
-; process. You don't need to edit it. In fact..
-;
-; DO NOT EDIT THIS FILE BY HAND!
-build_number=52
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 7a60f56a..ad9f40e8 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -202,10 +202,10 @@ class gallery_Core {
}
/**
- * 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.
*/
static function build_number() {
- $result = parse_ini_file(DOCROOT . "BUILD_NUMBER");
+ $result = parse_ini_file(DOCROOT . ".build_number");
return $result["build_number"];
}
}
\ No newline at end of file
--
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/helpers')
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/helpers')
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 @@
endif ?>
+ if ($new_version): ?>
+
+ -
+ = $new_version ?>
+
+
+ endif ?>
+
">
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 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/helpers')
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 @@