summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-09-02 22:53:06 -0700
committerBharat Mediratta <bharat@menalto.com>2010-09-02 22:53:06 -0700
commit32d18920680ee63dc75c3a2b710ef805b31c127c (patch)
treee8cfe0be65ff2096c719d6300676227a914b9b07 /modules
parent077cf537142cc71ca822e35a055dc7e1d40b80b0 (diff)
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
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/gallery.php15
1 files changed, 11 insertions, 4 deletions
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";
+ }
}
}