diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-10 08:45:14 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-10 08:45:14 -0800 |
commit | 17f0a1b10f3df250129188316c14b01f0e3b45f0 (patch) | |
tree | 2a48f7b8409b63a0b3847aed8dfb6036d988d55c /modules/gallery/controllers/photos.php | |
parent | f6c615c379bb6950dacff34bfda73a616dce6e6b (diff) |
If the user does not have permission to view the album, photo or movie, redirect
to a logon page to allow the user to login. Pass the target url as a session
variable to allow the user to be redirected where they want to go if the login
was successful. Fixes ticket #1009.
Diffstat (limited to 'modules/gallery/controllers/photos.php')
-rw-r--r-- | modules/gallery/controllers/photos.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/modules/gallery/controllers/photos.php b/modules/gallery/controllers/photos.php index b5da3884..8beae207 100644 --- a/modules/gallery/controllers/photos.php +++ b/modules/gallery/controllers/photos.php @@ -24,7 +24,15 @@ class Photos_Controller extends Items_Controller { // sure that we're actually receiving an object Kohana::show_404(); } - access::required("view", $photo); + + if (!access::can("view", $photo)) { + $view = new Theme_View("page.html", "other", "login"); + $view->page_title = t("Log in to Gallery"); + $view->content = new View("login_ajax.html"); + $view->content->form = auth::get_login_form("login/auth_html"); + print $view; + return; + } $where = array(array("type", "!=", "album")); $position = $photo->parent()->get_position($photo, $where); |