summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/uploader.php5
-rw-r--r--modules/gallery/libraries/Gallery_View.php14
2 files changed, 11 insertions, 8 deletions
diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php
index 9c2bf7d7..05b3bf7b 100644
--- a/modules/gallery/controllers/uploader.php
+++ b/modules/gallery/controllers/uploader.php
@@ -55,6 +55,7 @@ class Uploader_Controller extends Controller {
if ($form->validate() && $file_validation->validate()) {
$temp_filename = upload::save("Filedata");
+ Event::add("system.shutdown", create_function("", "unlink(\"$temp_filename\");"));
try {
$item = ORM::factory("item");
$item->name = substr(basename($temp_filename), 10); // Skip unique identifier Kohana adds
@@ -87,14 +88,10 @@ class Uploader_Controller extends Controller {
Kohana_Log::add("error", "Validation errors: " . print_r($e->validation->errors(), 1));
}
- if (file_exists($temp_filename)) {
- unlink($temp_filename);
- }
header("HTTP/1.1 500 Internal Server Error");
print "ERROR: " . $e->getMessage();
return;
}
- unlink($temp_filename);
print "FILEID: $item->id";
} else {
header("HTTP/1.1 400 Bad Request");
diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php
index e04b9169..9c672770 100644
--- a/modules/gallery/libraries/Gallery_View.php
+++ b/modules/gallery/libraries/Gallery_View.php
@@ -157,7 +157,10 @@ class Gallery_View_Core extends View {
$contents = $cache->get($key);
if (empty($contents)) {
- module::event("before_combine", $type, $this->combine_queue[$type][$group]);
+ $combine_data = new stdClass();
+ $combine_data->type = $type;
+ $combine_data->contents = $this->combine_queue[$type][$group];
+ module::event("before_combine", $combine_data);
$contents = "";
foreach (array_keys($this->combine_queue[$type][$group]) as $path) {
@@ -168,14 +171,17 @@ class Gallery_View_Core extends View {
}
}
- module::event("after_combine", $type, $contents);
+ $combine_data = new stdClass();
+ $combine_data->type = $type;
+ $combine_data->contents = $contents;
+ module::event("after_combine", $combine_data);
- $cache->set($key, $contents, array($type), 30 * 84600);
+ $cache->set($key, $combine_data->contents, array($type), 30 * 84600);
$use_gzip = function_exists("gzencode") &&
(int) ini_get("zlib.output_compression") === 0;
if ($use_gzip) {
- $cache->set("{$key}_gz", gzencode($contents, 9, FORCE_GZIP),
+ $cache->set("{$key}_gz", gzencode($combine_data->contents, 9, FORCE_GZIP),
array($type, "gzip"), 30 * 84600);
}