summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-06-13 09:59:27 -0700
committerTim Almdal <tnalmdal@shaw.ca>2010-06-13 09:59:27 -0700
commit938eea7fc45d5ad26529a14f349b7e4be2fecb15 (patch)
tree903f5fd467565b16e7e65d84101060920b1449b7 /modules/gallery/helpers
parent0ebc36b4e5ef5578791c00b8a64021d3aad96068 (diff)
parent87f8b6ff0a76f51183f14515723a8345f7c14fa6 (diff)
Merge branch 'master' into talmdal_dev
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/auth.php1
-rw-r--r--modules/gallery/helpers/gallery_event.php15
-rw-r--r--modules/gallery/helpers/item.php2
3 files changed, 15 insertions, 3 deletions
diff --git a/modules/gallery/helpers/auth.php b/modules/gallery/helpers/auth.php
index 1a9fe869..48b5fc32 100644
--- a/modules/gallery/helpers/auth.php
+++ b/modules/gallery/helpers/auth.php
@@ -21,6 +21,7 @@ class auth_Core {
static function get_login_form($url) {
$form = new Forge($url, "", "post", array("id" => "g-login-form"));
$form->set_attr("class", "g-narrow");
+ $form->hidden("continue_url")->value(Session::instance()->get("continue_url"));
$group = $form->group("login")->label(t("Login"));
$group->input("name")->label(t("Username"))->id("g-username")->class(null)
->callback("auth::validate_too_many_failed_logins")
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php
index ae7131ae..55db47ce 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())))
+ ->url(url::site("logout?csrf=$csrf&amp;continue_url=" .
+ urlencode($continue_url)))
->label(t("Logout")));
}
}
diff --git a/modules/gallery/helpers/item.php b/modules/gallery/helpers/item.php
index bbbe1058..15bbe977 100644
--- a/modules/gallery/helpers/item.php
+++ b/modules/gallery/helpers/item.php
@@ -136,7 +136,7 @@ class item_Core {
*/
static function convert_filename_to_title($filename) {
$title = strtr($filename, "_", " ");
- $title = preg_replace("/\..*?$/", "", $title);
+ $title = preg_replace("/\..{3,4}$/", "", $title);
$title = preg_replace("/ +/", " ", $title);
return $title;
}