summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/gallery_event.php12
-rw-r--r--modules/gallery/helpers/gallery_installer.php29
-rw-r--r--modules/gallery/helpers/gallery_task.php3
-rw-r--r--modules/gallery/helpers/graphics.php6
-rw-r--r--modules/gallery/helpers/l10n_scanner.php37
-rw-r--r--modules/gallery/helpers/movie.php2
-rw-r--r--modules/gallery/helpers/theme.php33
-rw-r--r--modules/gallery/helpers/user_profile.php13
8 files changed, 70 insertions, 65 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index e048118b..df5394c9 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -447,7 +447,6 @@ class gallery_event_Core {
break;
}
$cover_title = t("Choose as the album cover");
- $move_title = t("Move to another album");
$csrf = access::csrf_token();
@@ -478,17 +477,6 @@ class gallery_event_Core {
->url(url::site("quick/rotate/$item->id/cw?csrf=$csrf&from_id={$theme_item->id}&page_type=$page_type")));
}
- // @todo Don't move photos from the photo page; we don't yet have a good way of redirecting
- // after move
- if ($theme->page_subtype() == "album") {
- $options_menu
- ->append(Menu::factory("dialog")
- ->id("move")
- ->label($move_title)
- ->css_class("ui-icon-folder-open")
- ->url(url::site("move/browse/$item->id")));
- }
-
$parent = $item->parent();
if (access::can("edit", $parent)) {
// We can't make this item the highlight if it's an album with no album cover, or if it's
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index 569c5118..d5264fcc 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -300,7 +300,16 @@ class gallery_installer {
module::set_var("gallery", "simultaneous_upload_limit", 5);
module::set_var("gallery", "admin_area_timeout", 90 * 60);
module::set_var("gallery", "maintenance_mode", 0);
- module::set_version("gallery", 34);
+ module::set_var("gallery", "visible_title_length", 15);
+ module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
+
+ // Sendmail configuration
+ module::set_var("gallery", "email_from", "admin@example.com");
+ module::set_var("gallery", "email_reply_to", "public@example.com");
+ module::set_var("gallery", "email_line_length", 70);
+ module::set_var("gallery", "email_header_separator", serialize("\n"));
+
+ module::set_version("gallery", 37);
}
static function upgrade($version) {
@@ -584,6 +593,24 @@ class gallery_installer {
$db->query("ALTER TABLE {access_caches} ADD KEY (`item_id`)");
module::set_version("gallery", $version = 34);
}
+
+ if ($version == 34) {
+ module::set_var("gallery", "visible_title_length", 15);
+ module::set_version("gallery", $version = 35);
+ }
+
+ if ($version == 35) {
+ module::set_var("gallery", "favicon_url", "lib/images/favicon.ico");
+ module::set_version("gallery", $version = 36);
+ }
+
+ if ($version == 36) {
+ module::set_var("gallery", "email_from", "admin@example.com");
+ module::set_var("gallery", "email_reply_to", "public@example.com");
+ module::set_var("gallery", "email_line_length", 70);
+ module::set_var("gallery", "email_header_separator", serialize("\n"));
+ module::set_version("gallery", $version = 37);
+ }
}
static function uninstall() {
diff --git a/modules/gallery/helpers/gallery_task.php b/modules/gallery/helpers/gallery_task.php
index 6a1fc28a..0886aad0 100644
--- a/modules/gallery/helpers/gallery_task.php
+++ b/modules/gallery/helpers/gallery_task.php
@@ -58,8 +58,7 @@ class gallery_task_Core {
$tasks[] = Task_Definition::factory()
->callback("gallery_task::fix")
->name(t("Fix your Gallery"))
- ->description(t("Fix a variety of problems that might cause your Gallery to act " .
- "strangely. Requires maintenance mode."))
+ ->description(t("Fix a variety of problems that might cause your Gallery to act strangely. Requires maintenance mode."))
->severity(log::SUCCESS);
return $tasks;
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index cc4d2e76..bb085ea5 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -338,8 +338,7 @@ class graphics_Core {
} else {
$toolkits->imagemagick->installed = false;
$toolkits->imagemagick->error =
- t("ImageMagick is installed, but PHP's open_basedir restriction " .
- "prevents Gallery from using it.");
+ t("ImageMagick is installed, but PHP's open_basedir restriction prevents Gallery from using it.");
}
} else {
$toolkits->imagemagick->installed = false;
@@ -363,8 +362,7 @@ class graphics_Core {
} else {
$toolkits->graphicsmagick->installed = false;
$toolkits->graphicsmagick->error =
- t("GraphicsMagick is installed, but PHP's open_basedir restriction " .
- "prevents Gallery from using it.");
+ t("GraphicsMagick is installed, but PHP's open_basedir restriction prevents Gallery from using it.");
}
} else {
$toolkits->graphicsmagick->installed = false;
diff --git a/modules/gallery/helpers/l10n_scanner.php b/modules/gallery/helpers/l10n_scanner.php
index 2287a7ba..843c74f7 100644
--- a/modules/gallery/helpers/l10n_scanner.php
+++ b/modules/gallery/helpers/l10n_scanner.php
@@ -74,10 +74,21 @@ class l10n_scanner_Core {
unset($raw_tokens);
if (!empty($func_token_list["t"])) {
- l10n_scanner::_parse_t_calls($tokens, $func_token_list["t"], $cache);
+ $errors = l10n_scanner::_parse_t_calls($tokens, $func_token_list["t"], $cache);
+ foreach ($errors as $line => $error) {
+ Kohana_Log::add(
+ "error", "Translation scanner error. " .
+ "file: " . substr($file, strlen(DOCROOT)) . ", line: $line, context: $error");
+ }
}
+
if (!empty($func_token_list["t2"])) {
- l10n_scanner::_parse_plural_calls($tokens, $func_token_list["t2"], $cache);
+ $errors = l10n_scanner::_parse_plural_calls($tokens, $func_token_list["t2"], $cache);
+ foreach ($errors as $line => $error) {
+ Kohana_Log::add(
+ "error", "Translation scanner error. " .
+ "file: " . substr($file, strlen(DOCROOT)) . ", line: $line, context: $error");
+ }
}
}
@@ -91,6 +102,7 @@ class l10n_scanner_Core {
}
private static function _parse_t_calls(&$tokens, &$call_list, &$cache) {
+ $errors = array();
foreach ($call_list as $index) {
$function_name = $tokens[$index++];
$parens = $tokens[$index++];
@@ -103,14 +115,21 @@ class l10n_scanner_Core {
$message = self::_escape_quoted_string($first_param[1]);
l10n_scanner::process_message($message, $cache);
} else {
- // t() found, but inside is something which is not a string literal.
- // @todo Call status callback with error filename/line.
+ if (is_array($first_param) && ($first_param[0] == T_CONSTANT_ENCAPSED_STRING)) {
+ // Malformed string literals; escalate this
+ $errors[$first_param[2]] =
+ var_export(array($function_name, $parens, $first_param, $next_token), 1);
+ } else {
+ // t() found, but inside is something which is not a string literal. That's fine.
+ }
}
}
}
+ return $errors;
}
private static function _parse_plural_calls(&$tokens, &$call_list, &$cache) {
+ $errors = array();
foreach ($call_list as $index) {
$function_name = $tokens[$index++];
$parens = $tokens[$index++];
@@ -127,11 +146,17 @@ class l10n_scanner_Core {
$plural = self::_escape_quoted_string($second_param[1]);
l10n_scanner::process_message(array("one" => $singular, "other" => $plural), $cache);
} else {
- // t2() found, but inside is something which is not a string literal.
- // @todo Call status callback with error filename/line.
+ if (is_array($first_param) && $first_param[0] == T_CONSTANT_ENCAPSED_STRING) {
+ $errors[$first_param[2]] = var_export(
+ array($function_name, $parens, $first_param,
+ $first_separator, $second_param, $next_token), 1);
+ } else {
+ // t2() found, but inside is something which is not a string literal. That's fine.
+ }
}
}
}
+ return $errors;
}
/**
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 4ff29a7b..3e55eefe 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -84,7 +84,7 @@ class movie_Core {
}
static function find_ffmpeg() {
- if (!$ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) {
+ if (!($ffmpeg_path = module::get_var("gallery", "ffmpeg_path")) || !file_exists($ffmpeg_path)) {
$graphics_path = module::get_var("gallery", "graphics_toolkit_path", null);
putenv("PATH=" . getenv("PATH") . (empty($graphics_path) ? "" : ":$graphics_path") .
diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php
index 9df3eaf2..1dc1f3b6 100644
--- a/modules/gallery/helpers/theme.php
+++ b/modules/gallery/helpers/theme.php
@@ -77,39 +77,6 @@ class theme_Core {
$config->set("core.modules", $modules);
}
- static function get_edit_form_admin() {
- $form = new Forge("admin/theme_options/save/", "", null, array("id" =>"g-theme-options-form"));
- $group = $form->group("edit_theme")->label(t("Theme layout"));
- $group->input("page_size")->label(t("Items per page"))->id("g-page-size")
- ->rules("required|valid_digit")
- ->error_messages("required", t("You must enter a number"))
- ->error_messages("valid_digit", t("You must enter a number"))
- ->value(module::get_var("gallery", "page_size"));
- $group->input("thumb_size")->label(t("Thumbnail size (in pixels)"))->id("g-thumb-size")
- ->rules("required|valid_digit")
- ->error_messages("required", t("You must enter a number"))
- ->error_messages("valid_digit", t("You must enter a number"))
- ->value(module::get_var("gallery", "thumb_size"));
- $group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("g-resize-size")
- ->rules("required|valid_digit")
- ->error_messages("required", t("You must enter a number"))
- ->error_messages("valid_digit", t("You must enter a number"))
- ->value(module::get_var("gallery", "resize_size"));
- $group->textarea("header_text")->label(t("Header text"))->id("g-header-text")
- ->value(module::get_var("gallery", "header_text"));
- $group->textarea("footer_text")->label(t("Footer text"))->id("g-footer-text")
- ->value(module::get_var("gallery", "footer_text"));
- $group->checkbox("show_credits")->label(t("Show site credits"))->id("g-footer-text")
- ->checked(module::get_var("gallery", "show_credits"));
-
- module::event("theme_edit_form", $form);
-
- $group = $form->group("buttons")
- ->set_attr("style","border: none");
- $group->submit("")->value(t("Save"));
- return $form;
- }
-
static function get_info($theme_name) {
$theme_name = preg_replace("/[^a-zA-Z0-9\._-]/", "", $theme_name);
$file = THEMEPATH . "$theme_name/theme.info";
diff --git a/modules/gallery/helpers/user_profile.php b/modules/gallery/helpers/user_profile.php
index e5ebce84..d9cc8ace 100644
--- a/modules/gallery/helpers/user_profile.php
+++ b/modules/gallery/helpers/user_profile.php
@@ -35,19 +35,20 @@ class user_profile_Core {
$group->input("reply_to")
->label(t("From:"))
->rules("required|length[1, 256]|valid_email")
- ->error_messages("required", t("Field is required"))
- ->error_messages("max_length", t("Field exceeds 256 bytes"))
- ->error_messages("valid_email", t("Field is not a valid email address"));
+ ->error_messages("required", t("You must enter a valid email address"))
+ ->error_messages("max_length", t("Your email address is too long"))
+ ->error_messages("valid_email", t("You must enter a valid email address"));
$group->input("subject")
->label(t("Subject:"))
->rules("required|length[1, 256]")
- ->error_messages("required", t("Field is required"))
- ->error_messages("max_length", t("Field exceeds 256 bytes"));
+ ->error_messages("required", t("Your message must have a subject"))
+ ->error_messages("max_length", t("Your subject is too long"));
$group->textarea("message")
->label(t("Message:"))
->rules("required")
- ->error_messages("required", t("Field is required"));
+ ->error_messages("required", t("You must enter a message"));
module::event("user_profile_contact_form", $form);
+ module::event("captcha_protect_form", $form);
$group->submit("")->value(t("Send"));
return $form;
}