summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/MY_url.php
diff options
context:
space:
mode:
authorMarc <dkm@kataplop.net>2009-06-10 09:53:00 +0200
committerMarc <dkm@kataplop.net>2009-06-10 09:53:00 +0200
commit9b4c7ba73cc86dca8fb6cf81a37fbf806e643483 (patch)
tree0c4d3a99471c21103a34ad5e2fb748199fe4f8f2 /modules/gallery/helpers/MY_url.php
parent657e17361db19ac1878b2a6d93595a763aef8b15 (diff)
parentfc64a55f2e6d2e3f16e0806e6672f7d8c8de42a7 (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers/MY_url.php')
-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..7bee70ca 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;
}
/**