diff options
author | Bharat Mediratta <bharat@menalto.com> | 2010-09-02 00:50:02 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2010-09-02 00:50:02 -0700 |
commit | 2a86446249c4782287e1e6e472f422b851c2fb47 (patch) | |
tree | f17a26d911ba6c9de3316f40541718c0149498a0 /modules/gallery/helpers/gallery.php | |
parent | 23b566e5921d5b8bd5a957ecd2d601e556f658a0 (diff) |
Handle the case of a completely private Gallery separately and just
put up a login page, very similar to the way that the maintenance mode
login page works. Fixes ticket #1056.
Diffstat (limited to 'modules/gallery/helpers/gallery.php')
-rw-r--r-- | modules/gallery/helpers/gallery.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 3f83b23d..924ee76a 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -37,6 +37,22 @@ class gallery_Core { } /** + * If the gallery is only available to registered users and the user is not logged in, present + * the login page. + */ + static function private_gallery() { + if (Router::$controller != "login" && + 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"; + } + } + + /** * This function is called when the Gallery is fully initialized. We relay it to modules as the * "gallery_ready" event. Any module that wants to perform an action at the start of every * request should implement the <module>_event::gallery_ready() handler. |