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_graphics.php2
-rw-r--r--modules/gallery/helpers/graphics.php4
-rw-r--r--modules/gallery/helpers/legal_file.php12
-rw-r--r--modules/gallery/helpers/module.php6
-rw-r--r--modules/gallery/helpers/movie.php2
6 files changed, 31 insertions, 7 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index db087588..6225633f 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -23,6 +23,14 @@ class gallery_event_Core {
* Initialization.
*/
static function gallery_ready() {
+ if (!get_cfg_var("date.timezone")) {
+ if (!(rand() % 4)) {
+ Kohana_Log::add("error", "date.timezone setting not detected in " .
+ get_cfg_var("cfg_file_path") . " falling back to UTC. " .
+ "Consult http://php.net/manual/function.get-cfg-var.php for help.");
+ }
+ }
+
identity::load_user();
theme::load_themes();
locales::set_request_locale();
@@ -549,8 +557,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));
+ } else if ($field == "url") {
+ $value = html::mark_clean(html::anchor(html::clean($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 02f628a1..d2b92c87 100644
--- a/modules/gallery/helpers/gallery_graphics.php
+++ b/modules/gallery/helpers/gallery_graphics.php
@@ -126,7 +126,7 @@ class gallery_graphics_Core {
module::event("graphics_composite_completed", $input_file, $output_file, $options, $item);
} catch (ErrorException $e) {
- Kohana_Log::add("error", $e->get_message());
+ Kohana_Log::add("error", $e->getMessage());
}
}
}
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 7e0bbbea..c19fbe6d 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -156,12 +156,12 @@ class graphics_Core {
foreach ($ops as $target => $output_file) {
if ($input_item->is_movie()) {
// Convert the movie to a JPG first
- $output_file = preg_replace("/...$/", "jpg", $output_file);
+ $output_file = legal_file::change_extension($output_file, "jpg");
try {
movie::extract_frame($input_file, $output_file);
} catch (Exception $e) {
// Assuming this is MISSING_FFMPEG for now
- copy(MODPATH . "gallery/images/missing_movie.png", $output_file);
+ copy(MODPATH . "gallery/images/missing_movie.jpg", $output_file);
}
$working_file = $output_file;
} else {
diff --git a/modules/gallery/helpers/legal_file.php b/modules/gallery/helpers/legal_file.php
index 6ec65e97..af6472ca 100644
--- a/modules/gallery/helpers/legal_file.php
+++ b/modules/gallery/helpers/legal_file.php
@@ -80,4 +80,16 @@ class legal_file_Core {
module::event("legal_movie_types", $types_wrapper);
return $types_wrapper->types;
}
+
+ /**
+ * Convert the extension of a filename. If the original filename has no
+ * extension, add the new one to the end.
+ */
+ static function change_extension($filename, $new_ext) {
+ if (strpos($filename, ".") === false) {
+ return "{$filename}.{$new_ext}";
+ } else {
+ return preg_replace("/\..*?$/", ".{$new_ext}", $filename);
+ }
+ }
}
diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php
index 3368e39b..7292b106 100644
--- a/modules/gallery/helpers/module.php
+++ b/modules/gallery/helpers/module.php
@@ -109,7 +109,11 @@ class module_Core {
$modules->gallery->locked = true;
$identity_module = module::get_var("gallery", "identity_provider", "user");
$modules->$identity_module->locked = true;
- $modules->ksort();
+
+ function natural_name_sort($a, $b) {
+ return strnatcasecmp($a->name, $b->name);
+ }
+ $modules->uasort('natural_name_sort');
self::$available = $modules;
}
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 79b5a7c2..b54811df 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -106,7 +106,7 @@ class movie_Core {
$cmd = escapeshellcmd($ffmpeg) . " -i " . escapeshellarg($file_path) . " 2>&1";
$result = `$cmd`;
- if (preg_match("/Stream.*?Video:.*?(\d+)x(\d+)/", $result, $regs)) {
+ if (preg_match("/Stream.*?Video:.*?, (\d+)x(\d+)/", $result, $regs)) {
list ($width, $height) = array($regs[1], $regs[2]);
} else {
list ($width, $height) = array(0, 0);