diff options
Diffstat (limited to 'modules/gallery')
-rw-r--r-- | modules/gallery/controllers/admin_languages.php | 32 | ||||
-rw-r--r-- | modules/gallery/controllers/albums.php | 4 | ||||
-rw-r--r-- | modules/gallery/helpers/gallery_error.php | 32 | ||||
-rw-r--r-- | modules/gallery/hooks/init_gallery.php | 3 |
4 files changed, 55 insertions, 16 deletions
diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index d91e5205..a9693d21 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -24,7 +24,7 @@ class Admin_Languages_Controller extends Admin_Controller { $v->content->available_locales = locales::available(); $v->content->installed_locales = locales::installed(); $v->content->default_locale = module::get_var("gallery", "default_locale"); - + if (empty($share_translations_form)) { $share_translations_form = $this->_share_translations_form(); } @@ -35,21 +35,21 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { access::verify_csrf(); - - locales::update_installed($this->input->post("installed_locales")); - - $installed_locales = array_keys(locales::installed()); + + locales::update_installed($this->input->post("installed_locales")); + + $installed_locales = array_keys(locales::installed()); $new_default_locale = $this->input->post("default_locale"); - if (!in_array($new_default_locale, $installed_locales)) { - if (!empty($installed_locales)) { - $new_default_locale = $installed_locales[0]; - } else { - $new_default_locale = "en_US"; - } - } - module::set_var("gallery", "default_locale", $new_default_locale); - - print json_encode(array("result" => "success")); + if (!in_array($new_default_locale, $installed_locales)) { + if (!empty($installed_locales)) { + $new_default_locale = $installed_locales[0]; + } else { + $new_default_locale = "en_US"; + } + } + module::set_var("gallery", "default_locale", $new_default_locale); + + print json_encode(array("result" => "success")); } public function share() { @@ -88,6 +88,8 @@ class Admin_Languages_Controller extends Admin_Controller { message::success(t("Your API key has been changed.")); } else if (!$old_key && $new_key) { message::success(t("Your API key has been saved.")); + } else if ($old_key && $new_key && $old_key == $new_key) { + message::info(t("Your API key was not changed.")); } log::success(t("gallery"), t("l10n_client API key changed.")); diff --git a/modules/gallery/controllers/albums.php b/modules/gallery/controllers/albums.php index 3ea08538..694cc4ff 100644 --- a/modules/gallery/controllers/albums.php +++ b/modules/gallery/controllers/albums.php @@ -28,7 +28,9 @@ class Albums_Controller extends Items_Controller { if ($album->id == 1) { $view = new Theme_View("page.html", "login"); $view->page_title = t("Log in to Gallery"); - $view->content = user::get_login_form("login/auth_html"); + //$view->content = user::get_login_form("login/auth_html"); + $view->content = new View("login_ajax.html"); + $view->content->form = user::get_login_form("login/auth_html"); print $view; return; } else { diff --git a/modules/gallery/helpers/gallery_error.php b/modules/gallery/helpers/gallery_error.php new file mode 100644 index 00000000..91e05407 --- /dev/null +++ b/modules/gallery/helpers/gallery_error.php @@ -0,0 +1,32 @@ +<?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 gallery_error_Core { + function error_handler($severity, $message, $filename, $lineno) { + if (error_reporting() == 0) { + return; + } + + if (error_reporting() & $severity) { + $e = new ErrorException($message, 0, $severity, $filename, $lineno); + log::error("error", $e->getMessage()); + Kohana::log("error", $e->__toString()); + } + } +}
\ No newline at end of file diff --git a/modules/gallery/hooks/init_gallery.php b/modules/gallery/hooks/init_gallery.php index 5735e7dc..da7eeb0f 100644 --- a/modules/gallery/hooks/init_gallery.php +++ b/modules/gallery/hooks/init_gallery.php @@ -32,6 +32,9 @@ Event::add("system.post_routing", array("url", "parse_url")); Event::add("system.post_routing", array("gallery", "maintenance_mode")); Event::add("system.shutdown", array("gallery", "shutdown")); +// @todo once we convert to Kohana 2.4 this doesn't have to be here +set_error_handler(array("gallery_error", "error_handler")); + // Override the cookie if we have a session id in the URL. // @todo This should probably be an event callback $input = Input::instance(); |