summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.build_number2
-rw-r--r--installer/install.sql6
-rw-r--r--lib/gallery.dialog.js4
-rw-r--r--lib/gallery.panel.js2
-rw-r--r--lib/gallery.show_full_size.js2
-rw-r--r--modules/comment/helpers/comment_installer.php19
-rw-r--r--modules/comment/models/comment.php4
-rw-r--r--modules/comment/module.info2
-rw-r--r--modules/exif/helpers/exif.php10
-rw-r--r--modules/exif/helpers/exif_event.php6
-rw-r--r--modules/g2_import/helpers/g2_import.php2
-rw-r--r--modules/gallery/controllers/admin_themes.php3
-rw-r--r--modules/gallery/controllers/admin_upgrade_checker.php2
-rw-r--r--modules/gallery/controllers/login.php5
-rw-r--r--modules/gallery/controllers/quick.php2
-rw-r--r--modules/gallery/helpers/encoding.php32
-rw-r--r--modules/gallery/helpers/gallery.php16
-rw-r--r--modules/gallery/helpers/gallery_block.php1
-rw-r--r--modules/gallery/helpers/gallery_event.php6
-rw-r--r--modules/gallery/helpers/gallery_graphics.php21
-rw-r--r--modules/gallery/helpers/graphics.php2
-rw-r--r--modules/gallery/helpers/theme.php23
-rw-r--r--modules/gallery/helpers/upgrade_checker.php3
-rw-r--r--modules/gallery/libraries/Gallery_View.php6
-rw-r--r--modules/gallery/views/admin_languages.html.php2
-rw-r--r--modules/gallery/views/admin_maintenance.html.php2
-rw-r--r--modules/gallery/views/admin_modules.html.php2
-rw-r--r--modules/gallery/views/upgrade_checker_block.html.php4
-rw-r--r--modules/search/controllers/search.php6
-rw-r--r--modules/search/helpers/search.php16
-rw-r--r--modules/server_add/controllers/server_add.php2
-rw-r--r--modules/tag/controllers/tag.php4
-rw-r--r--modules/tag/helpers/tag_event.php14
-rw-r--r--modules/tag/helpers/tag_item_rest.php1
-rw-r--r--modules/tag/helpers/tag_items_rest.php1
-rw-r--r--modules/tag/models/tag.php2
-rw-r--r--modules/user/views/admin_users_group.html.php2
-rw-r--r--themes/admin_wind/views/admin.html.php6
-rw-r--r--themes/wind/views/page.html.php6
39 files changed, 182 insertions, 69 deletions
diff --git a/.build_number b/.build_number
index ba31e80f..07c6cdd4 100644
--- a/.build_number
+++ b/.build_number
@@ -3,4 +3,4 @@
; process. You don't need to edit it. In fact..
;
; DO NOT EDIT THIS FILE BY HAND!
-build_number=64
+build_number=90
diff --git a/installer/install.sql b/installer/install.sql
index 865cb2a4..77cda72b 100644
--- a/installer/install.sql
+++ b/installer/install.sql
@@ -67,8 +67,8 @@ CREATE TABLE {comments} (
`server_http_referer` varchar(255) DEFAULT NULL,
`server_http_user_agent` varchar(128) DEFAULT NULL,
`server_query_string` varchar(64) DEFAULT NULL,
- `server_remote_addr` varchar(32) DEFAULT NULL,
- `server_remote_host` varchar(64) DEFAULT NULL,
+ `server_remote_addr` varchar(40) DEFAULT NULL,
+ `server_remote_host` varchar(255) DEFAULT NULL,
`server_remote_port` varchar(16) DEFAULT NULL,
`state` varchar(15) DEFAULT 'unpublished',
`text` text,
@@ -246,7 +246,7 @@ CREATE TABLE {modules} (
/*!40101 SET character_set_client = @saved_cs_client */;
INSERT INTO {modules} VALUES (1,1,'gallery',46,1);
INSERT INTO {modules} VALUES (2,1,'user',3,2);
-INSERT INTO {modules} VALUES (3,1,'comment',3,3);
+INSERT INTO {modules} VALUES (3,1,'comment',4,3);
INSERT INTO {modules} VALUES (4,1,'organize',4,4);
INSERT INTO {modules} VALUES (5,1,'info',2,5);
INSERT INTO {modules} VALUES (6,1,'rss',1,6);
diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js
index ec187186..087b00ab 100644
--- a/lib/gallery.dialog.js
+++ b/lib/gallery.dialog.js
@@ -48,7 +48,7 @@
var content = "";
if (mimeType[1] == "application/json") {
data = JSON.parse(data);
- content = unescape(data.html);
+ content = data.html;
} else {
content = data;
}
@@ -160,7 +160,7 @@
}
if (data.html) {
- $("#g-dialog").html(unescape(data.html));
+ $("#g-dialog").html(data.html);
$("#g-dialog").dialog("option", "position", "center");
$("#g-dialog form :submit").removeClass("ui-state-disabled")
.attr("disabled", null);
diff --git a/lib/gallery.panel.js b/lib/gallery.panel.js
index e0605ca3..0683c531 100644
--- a/lib/gallery.panel.js
+++ b/lib/gallery.panel.js
@@ -48,7 +48,7 @@
var content = "";
if (mimeType[1] == "application/json") {
data = JSON.parse(data);
- content = unescape(data.html);
+ content = data.html;
} else {
content = data;
}
diff --git a/lib/gallery.show_full_size.js b/lib/gallery.show_full_size.js
index 531d2a3a..0baee882 100644
--- a/lib/gallery.show_full_size.js
+++ b/lib/gallery.show_full_size.js
@@ -20,7 +20,7 @@
image_size = $.gallery_auto_fit_window(image_width, image_height);
} else {
image_size = {
- top: Math.round((height - image_height) / 2),
+ top: 12,
left: Math.round((width - image_width) / 2),
width: Math.round(image_width),
height: Math.round(image_height)
diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php
index 48b6ee21..5c6bd586 100644
--- a/modules/comment/helpers/comment_installer.php
+++ b/modules/comment/helpers/comment_installer.php
@@ -37,8 +37,8 @@ class comment_installer {
`server_http_referer` varchar(255) default NULL,
`server_http_user_agent` varchar(128) default NULL,
`server_query_string` varchar(64) default NULL,
- `server_remote_addr` varchar(32) default NULL,
- `server_remote_host` varchar(64) default NULL,
+ `server_remote_addr` varchar(40) default NULL,
+ `server_remote_host` varchar(255) default NULL,
`server_remote_port` varchar(16) default NULL,
`state` varchar(15) default 'unpublished',
`text` text,
@@ -48,7 +48,7 @@ class comment_installer {
module::set_var("comment", "spam_caught", 0);
module::set_var("comment", "access_permissions", "everybody");
- module::set_version("comment", 3);
+ module::set_version("comment", 4);
}
static function upgrade($version) {
@@ -62,6 +62,19 @@ class comment_installer {
module::set_var("comment", "access_permissions", "everybody");
module::set_version("comment", $version = 3);
}
+
+ if ($version == 3) {
+ // 40 bytes for server_remote_addr is enough to swallow the longest
+ // representation of an IPv6 addy.
+ //
+ // 255 bytes for server_remote_host is enough to swallow the longest
+ // legit DNS entry, with a few bytes to spare.
+ $db->query(
+ "ALTER TABLE {comments} CHANGE `server_remote_addr` `server_remote_addr` varchar(40)");
+ $db->query(
+ "ALTER TABLE {comments} CHANGE `server_remote_host` `server_remote_host` varchar(255)");
+ module::set_version("comment", $version = 4);
+ }
}
static function uninstall() {
diff --git a/modules/comment/models/comment.php b/modules/comment/models/comment.php
index d5e952eb..7c189a0e 100644
--- a/modules/comment/models/comment.php
+++ b/modules/comment/models/comment.php
@@ -98,8 +98,8 @@ class Comment_Model_Core extends ORM {
$this->server_http_referer = substr($input->server("HTTP_REFERER"), 0, 255);
$this->server_http_user_agent = substr($input->server("HTTP_USER_AGENT"), 0, 128);
$this->server_query_string = substr($input->server("QUERY_STRING"), 0, 64);
- $this->server_remote_addr = substr($input->server("REMOTE_ADDR"), 0, 32);
- $this->server_remote_host = substr($input->server("REMOTE_HOST"), 0, 64);
+ $this->server_remote_addr = substr($input->server("REMOTE_ADDR"), 0, 40);
+ $this->server_remote_host = substr($input->server("REMOTE_HOST"), 0, 255);
$this->server_remote_port = substr($input->server("REMOTE_PORT"), 0, 16);
}
diff --git a/modules/comment/module.info b/modules/comment/module.info
index cd34f140..e5aa454d 100644
--- a/modules/comment/module.info
+++ b/modules/comment/module.info
@@ -1,3 +1,3 @@
name = "Comments"
description = "Allows users and guests to leave comments on photos and albums."
-version = 3
+version = 4
diff --git a/modules/exif/helpers/exif.php b/modules/exif/helpers/exif.php
index 1cdf7d34..a35a2141 100644
--- a/modules/exif/helpers/exif.php
+++ b/modules/exif/helpers/exif.php
@@ -36,10 +36,7 @@ class exif_Core {
foreach(self::_keys() as $field => $exifvar) {
if (isset($exif_raw[$exifvar[0]][$exifvar[1]])) {
$value = $exif_raw[$exifvar[0]][$exifvar[1]];
- if (function_exists("mb_detect_encoding") &&
- mb_detect_encoding($value, "ISO-8859-1, UTF-8") != "UTF-8") {
- $value = utf8_encode($value);
- }
+ $value = encoding::convert_to_utf8($value);
$keys[$field] = Input::clean($value);
if ($field == "DateTime") {
@@ -60,10 +57,7 @@ class exif_Core {
foreach (array("Keywords" => "2#025", "Caption" => "2#120") as $keyword => $iptc_key) {
if (!empty($iptc[$iptc_key])) {
$value = implode(" ", $iptc[$iptc_key]);
- if (function_exists("mb_detect_encoding") &&
- mb_detect_encoding($value, "ISO-8859-1, UTF-8") != "UTF-8") {
- $value = utf8_encode($value);
- }
+ $value = encoding::convert_to_utf8($value);
$keys[$keyword] = Input::clean($value);
if ($keyword == "Caption" && !$item->description) {
diff --git a/modules/exif/helpers/exif_event.php b/modules/exif/helpers/exif_event.php
index e594c765..72e88041 100644
--- a/modules/exif/helpers/exif_event.php
+++ b/modules/exif/helpers/exif_event.php
@@ -24,6 +24,12 @@ class exif_event_Core {
}
}
+ static function item_updated_data_file($item) {
+ if (!$item->is_album()) {
+ exif::extract($item);
+ }
+ }
+
static function item_deleted($item) {
db::build()
->delete("exif_records")
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 5fd92972..22fb68c6 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -610,7 +610,7 @@ class g2_import_Core {
if ($g2_preferred && $g2_preferred instanceof GalleryDerivative) {
if (preg_match("/rotate\|(-?\d+)/", $g2_preferred->getDerivativeOperations(), $matches)) {
$tmpfile = tempnam(TMPPATH, "rotate");
- gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $matches[1]));
+ gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $matches[1]), $item);
$item->set_data_file($tmpfile);
$item->save();
unlink($tmpfile);
diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php
index cd8a5530..9cdc3db5 100644
--- a/modules/gallery/controllers/admin_themes.php
+++ b/modules/gallery/controllers/admin_themes.php
@@ -25,6 +25,9 @@ class Admin_Themes_Controller extends Admin_Controller {
$view->content->admin = module::get_var("gallery", "active_admin_theme");
$view->content->site = module::get_var("gallery", "active_site_theme");
$view->content->themes = $this->_get_themes();
+
+ site_status::clear("missing_site_theme");
+ site_status::clear("missing_admin_theme");
print $view;
}
diff --git a/modules/gallery/controllers/admin_upgrade_checker.php b/modules/gallery/controllers/admin_upgrade_checker.php
index a5cfcfc8..29d52a31 100644
--- a/modules/gallery/controllers/admin_upgrade_checker.php
+++ b/modules/gallery/controllers/admin_upgrade_checker.php
@@ -25,7 +25,7 @@ class Admin_Upgrade_Checker_Controller extends Admin_Controller {
if ($message) {
$message .= t(
" <a href=\"%hide-url\"><i>(remind me later)</i></a>",
- array("url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__")));
+ array("hide-url" => url::site("admin/upgrade_checker/remind_me_later?csrf=__CSRF__")));
site_status::info($message, "upgrade_checker");
} else {
site_status::clear("upgrade_checker");
diff --git a/modules/gallery/controllers/login.php b/modules/gallery/controllers/login.php
index b203b7d3..fdf5d7b7 100644
--- a/modules/gallery/controllers/login.php
+++ b/modules/gallery/controllers/login.php
@@ -42,8 +42,9 @@ class Login_Controller extends Controller {
public function html() {
$view = new Theme_View("page.html", "other", "login");
- $view->page_title = t("Login");
- $view->content = auth::get_login_form("login/auth_html");
+ $view->page_title = t("Log in to Gallery");
+ $view->content = new View("login_ajax.html");
+ $view->content->form = auth::get_login_form("login/auth_html");
print $view;
}
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index 17abc39f..da4768fd 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -38,7 +38,7 @@ class Quick_Controller extends Controller {
if ($degrees) {
$tmpfile = tempnam(TMPPATH, "rotate") . "." .
pathinfo($item->file_path(), PATHINFO_EXTENSION);
- gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees));
+ gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees), $item);
$item->set_data_file($tmpfile);
$item->save();
unlink($tmpfile);
diff --git a/modules/gallery/helpers/encoding.php b/modules/gallery/helpers/encoding.php
new file mode 100644
index 00000000..c5928634
--- /dev/null
+++ b/modules/gallery/helpers/encoding.php
@@ -0,0 +1,32 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2011 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class encoding_Core {
+ static function convert_to_utf8($value) {
+ if (function_exists("mb_detect_encoding") &&
+ function_exists("mb_convert_encoding") &&
+ mb_detect_encoding($value, "ISO-8859-1, UTF-8") != "UTF-8") {
+ $value = mb_convert_encoding($value, "UTF-8", mb_detect_encoding($value));
+ } else if (function_exists("mb_detect_encoding") &&
+ mb_detect_encoding($value, "ISO-8859-1, UTF-8") != "UTF-8") {
+ $value = utf8_encode($value);
+ }
+ return $value;
+ }
+} \ No newline at end of file
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php
index 1fafdef7..cbd9b33c 100644
--- a/modules/gallery/helpers/gallery.php
+++ b/modules/gallery/helpers/gallery.php
@@ -193,19 +193,25 @@ class gallery_Core {
*/
static function version_string() {
if (gallery::RELEASE_CHANNEL == "git") {
+ $build_number = gallery::build_number();
return sprintf(
- "%s (branch %s build %s)", gallery::VERSION, gallery::RELEASE_BRANCH,
- gallery::build_number());
+ "%s (branch %s, %s)", gallery::VERSION, gallery::RELEASE_BRANCH,
+ $build_number ? " build $build_number" : "unknown build number");
} else {
return sprintf("%s (%s)", gallery::VERSION, gallery::CODE_NAME);
}
}
/**
- * Return the contents of the .build_number file, which should be a single integer.
+ * Return the contents of the .build_number file, which should be a single integer
+ * or return null if the .build_number file is missing.
*/
static function build_number() {
- $result = parse_ini_file(DOCROOT . ".build_number");
- return $result["build_number"];
+ $build_file = DOCROOT . ".build_number";
+ if (file_exists($build_file)) {
+ $result = parse_ini_file(DOCROOT . ".build_number");
+ return $result["build_number"];
+ }
+ return null;
}
} \ No newline at end of file
diff --git a/modules/gallery/helpers/gallery_block.php b/modules/gallery/helpers/gallery_block.php
index b9ccf25b..0ba7c936 100644
--- a/modules/gallery/helpers/gallery_block.php
+++ b/modules/gallery/helpers/gallery_block.php
@@ -112,6 +112,7 @@ class gallery_block_Core {
$block->content->version_info = upgrade_checker::version_info();
$block->content->auto_check_enabled = upgrade_checker::auto_check_enabled();
$block->content->new_version = upgrade_checker::get_upgrade_message();
+ $block->content->build_number = gallery::build_number();
}
return $block;
}
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index 07817187..fbdb4ad5 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -539,9 +539,9 @@ class gallery_event_Core {
$v = new View("user_profile_info.html");
$fields = array("name" => t("Name"), "locale" => t("Language Preference"),
- "email" => t("Email"), "full_name" => t("Full name"), "url" => "Web site");
+ "email" => t("Email"), "full_name" => t("Full name"), "url" => t("Web site"));
if (!$data->user->guest) {
- $fields = array("name" => t("Name"), "full_name" => t("Full name"), "url" => "Web site");
+ $fields = array("name" => t("Name"), "full_name" => t("Full name"), "url" => t("Web site"));
}
$v->user_profile_data = array();
foreach ($fields as $field => $label) {
@@ -549,6 +549,8 @@ class gallery_event_Core {
$value = $data->user->$field;
if ($field == "locale") {
$value = locales::display_name($value);
+ } elseif ($field == "url") {
+ $value = html::mark_clean(html::anchor($data->user->$field));
}
$v->user_profile_data[(string) $label] = $value;
}
diff --git a/modules/gallery/helpers/gallery_graphics.php b/modules/gallery/helpers/gallery_graphics.php
index e63b9336..716bad18 100644
--- a/modules/gallery/helpers/gallery_graphics.php
+++ b/modules/gallery/helpers/gallery_graphics.php
@@ -24,18 +24,19 @@ class gallery_graphics_Core {
* @param string $input_file
* @param string $output_file
* @param array $options
+ * @param Item_Model $item (optional)
*/
- static function rotate($input_file, $output_file, $options) {
+ static function rotate($input_file, $output_file, $options, $item=null) {
graphics::init_toolkit();
- module::event("graphics_rotate", $input_file, $output_file, $options);
+ module::event("graphics_rotate", $input_file, $output_file, $options, $item);
Image::factory($input_file)
->quality(module::get_var("gallery", "image_quality"))
->rotate($options["degrees"])
->save($output_file);
- module::event("graphics_rotate_completed", $input_file, $output_file, $options);
+ module::event("graphics_rotate_completed", $input_file, $output_file, $options, $item);
}
/**
@@ -45,11 +46,12 @@ class gallery_graphics_Core {
* @param string $input_file
* @param string $output_file
* @param array $options
+ * @param Item_Model $item (optional)
*/
- static function resize($input_file, $output_file, $options) {
+ static function resize($input_file, $output_file, $options, $item=null) {
graphics::init_toolkit();
- module::event("graphics_resize", $input_file, $output_file, $options);
+ module::event("graphics_resize", $input_file, $output_file, $options, $item);
if (@filesize($input_file) == 0) {
throw new Exception("@todo EMPTY_INPUT_FILE");
@@ -69,7 +71,7 @@ class gallery_graphics_Core {
$image->save($output_file);
}
- module::event("graphics_resize_completed", $input_file, $output_file, $options);
+ module::event("graphics_resize_completed", $input_file, $output_file, $options, $item);
}
/**
@@ -86,12 +88,13 @@ class gallery_graphics_Core {
* @param string $input_file
* @param string $output_file
* @param array $options
+ * @param Item_Model $item (optional)
*/
- static function composite($input_file, $output_file, $options) {
+ static function composite($input_file, $output_file, $options, $item=null) {
try {
graphics::init_toolkit();
- module::event("graphics_composite", $input_file, $output_file, $options);
+ module::event("graphics_composite", $input_file, $output_file, $options, $item);
list ($width, $height) = getimagesize($input_file);
list ($w_width, $w_height) = getimagesize($options["file"]);
@@ -121,7 +124,7 @@ class gallery_graphics_Core {
->quality(module::get_var("gallery", "image_quality"))
->save($output_file);
- module::event("graphics_composite_completed", $input_file, $output_file, $options);
+ module::event("graphics_composite_completed", $input_file, $output_file, $options, $item);
} catch (ErrorException $e) {
Kohana_Log::add("error", $e->get_message());
}
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 72c563b7..04501132 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -169,7 +169,7 @@ class graphics_Core {
}
foreach (self::_get_rules($target) as $rule) {
- $args = array($working_file, $output_file, unserialize($rule->args));
+ $args = array($working_file, $output_file, unserialize($rule->args), $item);
call_user_func_array($rule->operation, $args);
$working_file = $output_file;
}
diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php
index f285834c..37707f28 100644
--- a/modules/gallery/helpers/theme.php
+++ b/modules/gallery/helpers/theme.php
@@ -41,11 +41,34 @@ class theme_Core {
$config = Kohana_Config::instance();
$modules = $config->get("core.modules");
+
+ // Normally Router::find_uri() strips off the url suffix for us, but we're working off of the
+ // PATH_INFO here so we need to strip it off manually
+ if ($suffix = Kohana::config("core.url_suffix")) {
+ $path = preg_replace("#" . preg_quote($suffix) . "$#u", "", $path);
+ }
+
self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7);
self::$site_theme_name = module::get_var("gallery", "active_site_theme");
+
+ // If the site theme doesn't exist, fall back to wind.
+ if (!file_exists(THEMEPATH . self::$site_theme_name . "/theme.info")) {
+ site_status::error(t("Theme '%name' is missing. Falling back to the Wind theme.",
+ array("name" => self::$site_theme_name)), "missing_site_theme");
+ module::set_var("gallery", "active_site_theme", self::$site_theme_name = "wind");
+ }
+
if (self::$is_admin) {
// Load the admin theme
self::$admin_theme_name = module::get_var("gallery", "active_admin_theme");
+
+ // If the admin theme doesn't exist, fall back to admin_wind.
+ if (!file_exists(THEMEPATH . self::$admin_theme_name . "/theme.info")) {
+ site_status::error(t("Admin theme '%name' is missing! Falling back to the Wind theme.",
+ array("name" => self::$admin_theme_name)), "missing_admin_theme");
+ module::set_var("gallery", "active_admin_theme", self::$admin_theme_name = "admin_wind");
+ }
+
array_unshift($modules, THEMEPATH . self::$admin_theme_name);
// If the site theme has an admin subdir, load that as a module so that
diff --git a/modules/gallery/helpers/upgrade_checker.php b/modules/gallery/helpers/upgrade_checker.php
index ff65608b..c11a9319 100644
--- a/modules/gallery/helpers/upgrade_checker.php
+++ b/modules/gallery/helpers/upgrade_checker.php
@@ -42,7 +42,8 @@ class upgrade_checker_Core {
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 (!$version_info ||
+ (time() - $version_info->timestamp) > upgrade_checker::AUTO_CHECK_INTERVAL);
}
return false;
}
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
index 562f7929..77e3d204 100644
--- a/modules/gallery/libraries/Gallery_View.php
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -111,6 +111,8 @@ class Gallery_View_Core extends View {
$contents = $cache->get($key);
if (empty($contents)) {
+ module::event("before_combine", $type, $this->combine_queue[$type][$group]);
+
$contents = "";
foreach (array_keys($this->combine_queue[$type][$group]) as $path) {
if ($type == "css") {
@@ -120,6 +122,8 @@ class Gallery_View_Core extends View {
}
}
+ module::event("after_combine", $type, $contents);
+
$cache->set($key, $contents, array($type), 30 * 84600);
$use_gzip = function_exists("gzencode") &&
@@ -128,6 +132,7 @@ class Gallery_View_Core extends View {
$cache->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP),
array($type, "gzip"), 30 * 84600);
}
+
}
unset($this->combine_queue[$type][$group]);
@@ -158,6 +163,7 @@ class Gallery_View_Core extends View {
$replace[] = "url('" . url::abs_file($relative) . "')";
} else {
Kohana_Log::add("error", "Missing URL reference '{$match[1]}' in CSS file '$css_file'");
+
}
}
$replace = str_replace(DIRECTORY_SEPARATOR, "/", $replace);
diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php
index 01d1ce3f..eef087e1 100644
--- a/modules/gallery/views/admin_languages.html.php
+++ b/modules/gallery/views/admin_languages.html.php
@@ -51,7 +51,7 @@
<? foreach ($available_locales as $code => $display_name): ?>
<? if ($i == (int) (count($available_locales)/2)): ?>
</table>
- <table>
+ <table class="g-left">
<tr>
<th> <?= t("Installed") ?> </th>
<th> <?= t("Language") ?> </th>
diff --git a/modules/gallery/views/admin_maintenance.html.php b/modules/gallery/views/admin_maintenance.html.php
index c28def1d..230e9353 100644
--- a/modules/gallery/views/admin_maintenance.html.php
+++ b/modules/gallery/views/admin_maintenance.html.php
@@ -3,7 +3,9 @@
<h1> <?= t("Maintenance") ?> </h1>
<div class="g-block-content">
<div id="g-maintenance-mode">
+ <p>
<?= t("When you're performing maintenance on your Gallery, you can enable <b>maintenance mode</b> which prevents any non-admin from accessing your Gallery. Some of the tasks below will automatically put your Gallery in maintenance mode for you.") ?>
+ </p>
<ul id="g-action-status" class="g-message-block">
<? if (module::get_var("gallery", "maintenance_mode")): ?>
<li class="g-warning">
diff --git a/modules/gallery/views/admin_modules.html.php b/modules/gallery/views/admin_modules.html.php
index f4ae965c..2cc81b0d 100644
--- a/modules/gallery/views/admin_modules.html.php
+++ b/modules/gallery/views/admin_modules.html.php
@@ -6,7 +6,7 @@
dataType: "json",
success: function(data) {
if (data.reload) {
- window.location.reload();
+ window.location = "<? url::site("/admin/modules") ?>";
} else {
$("body").append('<div id="g-dialog">' + data.dialog + '</div>');
$("#g-dialog").dialog({
diff --git a/modules/gallery/views/upgrade_checker_block.html.php b/modules/gallery/views/upgrade_checker_block.html.php
index b04887b2..c984d99f 100644
--- a/modules/gallery/views/upgrade_checker_block.html.php
+++ b/modules/gallery/views/upgrade_checker_block.html.php
@@ -6,8 +6,10 @@
<p>
<? if (gallery::RELEASE_CHANNEL == "release"): ?>
<?= t("You are using the official Gallery %version release, code named <i>%code_name</i>.", array("version" => gallery::VERSION, "code_name" => gallery::CODE_NAME)) ?>
+ <? elseif (isset($build_number)): ?>
+ <?= t("You are using an experimental snapshot of Gallery %version (build %build_number on branch %branch).", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => $build_number)) ?>
<? else: ?>
- <?= t("You are using an experimental snapshot of Gallery %version (build %build_number on branch %branch).", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => gallery::build_number())) ?>
+ <?= t("You are using an experimental snapshot of Gallery %version (branch %branch) but your gallery3/.build_number file is missing so we don't know what build you have. You should probably upgrade so that you have that file.", array("version" => gallery::VERSION, "branch" => gallery::RELEASE_BRANCH, "build_number" => $build_number)) ?>
<? endif ?>
</p>
diff --git a/modules/search/controllers/search.php b/modules/search/controllers/search.php
index eef009a0..261d67ee 100644
--- a/modules/search/controllers/search.php
+++ b/modules/search/controllers/search.php
@@ -22,14 +22,16 @@ class Search_Controller extends Controller {
$page_size = module::get_var("gallery", "page_size", 9);
$q = Input::instance()->get("q");
$page = Input::instance()->get("page", 1);
- $offset = ($page - 1) * $page_size;
// Make sure that the page references a valid offset
if ($page < 1) {
$page = 1;
}
- list ($count, $result) = search::search($q, $page_size, $offset);
+ $offset = ($page - 1) * $page_size;
+
+ $q_with_more_terms = search::add_query_terms($q);
+ list ($count, $result) = search::search($q_with_more_terms, $page_size, $offset);
$max_pages = max(ceil($count / $page_size), 1);
diff --git a/modules/search/helpers/search.php b/modules/search/helpers/search.php
index 09e5e83f..bbde8feb 100644
--- a/modules/search/helpers/search.php
+++ b/modules/search/helpers/search.php
@@ -18,6 +18,22 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class search_Core {
+ /**
+ * Add more terms to the query by wildcarding the stem value of the first
+ * few terms in the query.
+ */
+ static function add_query_terms($q) {
+ $MAX_TERMS = 5;
+ $terms = explode(" ", $q, $MAX_TERMS);
+ for ($i = 0; $i < min(count($terms), $MAX_TERMS - 1); $i++) {
+ // Don't wildcard quoted or already wildcarded terms
+ if ((substr($terms[$i], 0, 1) != '"') && (substr($terms[$i], -1, 1) != "*")) {
+ $terms[] = rtrim($terms[$i], "s") . "*";
+ }
+ }
+ return implode(" ", $terms);
+ }
+
static function search($q, $limit, $offset) {
$db = Database::instance();
$q = $db->escape($q);
diff --git a/modules/server_add/controllers/server_add.php b/modules/server_add/controllers/server_add.php
index 2afa93a7..ea8907f4 100644
--- a/modules/server_add/controllers/server_add.php
+++ b/modules/server_add/controllers/server_add.php
@@ -286,7 +286,7 @@ class Server_Add_Controller extends Admin_Controller {
} catch (Exception $e) {
// This can happen if a photo file is invalid, like a BMP masquerading as a .jpg
$entry->item_id = 0;
- $task->log("Skipping invalid file: {$entry->file}");
+ $task->log("Skipping invalid file: {$entry->path}");
}
}
diff --git a/modules/tag/controllers/tag.php b/modules/tag/controllers/tag.php
index 7aa038c6..8f885dea 100644
--- a/modules/tag/controllers/tag.php
+++ b/modules/tag/controllers/tag.php
@@ -19,8 +19,8 @@
*/
class Tag_Controller extends Controller {
public function __call($function, $args) {
- $tag_name = $function;
- $tag = ORM::factory("tag")->where("name", "=", $tag_name)->find();
+ $tag_id = $function;
+ $tag = ORM::factory("tag")->where("id", "=", $tag_id)->find();
$page_size = module::get_var("gallery", "page_size", 9);
$page = (int) Input::instance()->get("page", "1");
$children_count = $tag->items_count();
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index cd79f734..b415b42d 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -36,10 +36,7 @@ class tag_event_Core {
$tag = str_replace("\0", "", $tag);
foreach (explode(",", $tag) as $word) {
$word = trim($word);
- if (function_exists("mb_detect_encoding") &&
- mb_detect_encoding($word, "ISO-8859-1, UTF-8") != "UTF-8") {
- $word = utf8_encode($word);
- }
+ $word = encoding::convert_to_utf8($word);
$tags[$word] = 1;
}
}
@@ -113,11 +110,11 @@ class tag_event_Core {
}
static function add_photos_form($album, $form) {
- if (!isset($group->uploadify)) {
+ $group = $form->add_photos;
+ if (!is_object($group->uploadify)) {
return;
}
- $group = $form->add_photos;
$group->input("tags")
->label(t("Add tags to all uploaded files"))
->value("");
@@ -136,7 +133,8 @@ class tag_event_Core {
}
static function add_photos_form_completed($album, $form) {
- if (!isset($group->uploadify)) {
+ $group = $form->add_photos;
+ if (!is_object($group->uploadify)) {
return;
}
@@ -151,7 +149,7 @@ class tag_event_Core {
static function info_block_get_metadata($block, $item) {
$tags = array();
foreach (tag::item_tags($item) as $tag) {
- $tags[] = "<a href=\"" . url::site("tag/{$tag->name}") . "\">{$tag->name}</a>";
+ $tags[] = "<a href=\"{$tag->url()}\">{$tag->name}</a>";
}
if ($tags) {
$info = $block->content->metadata;
diff --git a/modules/tag/helpers/tag_item_rest.php b/modules/tag/helpers/tag_item_rest.php
index a8d3d0bc..be1fa653 100644
--- a/modules/tag/helpers/tag_item_rest.php
+++ b/modules/tag/helpers/tag_item_rest.php
@@ -29,6 +29,7 @@ class tag_item_rest_Core {
static function delete($request) {
list ($tag, $item) = rest::resolve($request->url);
+ access::required("edit", $item);
$tag->remove($item);
$tag->save();
}
diff --git a/modules/tag/helpers/tag_items_rest.php b/modules/tag/helpers/tag_items_rest.php
index 535ab513..8ed07276 100644
--- a/modules/tag/helpers/tag_items_rest.php
+++ b/modules/tag/helpers/tag_items_rest.php
@@ -51,6 +51,7 @@ class tag_items_rest_Core {
static function delete($request) {
list ($tag, $item) = rest::resolve($request->url);
+ access::required("edit", $item);
$tag->remove($item);
$tag->save();
}
diff --git a/modules/tag/models/tag.php b/modules/tag/models/tag.php
index 1f233038..6bc5350a 100644
--- a/modules/tag/models/tag.php
+++ b/modules/tag/models/tag.php
@@ -133,7 +133,7 @@ class Tag_Model_Core extends ORM {
* @param string $query the query string (eg "page=3")
*/
public function url($query=null) {
- $url = url::site("tag/{$this->name}");
+ $url = url::site("tag/{$this->id}/" . urlencode($this->name));
if ($query) {
$url .= "?$query";
}
diff --git a/modules/user/views/admin_users_group.html.php b/modules/user/views/admin_users_group.html.php
index 2362e42b..31b91351 100644
--- a/modules/user/views/admin_users_group.html.php
+++ b/modules/user/views/admin_users_group.html.php
@@ -17,7 +17,7 @@
<? if ($group->users->count_all() > 0): ?>
<ul class="g-member-list">
- <? foreach ($group->users->find_all() as $i => $user): ?>
+ <? foreach ($group->users->order_by("name", "ASC")->find_all() as $i => $user): ?>
<li class="g-user">
<?= html::clean($user->name) ?>
<? if (!$group->special): ?>
diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php
index 9e011c69..a56b6f41 100644
--- a/themes/admin_wind/views/admin.html.php
+++ b/themes/admin_wind/views/admin.html.php
@@ -41,11 +41,11 @@
media="screen,print,projection" />
<![endif]-->
- <!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
- <?= $theme->get_combined("script") ?>
-
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
<?= $theme->get_combined("css") ?>
+
+ <!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
+ <?= $theme->get_combined("script") ?>
</head>
<body <?= $theme->body_attributes() ?>>
diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php
index 0e5bdf6b..2b86556d 100644
--- a/themes/wind/views/page.html.php
+++ b/themes/wind/views/page.html.php
@@ -71,11 +71,11 @@
media="screen,print,projection" />
<![endif]-->
- <!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
- <?= $theme->get_combined("script") ?>
-
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
<?= $theme->get_combined("css") ?>
+
+ <!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
+ <?= $theme->get_combined("script") ?>
</head>
<body <?= $theme->body_attributes() ?>>