diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-06-09 19:00:22 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-06-09 19:00:22 -0700 |
commit | e5d273e929b630ab86ce31bf75c3e0fa3064ced0 (patch) | |
tree | 92407184459e2c2fcb12360880bb1358caa0e48e /modules/gallery/helpers | |
parent | d0b25445119274760af40722eaa95279c2942a89 (diff) | |
parent | b276eaa68beca1266bf8fd83625ddfad73f44420 (diff) |
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/MY_url.php | 21 |
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; } /** |