summaryrefslogtreecommitdiff
path: root/modules/gallery
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery')
-rw-r--r--modules/gallery/controllers/combined.php9
-rw-r--r--modules/gallery/controllers/packager.php4
-rw-r--r--modules/gallery/controllers/simple_uploader.php2
-rw-r--r--modules/gallery/helpers/album.php10
-rw-r--r--modules/gallery/helpers/gallery_installer.php32
-rw-r--r--modules/gallery/helpers/photo.php8
-rw-r--r--modules/gallery/libraries/Sendmail.php4
-rw-r--r--modules/gallery/views/permissions_browse.html.php42
-rw-r--r--modules/gallery/views/simple_uploader.html.php2
9 files changed, 61 insertions, 52 deletions
diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php
index 9a790fdf..c1f42bfe 100644
--- a/modules/gallery/controllers/combined.php
+++ b/modules/gallery/controllers/combined.php
@@ -42,22 +42,23 @@ class Combined_Controller extends Controller {
private function _emit($type, $key) {
$input = Input::instance();
+ // We don't need to save the session for this request
+ Session::abort_save();
+
// Our data is immutable, so if they already have a copy then it needs no updating.
if ($input->server("HTTP_IF_MODIFIED_SINCE")) {
header('HTTP/1.0 304 Not Modified');
header("Expires: Tue, 19 Jan 2038 00:00:00 GMT");
header("Cache-Control: max-age=2678400");
header('Pragma: public');
- return;
+ Kohana::close_buffers(false);
+ return "";
}
if (empty($key)) {
Kohana::show_404();
}
- // We don't need to save the session for this request
- Session::abort_save();
-
$cache = Cache::instance();
$use_gzip = function_exists("gzencode") &&
stripos($input->server("HTTP_ACCEPT_ENCODING"), "gzip") !== false &&
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index 7b4d68f6..fbb1d07d 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -123,6 +123,10 @@ class Packager_Controller extends Controller {
// Normalize dates
$line = preg_replace("/,$root_created_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
$line = preg_replace("/,$root_updated_timestamp,/", ",UNIX_TIMESTAMP(),", $line);
+
+ // Remove ENGINE= specifications
+ $line = preg_replace("/ENGINE=\S+ /", "", $line);
+
$buf .= $line;
}
$fd = fopen($sql_file, "wb");
diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php
index e7c0bd6f..156d18ac 100644
--- a/modules/gallery/controllers/simple_uploader.php
+++ b/modules/gallery/controllers/simple_uploader.php
@@ -71,7 +71,7 @@ class Simple_Uploader_Controller extends Controller {
unlink($temp_filename);
}
header("HTTP/1.1 500 Internal Server Error");
- print "ERROR:" . $e->getMessage();
+ print "ERROR: " . $e->getMessage();
return;
}
unlink($temp_filename);
diff --git a/modules/gallery/helpers/album.php b/modules/gallery/helpers/album.php
index 8a7c9951..1b6b875d 100644
--- a/modules/gallery/helpers/album.php
+++ b/modules/gallery/helpers/album.php
@@ -56,7 +56,7 @@ class album_Core {
$album->thumb_dirty = 1;
$album->resize_dirty = 1;
$album->rand_key = ((float)mt_rand()) / (float)mt_getrandmax();
- $album->sort_column = "weight";
+ $album->sort_column = "created";
$album->sort_order = "ASC";
while (ORM::factory("item")
@@ -116,11 +116,11 @@ class album_Core {
$sort_order->dropdown("column", array("id" => "gAlbumSortColumn"))
->label(t("Sort by"))
- ->options(array("weight" => t("Order Added"),
- "captured" => t("Capture Date"),
- "created" => t("Creation Date"),
+ ->options(array("weight" => t("Manual"),
+ "captured" => t("Date captured"),
+ "created" => t("Date uploaded"),
"title" => t("Title"),
- "updated" => t("Updated Date"),
+ "updated" => t("Date modified"),
"view_count" => t("Number of views"),
"rand_key" => t("Random")))
->selected($parent->sort_column);
diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php
index d12dad70..a212ef85 100644
--- a/modules/gallery/helpers/gallery_installer.php
+++ b/modules/gallery/helpers/gallery_installer.php
@@ -24,13 +24,13 @@ class gallery_installer {
`id` int(9) NOT NULL auto_increment,
`item_id` int(9),
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {access_intents} (
`id` int(9) NOT NULL auto_increment,
`item_id` int(9),
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {caches} (
`id` int(9) NOT NULL auto_increment,
@@ -40,7 +40,7 @@ class gallery_installer {
`cache` longblob,
PRIMARY KEY (`id`),
KEY (`tags`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {graphics_rules} (
`id` int(9) NOT NULL auto_increment,
@@ -51,7 +51,7 @@ class gallery_installer {
`priority` int(9) NOT NULL,
`target` varchar(32) NOT NULL,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {incoming_translations} (
`id` int(9) NOT NULL auto_increment,
@@ -63,7 +63,7 @@ class gallery_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`key`, `locale`),
KEY `locale_key` (`locale`, `key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {items} (
`id` int(9) NOT NULL auto_increment,
@@ -100,7 +100,7 @@ class gallery_installer {
KEY `type` (`type`),
KEY `random` (`rand_key`),
KEY `weight` (`weight` DESC))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {logs} (
`id` int(9) NOT NULL auto_increment,
@@ -113,7 +113,7 @@ class gallery_installer {
`url` varchar(255) default NULL,
`user_id` int(9) default 0,
PRIMARY KEY (`id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {messages} (
`id` int(9) NOT NULL auto_increment,
@@ -122,7 +122,7 @@ class gallery_installer {
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {modules} (
`id` int(9) NOT NULL auto_increment,
@@ -131,7 +131,7 @@ class gallery_installer {
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {outgoing_translations} (
`id` int(9) NOT NULL auto_increment,
@@ -143,7 +143,7 @@ class gallery_installer {
PRIMARY KEY (`id`),
UNIQUE KEY(`key`, `locale`),
KEY `locale_key` (`locale`, `key`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {permissions} (
`id` int(9) NOT NULL auto_increment,
@@ -151,14 +151,14 @@ class gallery_installer {
`name` varchar(64) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {sessions} (
`session_id` varchar(127) NOT NULL,
`data` text NOT NULL,
`last_activity` int(10) UNSIGNED NOT NULL,
PRIMARY KEY (`session_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {tasks} (
`id` int(9) NOT NULL auto_increment,
@@ -173,7 +173,7 @@ class gallery_installer {
`updated` int(9) default NULL,
PRIMARY KEY (`id`),
KEY (`owner_id`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {themes} (
`id` int(9) NOT NULL auto_increment,
@@ -181,7 +181,7 @@ class gallery_installer {
`version` int(9) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY(`name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE {vars} (
`id` int(9) NOT NULL auto_increment,
@@ -190,7 +190,7 @@ class gallery_installer {
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY(`module_name`, `name`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
foreach (array("albums", "logs", "modules", "resizes", "thumbs", "tmp", "uploads") as $dir) {
@mkdir(VARPATH . $dir);
@@ -284,7 +284,7 @@ class gallery_installer {
`cache` text,
PRIMARY KEY (`id`),
KEY (`tags`))
- ENGINE=InnoDB DEFAULT CHARSET=utf8;");
+ DEFAULT CHARSET=utf8;");
module::set_version("gallery", $version = 4);
}
diff --git a/modules/gallery/helpers/photo.php b/modules/gallery/helpers/photo.php
index 5cf37de1..96a66d29 100644
--- a/modules/gallery/helpers/photo.php
+++ b/modules/gallery/helpers/photo.php
@@ -109,8 +109,12 @@ class photo_Core {
// there's only one save() happening here.
module::event("item_created", $photo);
- // Build our thumbnail/resizes
- graphics::generate($photo);
+ // Build our thumbnail/resizes. If we fail to build thumbnail/resize we assume that the image
+ // is bad in some way and discard it.
+ if (!graphics::generate($photo)) {
+ $photo->delete();
+ throw new Exception("@todo BAD_IMAGE_FILE");
+ }
// If the parent has no cover item, make this it.
if (access::can("edit", $parent) && $parent->album_cover_item_id == null) {
diff --git a/modules/gallery/libraries/Sendmail.php b/modules/gallery/libraries/Sendmail.php
index 90998457..7bc21a67 100644
--- a/modules/gallery/libraries/Sendmail.php
+++ b/modules/gallery/libraries/Sendmail.php
@@ -52,6 +52,7 @@ class Sendmail_Core {
break;
case "header":
if (count($value) != 2) {
+ Kohana::log("error", wordwrap("Invalid header parameters\n" . Kohana::debug($value)));
throw new Exception("@todo INVALID_HEADER_PARAMETERS");
}
$this->headers[$value[0]] = $value[1];
@@ -70,6 +71,7 @@ class Sendmail_Core {
public function send() {
if (empty($this->to)) {
+ Kohana::log("error", wordwrap("Sending mail failed:\nNo to address specified"));
throw new Exception("@todo TO_IS_REQUIRED_FOR_MAIL");
}
$to = implode(", ", $this->to);
@@ -84,8 +86,6 @@ class Sendmail_Core {
$headers = implode($this->header_separator, $headers);
$message = wordwrap($this->message, $this->line_length, "\n");
if (!$this->mail($to, $this->subject, $message, $headers)) {
- Kohana::log("error", wordwrap("Sending mail failed:\nTo: $to\n $this->subject\n" .
- "Headers: $headers\n $this->message"));
throw new Exception("@todo SEND_MAIL_FAILED");
}
return $this;
diff --git a/modules/gallery/views/permissions_browse.html.php b/modules/gallery/views/permissions_browse.html.php
index 888a27f7..f990896c 100644
--- a/modules/gallery/views/permissions_browse.html.php
+++ b/modules/gallery/views/permissions_browse.html.php
@@ -5,8 +5,9 @@
$.ajax({
url: form_url.replace("__ITEM__", id),
success: function(data) {
- $("div.form").slideUp();
- $("div#edit-" + id).html(data).slideDown();
+ $("#gEditPermissionForm").html(data);
+ $(".active").removeClass("active");
+ $("#item-" + id).addClass("active");
}
});
}
@@ -18,7 +19,7 @@
url: action_url.replace("__CMD__", cmd).replace("__GROUP__", group_id).
replace("__PERM__", perm_id).replace("__ITEM__", item_id),
success: function(data) {
- $("div#edit-" + item_id).load(form_url.replace("__ITEM__", item_id));
+ $("#gEditPermissionForm").load(form_url.replace("__ITEM__", item_id));
}
});
}
@@ -31,26 +32,25 @@
</li>
</ul>
<? endif ?>
- <ul>
+
+ <p>Edit permissions for album:</p>
+
+ <ul class="gBreadcrumbs">
<? foreach ($parents as $parent): ?>
- <li>
+ <li id="item-<?= $parent->id ?>">
<a href="javascript:show(<?= $parent->id ?>)">
- <?= p::clean($parent->title) ?>
+ <?= p::purify($parent->title) ?>
</a>
- <div class="form" id="edit-<?= $parent->id ?>"></div>
- <ul>
- <? endforeach ?>
- <li>
- <a href="javascript:show(<?= $item->id ?>)">
- <?= p::purify($item->title) ?>
- </a>
- <div class="form" id="edit-<?= $item->id ?>">
- <?= $form ?>
- </div>
- </li>
- <? foreach ($parents as $parent): ?>
- </ul>
</li>
+ <? endforeach ?>
+ <li class="active" id="item-<?= $item->id ?>">
+ <a href="javascript:show(<?= $item->id ?>)">
+ <?= p::purify($item->title) ?></li>
+ </a>
+ </li>
</ul>
- <? endforeach ?>
-</div>
+
+ <div id="gEditPermissionForm">
+ <?= $form ?>
+ </div>
+</div> \ No newline at end of file
diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php
index 38ac518c..29a0dfe8 100644
--- a/modules/gallery/views/simple_uploader.html.php
+++ b/modules/gallery/views/simple_uploader.html.php
@@ -218,7 +218,7 @@
var fp = new File_Progress(file);
switch (error_code) {
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
- fp.set_status("error", "<?= t("Upload error: ") ?>" + message);
+ fp.set_status("error", "<?= t("Upload error: bad image file") ?>");
break;
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
fp.set_status("error", "<?= t("Upload failed") ?>");