From 32d18920680ee63dc75c3a2b710ef805b31c127c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 2 Sep 2010 22:53:06 -0700 Subject: Follow on to 2a86446249c4782287e1e6e472f422b851c2fb47; fix a bug where guest access to admin pages fails because we try to go to the login page but you can't do that from the admin theme. Thanks to mamouneyya for catching this. http://github.com/gallery/gallery3/commit/2a86446249c4782287e1e6e472f422b851c2fb47 --- modules/gallery/helpers/gallery.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 924ee76a..9430231c 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -45,10 +45,17 @@ class gallery_Core { Router::$controller != "combined" && identity::active_user()->guest && !access::user_can(identity::guest(), "view", item::root())) { - Session::instance()->set("continue_url", url::abs_current()); - Router::$controller = "login"; - Router::$controller_path = MODPATH . "gallery/controllers/login.php"; - Router::$method = "html"; + if (Router::$controller == "admin") { + // At this point we're in the admin theme and it doesn't have a themed login page, so + // we can't just swap in the login controller and have it work. So redirect back to the + // root item where we'll run this code again with the site theme. + url::redirect(item::root()->abs_url()); + } else { + Session::instance()->set("continue_url", url::abs_current()); + Router::$controller = "login"; + Router::$controller_path = MODPATH . "gallery/controllers/login.php"; + Router::$method = "html"; + } } } -- cgit v1.2.3