summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2010-06-12 13:35:12 -0700
committerBharat Mediratta <bharat@menalto.com>2010-06-12 13:35:12 -0700
commit63d95087bf0f24d4e880843cd2841906c6f91b38 (patch)
tree82514c009768285d65f5533f57411c14b39880ba
parenta4586bc0c01fac6e86163fd119aaa64d95fb5e8e (diff)
Stop trying to parse the continue url in the logout controller because
it requires us to reproduce a bunch of complex routing logic. Instead, just have the logout link generating code generate a link that's visible to guests.
-rw-r--r--modules/gallery/controllers/logout.php12
-rw-r--r--modules/gallery/helpers/gallery_event.php13
2 files changed, 14 insertions, 11 deletions
diff --git a/modules/gallery/controllers/logout.php b/modules/gallery/controllers/logout.php
index fdbadf1b..9caafec8 100644
--- a/modules/gallery/controllers/logout.php
+++ b/modules/gallery/controllers/logout.php
@@ -22,16 +22,8 @@ class Logout_Controller extends Controller {
access::verify_csrf();
auth::logout();
if ($continue_url = Input::instance()->get("continue")) {
- $components = explode("/", parse_url($continue_url, PHP_URL_PATH), 4);
- $item = url::get_item_from_uri($components[3]);
- if (access::can("view", $item)) {
- // Don't use url::redirect() because it'll call url::site() and munge the continue url.
- header("Location: {$item->relative_url()}");
- } else {
- url::redirect(item::root()->abs_url());
- }
- } else {
- url::redirect(item::root()->abs_url());
+ url::redirect($continue_url);
}
+ url::redirect(item::root()->abs_url());
}
} \ No newline at end of file
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index ae7131ae..1b688843 100644
--- a/modules/gallery/helpers/gallery_event.php
+++ b/modules/gallery/helpers/gallery_event.php
@@ -157,11 +157,22 @@ class gallery_event_Core {
->view("login_current_user.html")
->url(user_profile::url($user->id))
->label($user->display_name()));
+
+ if (isset($theme->item)) {
+ if (access::user_can(identity::guest(), "view", $theme->item)) {
+ $continue_url = $theme->item->abs_url();
+ } else {
+ $continue_url = item::root()->abs_url();
+ }
+ } else {
+ $continue_url = url::abs_current();
+ }
+
$menu->append(Menu::factory("link")
->id("user_menu_logout")
->css_id("g-logout-link")
->url(url::site("logout?csrf=$csrf&amp;continue=" .
- urlencode(url::abs_current())))
+ urlencode($continue_url)))
->label(t("Logout")));
}
}