summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/g2_import/helpers/g2_import.php38
-rw-r--r--modules/gallery/helpers/graphics.php7
-rw-r--r--modules/gallery/helpers/photo.php4
-rw-r--r--modules/gallery/views/admin_block_welcome.html.php2
4 files changed, 33 insertions, 18 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php
index 51dc8705..a6c21489 100644
--- a/modules/g2_import/helpers/g2_import.php
+++ b/modules/g2_import/helpers/g2_import.php
@@ -407,13 +407,19 @@ class g2_import_Core {
Kohana::log("alert", "$g2_path unsupported image type; using a placeholder gif");
$corrupt = 1;
}
- $item = photo::create(
- $parent,
- $g2_path,
- $g2_item->getPathComponent(),
- $g2_item->getTitle(),
- self::extract_description($g2_item),
- self::map($g2_item->getOwnerId()));
+ try {
+ $item = photo::create(
+ $parent,
+ $g2_path,
+ $g2_item->getPathComponent(),
+ $g2_item->getTitle(),
+ self::extract_description($g2_item),
+ self::map($g2_item->getOwnerId()));
+ } catch (Exception $e) {
+ Kohana::log("alert", "Corrupt image $g2_path\n" .
+ $e->getMessage() . "\n" . $e->getTraceAsString());
+ $corrupt = 1;
+ }
break;
case "GalleryMovieItem":
@@ -449,12 +455,18 @@ class g2_import_Core {
// Why oh why did I ever approve the session id placeholder idea in G2?
$g2_item_url =
str_replace('&g2_GALLERYSID=TMP_SESSION_ID_DI_NOISSES_PMT', '', $g2_item_url);
- $warning =
- t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; " .
- "(imported as <a href=\"%g3_url\">%title</a>)",
- array("g2_url" => $g2_item_url,
- "g3_url" => $item->url(),
- "title" => $g2_item->getTitle()));
+ if (!empty($item)) {
+ $warning =
+ t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed; " .
+ "(imported as <a href=\"%g3_url\">%title</a>)",
+ array("g2_url" => $g2_item_url,
+ "g3_url" => $item->url(),
+ "title" => $g2_item->getTitle()));
+ } else {
+ $warning =
+ t("<a href=\"%g2_url\">%title</a> from Gallery 2 could not be processed",
+ array("g2_url" => $g2_item_url, "title" => $g2_item->getTitle()));
+ }
message::warning($warning);
log::warning("g2_import", $warning);
Kohana::log("alert", $warning);
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index 4846fa8a..25eb0891 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -166,12 +166,11 @@ class graphics_Core {
$item->resize_dirty = 0;
}
$item->save();
- } catch (Kohana_Exception $e) {
+ } catch (Exception $e) {
// Something went wrong rebuilding the image. Leave it dirty and move on.
// @todo we should handle this better.
Kohana::log("error", "Caught exception rebuilding image: {$item->title}\n" .
- $e->getMessage() . "\n" .
- $e->getTraceAsString());
+ $e->getMessage() . "\n" . $e->getTraceAsString());
return false;
}
@@ -192,7 +191,7 @@ class graphics_Core {
}
if (filesize($input_file) == 0) {
- throw new Exception("@todo MALFORMED_INPUT_FILE");
+ throw new Exception("@todo EMPTY_INPUT_FILE");
}
$dims = getimagesize($input_file);
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php
index c1c005f5..a4bc853b 100644
--- a/modules/gallery/helpers/photo.php
+++ b/modules/gallery/helpers/photo.php
@@ -53,6 +53,10 @@ class photo_Core {
throw new Exception("@todo NAME_CANNOT_END_IN_PERIOD");
}
+ if (filesize($filename) == 0) {
+ throw new Exception("@todo EMPTY_INPUT_FILE");
+ }
+
$image_info = getimagesize($filename);
// Force an extension onto the name
diff --git a/modules/gallery/views/admin_block_welcome.html.php b/modules/gallery/views/admin_block_welcome.html.php
index 488fa908..a453b006 100644
--- a/modules/gallery/views/admin_block_welcome.html.php
+++ b/modules/gallery/views/admin_block_welcome.html.php
@@ -10,7 +10,7 @@
</li>
<li>
<?= t("Appearance - <a href=\"%theme_url\">choose a theme</a>, or <a href=\"%theme_details_url\">customize the way it looks</a>.",
- array("theme_url" => url::site("admin/theme"),
+ array("theme_url" => url::site("admin/themes"),
"theme_details_url" => url::site("admin/theme_details"))) ?>
</li>
<li>