summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-06-09 21:35:35 +0800
committerTim Almdal <tnalmdal@shaw.ca>2009-06-09 21:45:43 +0800
commitf0ea6d532cbbfd5a95e5b992bc62bb7ecb2c1c3b (patch)
tree010bbbb0e29adb020b9a12d16e85fe918d60d95c /modules/gallery/helpers
parenta42c101c0b76edb403f2f9c646c27539b983394b (diff)
Create a new method in MY_url.php "get_item_from_uri" which loads the item
based on the uri. Then use this helper method in logout.php to insure that the guest user has access to the "continue" uri. If they don't redirect to the root album and let it deal with access issues. Signed-off-by: Tim Almdal <tnalmdal@shaw.ca>
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r--modules/gallery/helpers/MY_url.php21
1 files changed, 14 insertions, 7 deletions
diff --git a/modules/gallery/helpers/MY_url.php b/modules/gallery/helpers/MY_url.php
index c8645c4d..e9a5f860 100644
--- a/modules/gallery/helpers/MY_url.php
+++ b/modules/gallery/helpers/MY_url.php
@@ -46,7 +46,19 @@ class url extends url_Core {
return;
}
- $current_uri = html_entity_decode(Router::$current_uri, ENT_QUOTES);
+ $item = self:: get_item_from_uri(Router::$current_uri);
+ if ($item && $item->loaded) {
+ Router::$controller = "{$item->type}s";
+ Router::$controller_path = MODPATH . "gallery/controllers/{$item->type}s.php";
+ Router::$method = $item->id;
+ }
+ }
+
+ /**
+ * Return the item that the uri is referencing
+ */
+ static function get_item_from_uri($uri) {
+ $current_uri = html_entity_decode($uri);
$item = ORM::factory("item")->where("relative_path_cache", $current_uri)->find();
if (!$item->loaded) {
// It's possible that the relative path cache for the item we're looking for is out of date,
@@ -61,12 +73,7 @@ class url extends url_Core {
}
}
}
-
- if ($item && $item->loaded) {
- Router::$controller = "{$item->type}s";
- Router::$controller_path = MODPATH . "gallery/controllers/{$item->type}s.php";
- Router::$method = $item->id;
- }
+ return $item;
}
/**