Merge branch 'master' of git@github.com:dkm/gallery3

This commit is contained in:
dkm
2009-06-09 13:40:40 +02:00
8 changed files with 57 additions and 24 deletions
+18 -2
View File
@@ -22,9 +22,25 @@
* Base path of the web site. If this includes a domain, eg: localhost/kohana/
* then a full URL will be used, eg: http://localhost/kohana/. If it only includes
* the path, and a site_protocol is specified, the domain will be auto-detected.
*
* Here we do our best to autodetect the base path to Gallery. If your url is something like:
* http://example.com/gallery3/index.php/album73/photo5.jpg?param=value
*
* We want the site_domain to be:
* /gallery3
*
* In the above example, $_SERVER["SCRIPT_NAME"] contains "/gallery3/index.php" so
* dirname($_SERVER["SCRIPT_NAME"]) is what we need. Except some low end hosts (namely 1and1.com)
* break SCRIPT_NAME and it contains the extra path info, so in the above example it'd be:
* /gallery3/index.php/album73/photo5.jpg
*
* So dirname doesn't work. So we do a tricky workaround where we look up the SCRIPT_FILENAME (in
* this case it'd be "index.php" and we delete from that part onwards. If you work at 1and1 and
* you're reading this, please fix this bug!
*/
$config["site_domain"] = dirname(
empty($_SERVER["ORIG_SCRIPT_NAME"]) ? $_SERVER["SCRIPT_NAME"] : $_SERVER["ORIG_SCRIPT_NAME"]);
$config["site_domain"] =
substr($_SERVER["SCRIPT_NAME"], 0,
strpos($_SERVER["SCRIPT_NAME"], basename($_SERVER["SCRIPT_FILENAME"])));
/**
* Force a default protocol to be used by the site. If no site_protocol is
-1
View File
@@ -7,7 +7,6 @@
return this.each(function(i){
$(this).effect("highlight", {"color": "white"}, 3000);
$(this).animate({opacity: 1.0}, 6000);
$(this).fadeOut("slow");
});
};
})(jQuery);
+25 -13
View File
@@ -412,13 +412,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":
@@ -454,12 +460,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);
+5 -2
View File
@@ -87,9 +87,12 @@ class Quick_Controller extends Controller {
access::required("view", $item->parent());
access::required("edit", $item->parent());
item::make_album_cover($item);
$msg = t("Made <b>%title</b> this album's cover", array("title" => $item->title));
print json_encode(array("result" => "success"));
item::make_album_cover($item);
message::success($msg);
print json_encode(array("result" => "success", "reload" => 1));
}
public function delete($id) {
+3 -4
View File
@@ -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);
+4
View File
@@ -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
@@ -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>
@@ -93,7 +93,7 @@
button_width: "202",
button_height: "45",
button_placeholder_id: "gChooseFilesButtonPlaceholder",
button_text: '<span class="swfUploadFont">Select photos...</span>',
button_text: '<span class="swfUploadFont"><?= t("Select photos...") ?></span>',
button_text_style: ".swfUploadFont { color: #2E6E9E; font-size: 16px; font-family: Lucida Grande,Lucida Sans,Arial,sans-serif; font-weight: bold; }",
button_text_left_padding: 30,
button_text_top_padding: 10,