summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/admin_themes.php7
-rw-r--r--modules/gallery/controllers/albums.php4
-rw-r--r--modules/gallery/controllers/file_proxy.php4
-rw-r--r--modules/gallery/controllers/packager.php6
-rw-r--r--modules/gallery/controllers/quick.php22
-rw-r--r--modules/gallery/controllers/uploader.php3
-rw-r--r--modules/gallery/controllers/user_profile.php2
7 files changed, 18 insertions, 30 deletions
diff --git a/modules/gallery/controllers/admin_themes.php b/modules/gallery/controllers/admin_themes.php
index e59eadaf..a88e1e89 100644
--- a/modules/gallery/controllers/admin_themes.php
+++ b/modules/gallery/controllers/admin_themes.php
@@ -31,10 +31,11 @@ class Admin_Themes_Controller extends Admin_Controller {
private function _get_themes() {
$themes = array();
foreach (scandir(THEMEPATH) as $theme_name) {
+ if ($theme_name[0] == ".") {
+ continue;
+ }
+ $theme_name = preg_replace("/[^a-zA-Z0-9\._-]/", "", $theme_name);
if (file_exists(THEMEPATH . "$theme_name/theme.info")) {
- if ($theme_name[0] == ".") {
- continue;
- }
$themes[$theme_name] = theme::get_info($theme_name);
}
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index f3f5dee3..fb7d5c59 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -132,7 +132,9 @@ class Albums_Controller extends Items_Controller {
$album->description = $form->edit_item->description->value;
$album->sort_column = $form->edit_item->sort_order->column->value;
$album->sort_order = $form->edit_item->sort_order->direction->value;
- $album->name = $form->edit_item->inputs["name"]->value;
+ if (array_key_exists("name", $form->edit_item->inputs)) {
+ $album->name = $form->edit_item->inputs["name"]->value;
+ }
$album->slug = $form->edit_item->slug->value;
$album->validate();
} catch (ORM_Validation_Exception $e) {
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index 15b4279f..b17310c4 100644
--- a/modules/gallery/controllers/file_proxy.php
+++ b/modules/gallery/controllers/file_proxy.php
@@ -116,6 +116,8 @@ class File_Proxy_Controller extends Controller {
throw new Kohana_404_Exception();
}
+ header("Content-Length: " . filesize($file));
+
header("Pragma:");
// Check that the content hasn't expired or it wasn't changed since cached
expires::check(2592000, $item->updated);
@@ -127,7 +129,7 @@ class File_Proxy_Controller extends Controller {
// Dump out the image. If the item is a movie, then its thumbnail will be a JPG.
if ($item->is_movie() && $type != "albums") {
- header("Content-type: image/jpeg");
+ header("Content-Type: image/jpeg");
} else {
header("Content-Type: $item->mime_type");
}
diff --git a/modules/gallery/controllers/packager.php b/modules/gallery/controllers/packager.php
index 835cb903..f463d0de 100644
--- a/modules/gallery/controllers/packager.php
+++ b/modules/gallery/controllers/packager.php
@@ -59,11 +59,7 @@ class Packager_Controller extends Controller {
// numbers, keeping our install.sql file more stable.
srand(0);
- gallery_installer::install(true);
-
- module::load_modules();
-
- foreach (array("user", "comment", "organize", "info", "rest",
+ foreach (array("gallery", "user", "comment", "organize", "info", "rest",
"rss", "search", "slideshow", "tag") as $module_name) {
module::install($module_name);
module::activate($module_name);
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index fee601d9..c34209da 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -36,25 +36,11 @@ class Quick_Controller extends Controller {
}
if ($degrees) {
- gallery_graphics::rotate($item->file_path(), $item->file_path(),
- array("degrees" => $degrees));
-
- list($item->width, $item->height) = getimagesize($item->file_path());
- $item->resize_dirty= 1;
- $item->thumb_dirty= 1;
+ $tmpfile = tempnam(TMPPATH, "rotate");
+ gallery_graphics::rotate($item->file_path(), $tmpfile, array("degrees" => $degrees));
+ $item->set_data_file($tmpfile);
$item->save();
-
- graphics::generate($item);
-
- // @todo: this is an inadequate way to regenerate album cover thumbnails after rotation.
- foreach (ORM::factory("item")
- ->where("album_cover_item_id", "=", $item->id)
- ->find_all() as $target) {
- copy($item->thumb_path(), $target->thumb_path());
- $target->thumb_width = $item->thumb_width;
- $target->thumb_height = $item->thumb_height;
- $target->save();
- }
+ unlink($tmpfile);
}
if (Input::instance()->get("page_type") == "collection") {
diff --git a/modules/gallery/controllers/uploader.php b/modules/gallery/controllers/uploader.php
index 87520032..85d344d6 100644
--- a/modules/gallery/controllers/uploader.php
+++ b/modules/gallery/controllers/uploader.php
@@ -50,7 +50,8 @@ class Uploader_Controller extends Controller {
// Uploadify adds its own field to the form, so validate that separately.
$file_validation = new Validation($_FILES);
$file_validation->add_rules(
- "Filedata", "upload::valid", "upload::required", "upload::type[gif,jpg,jpeg,png,flv,mp4,m4v]");
+ "Filedata", "upload::valid", "upload::required",
+ "upload::type[gif,jpg,jpeg,png,flv,mp4,m4v]");
if ($form->validate() && $file_validation->validate()) {
$temp_filename = upload::save("Filedata");
diff --git a/modules/gallery/controllers/user_profile.php b/modules/gallery/controllers/user_profile.php
index 726d3e51..e992655b 100644
--- a/modules/gallery/controllers/user_profile.php
+++ b/modules/gallery/controllers/user_profile.php
@@ -56,7 +56,7 @@ class User_Profile_Controller extends Controller {
->to($user->email)
->subject(html::clean($form->message->subject->value))
->header("Mime-Version", "1.0")
- ->header("Content-type", "text/html; charset=iso-8859-1")
+ ->header("Content-type", "text/html; charset=UTF-8")
->reply_to($form->message->reply_to->value)
->message(html::purify($form->message->message->value))
->send();