diff options
author | Nathan Kinkade <nath@nkinka.de> | 2011-06-29 21:39:46 +0000 |
---|---|---|
committer | Nathan Kinkade <nath@nkinka.de> | 2011-06-29 21:39:46 +0000 |
commit | 09694f9982f4a12b3180135c0c6357561541874a (patch) | |
tree | c3dfae5d4e6a722a368227ee3855afec49bd9764 /modules | |
parent | b4c142b8d75a1c49bdc2d039e79e3d6773a22247 (diff) | |
parent | e8382b960a3c19bb28140833e348e6c9c9db8a8a (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r-- | modules/g2_import/controllers/g2.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/encoding.php | 17 | ||||
-rw-r--r-- | modules/gallery/helpers/graphics.php | 22 | ||||
-rw-r--r-- | modules/gallery/images/missing_photo.png | bin | 0 -> 1570 bytes | |||
-rw-r--r-- | modules/gallery/views/admin_themes.html.php | 4 |
5 files changed, 31 insertions, 14 deletions
diff --git a/modules/g2_import/controllers/g2.php b/modules/g2_import/controllers/g2.php index 90984e84..1252014f 100644 --- a/modules/g2_import/controllers/g2.php +++ b/modules/g2_import/controllers/g2.php @@ -34,7 +34,7 @@ class G2_Controller extends Controller { $path = $input->get("path"); $id = $input->get("g2_itemId"); - if ($path || $id) { + if (($path && $path != 'index.php' && $path != 'main.php') || $id) { if ($id) { // Requests by id are either core.DownloadItem or core.ShowItem requests. Later versions of // Gallery 2 don't specify g2_view if it's the default (core.ShowItem). And in some cases diff --git a/modules/gallery/helpers/encoding.php b/modules/gallery/helpers/encoding.php index c5928634..7d5add34 100644 --- a/modules/gallery/helpers/encoding.php +++ b/modules/gallery/helpers/encoding.php @@ -19,13 +19,16 @@ */ 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); + if (function_exists("mb_detect_encoding")) { + // Rely on mb_detect_encoding()'s strict mode + $src_encoding = mb_detect_encoding($value, mb_detect_order(), true); + if ($src_encoding != "UTF-8") { + if (function_exists("mb_convert_encoding") && $src_encoding) { + $value = mb_convert_encoding($value, "UTF-8", $src_encoding); + } else { + $value = utf8_encode($value); + } + } } return $value; } diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php index acb11bfb..39c87fbd 100644 --- a/modules/gallery/helpers/graphics.php +++ b/modules/gallery/helpers/graphics.php @@ -170,23 +170,37 @@ class graphics_Core { foreach (self::_get_rules($target) as $rule) { $args = array($working_file, $output_file, unserialize($rule->args), $item); - call_user_func_array($rule->operation, $args); - $working_file = $output_file; + try { + call_user_func_array($rule->operation, $args); + $working_file = $output_file; + } catch (Exception $e) { + // Ignore this rule and move on. + Kohana_Log::add("error", "Caught exception processing image: {$item->title}\n" . + $e->getMessage() . "\n" . $e->getTraceAsString()); + } } } if (!empty($ops["thumb"])) { + if (file_exists($item->thumb_path())) { + $item->thumb_dirty = 0; + } else { + copy(MODPATH . "gallery/images/missing_photo.png", $item->thumb_path()); + } $dims = getimagesize($item->thumb_path()); $item->thumb_width = $dims[0]; $item->thumb_height = $dims[1]; - $item->thumb_dirty = 0; } if (!empty($ops["resize"])) { + if (file_exists($item->resize_path())) { + $item->resize_dirty = 0; + } else { + copy(MODPATH . "gallery/images/missing_photo.png", $item->resize_path()); + } $dims = getimagesize($item->resize_path()); $item->resize_width = $dims[0]; $item->resize_height = $dims[1]; - $item->resize_dirty = 0; } $item->save(); } catch (Exception $e) { diff --git a/modules/gallery/images/missing_photo.png b/modules/gallery/images/missing_photo.png Binary files differnew file mode 100644 index 00000000..67786275 --- /dev/null +++ b/modules/gallery/images/missing_photo.png diff --git a/modules/gallery/views/admin_themes.html.php b/modules/gallery/views/admin_themes.html.php index 7d947b28..9d53779f 100644 --- a/modules/gallery/views/admin_themes.html.php +++ b/modules/gallery/views/admin_themes.html.php @@ -48,7 +48,7 @@ <? if (!$count): ?> <p> - <?= t("There are no other site themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Modules")) ?> + <?= t("There are no other site themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Themes")) ?> </p> <? endif ?> </div> @@ -88,7 +88,7 @@ <? if (!$count): ?> <p> - <?= t("There are no other admin themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Modules")) ?> + <?= t("There are no other admin themes available. <a href=\"%url\">Download one now!</a>", array("url" => "http://codex.gallery2.org/Category:Gallery_3:Themes")) ?> </p> <? endif ?> </div> |