summaryrefslogtreecommitdiff
path: root/modules/gallery/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/controllers')
-rw-r--r--modules/gallery/controllers/admin_modules.php6
-rw-r--r--modules/gallery/controllers/admin_theme_options.php1
-rw-r--r--modules/gallery/controllers/albums.php9
-rw-r--r--modules/gallery/controllers/combined.php62
-rw-r--r--modules/gallery/controllers/file_proxy.php3
-rw-r--r--modules/gallery/controllers/l10n_client.php14
-rw-r--r--modules/gallery/controllers/movies.php2
-rw-r--r--modules/gallery/controllers/quick.php4
-rw-r--r--modules/gallery/controllers/simple_uploader.php3
-rw-r--r--modules/gallery/controllers/upgrader.php6
10 files changed, 99 insertions, 11 deletions
diff --git a/modules/gallery/controllers/admin_modules.php b/modules/gallery/controllers/admin_modules.php
index f7dd909d..ed1f7665 100644
--- a/modules/gallery/controllers/admin_modules.php
+++ b/modules/gallery/controllers/admin_modules.php
@@ -45,7 +45,11 @@ class Admin_Modules_Controller extends Admin_Controller {
} else if (!$info->active && $desired && !module::is_active($module_name)) {
$changes->activate[] = $module_name;
$activated_names[] = $info->name;
- module::install($module_name);
+ if (module::is_installed($module_name)) {
+ module::upgrade($module_name);
+ } else {
+ module::install($module_name);
+ }
module::activate($module_name);
}
}
diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php
index 2716ed93..8970c3c9 100644
--- a/modules/gallery/controllers/admin_theme_options.php
+++ b/modules/gallery/controllers/admin_theme_options.php
@@ -56,6 +56,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
module::set_var("gallery", "header_text", $form->edit_theme->header_text->value);
module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value);
+ module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value);
message::success(t("Updated theme details"));
url::redirect("admin/theme_options");
diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php
index 856709c2..22f50fb8 100644
--- a/modules/gallery/controllers/albums.php
+++ b/modules/gallery/controllers/albums.php
@@ -26,7 +26,7 @@ class Albums_Controller extends Items_Controller {
$page_size = module::get_var("gallery", "page_size", 9);
if (!access::can("view", $album)) {
if ($album->id == 1) {
- $view = new Theme_View("page.html", "page");
+ $view = new Theme_View("page.html", "login");
$view->page_title = t("Log in to Gallery");
$view->content = user::get_login_form("login/auth_html");
print $view;
@@ -167,7 +167,8 @@ class Albums_Controller extends Items_Controller {
$form = album::get_edit_form($album);
if ($valid = $form->validate()) {
// Make sure that there's not a conflict
- if (Database::instance()
+ if ($album->id != 1 &&
+ Database::instance()
->from("items")
->where("parent_id", $album->parent_id)
->where("id <>", $album->id)
@@ -188,7 +189,9 @@ class Albums_Controller extends Items_Controller {
$album->description = $form->edit_album->description->value;
$album->sort_column = $form->edit_album->sort_order->column->value;
$album->sort_order = $form->edit_album->sort_order->direction->value;
- $album->rename($form->edit_album->dirname->value);
+ if ($album->id != 1) {
+ $album->rename($form->edit_album->dirname->value);
+ }
$album->save();
module::event("item_updated", $orig, $album);
diff --git a/modules/gallery/controllers/combined.php b/modules/gallery/controllers/combined.php
new file mode 100644
index 00000000..510482db
--- /dev/null
+++ b/modules/gallery/controllers/combined.php
@@ -0,0 +1,62 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class Combined_Controller extends Controller {
+ public function javascript($key) {
+ if (preg_match('/[^0-9a-f]/', $key)) {
+ // The key can't contain non-hex, so just terminate early
+ Kohana::show_404();
+ }
+
+ // 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 (!empty($_SERVER["HTTP_IF_MODIFIED_SINCE"])) {
+ header('HTTP/1.0 304 Not Modified');
+ return;
+ }
+
+ $cache = Cache::instance();
+ if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") !== false ) {
+ $content = $cache->get("{$key}_gz");
+ }
+
+ if (empty($content)) {
+ $content = $cache->get($key);
+ }
+
+ if (empty($content)) {
+ Kohana::show_404();
+ }
+
+ if (strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip") !== false) {
+ header("Content-Encoding: gzip");
+ header("Cache-Control: public");
+ }
+
+ header("Content-Type: text/javascript; charset=UTF-8");
+ header("Expires: Tue, 19 Jan 2038 00:00:00 GMT");
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s T", time()));
+
+ Kohana::close_buffers(false);
+ print $content;
+ }
+}
+
diff --git a/modules/gallery/controllers/file_proxy.php b/modules/gallery/controllers/file_proxy.php
index 1f885e53..0d64bcd9 100644
--- a/modules/gallery/controllers/file_proxy.php
+++ b/modules/gallery/controllers/file_proxy.php
@@ -112,6 +112,9 @@ class File_Proxy_Controller extends Controller {
kohana::show_404();
}
+ // We don't need to save the session for this request
+ Session::abort_save();
+
// Dump out the image
header("Content-Type: $item->mime_type");
Kohana::close_buffers(false);
diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php
index aa93a758..831c79c1 100644
--- a/modules/gallery/controllers/l10n_client.php
+++ b/modules/gallery/controllers/l10n_client.php
@@ -106,7 +106,19 @@ class L10n_Client_Controller extends Controller {
}
public static function l10n_form() {
- $calls = I18n::instance()->call_log();
+ if (Input::instance()->get("show_all_l10n_messages")) {
+ $calls = array();
+ foreach (Database::instance()
+ ->select("key", "message")
+ ->from("incoming_translations")
+ ->where(array("locale" => 'root'))
+ ->get()
+ ->as_array() as $row) {
+ $calls[$row->key] = array(unserialize($row->message), array());
+ }
+ } else {
+ $calls = I18n::instance()->call_log();
+ }
$locale = I18n::instance()->locale();
if ($calls) {
diff --git a/modules/gallery/controllers/movies.php b/modules/gallery/controllers/movies.php
index 86b0f177..d8cca825 100644
--- a/modules/gallery/controllers/movies.php
+++ b/modules/gallery/controllers/movies.php
@@ -44,7 +44,7 @@ class Movies_Controller extends Items_Controller {
->where("id <=", $photo->id)
->count_all();
- $template = new Theme_View("page.html", "photo");
+ $template = new Theme_View("page.html", "movie");
$template->set_global("item", $photo);
$template->set_global("children", array());
$template->set_global("children_count", $photo->children_count());
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index cff6686b..e89d9701 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -25,8 +25,10 @@ class Quick_Controller extends Controller {
}
$view = new View("quick_pane.html");
+ $page_type = Input::instance()->get("page_type");
+ $view->button_list = gallery_quick::get_quick_buttons($item, $page_type);
$view->item = $item;
- $view->page_type = Input::instance()->get("page_type");
+ $view->page_type = $page_type;
print $view;
}
diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php
index dfbd4f17..e68df2b8 100644
--- a/modules/gallery/controllers/simple_uploader.php
+++ b/modules/gallery/controllers/simple_uploader.php
@@ -39,7 +39,8 @@ class Simple_Uploader_Controller extends Controller {
access::verify_csrf();
$file_validation = new Validation($_FILES);
- $file_validation->add_rules("Filedata", "upload::valid", "upload::type[gif,jpg,png,flv,mp4]");
+ $file_validation->add_rules(
+ "Filedata", "upload::valid", "upload::type[gif,jpg,jpeg,png,flv,mp4]");
if ($file_validation->validate()) {
// SimpleUploader.swf does not yet call /start directly, so simulate it here for now.
if (!batch::in_progress()) {
diff --git a/modules/gallery/controllers/upgrader.php b/modules/gallery/controllers/upgrader.php
index 5eb96fdd..91952fa9 100644
--- a/modules/gallery/controllers/upgrader.php
+++ b/modules/gallery/controllers/upgrader.php
@@ -50,8 +50,8 @@ class Upgrader_Controller extends Controller {
}
// Upgrade gallery and user first
- module::install("gallery");
- module::install("user");
+ module::upgrade("gallery");
+ module::upgrade("user");
// Then upgrade the rest
foreach (module::available() as $id => $module) {
@@ -60,7 +60,7 @@ class Upgrader_Controller extends Controller {
}
if ($module->active && $module->code_version != $module->version) {
- module::install($id);
+ module::upgrade($id);
}
}