diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-10-24 10:37:12 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-10-24 10:37:12 -0700 |
commit | 91e9df7834b98088ba478f691fee73f75ed092fa (patch) | |
tree | 796e8d0fb5616efe06eb8bb2b4eab2051619ac97 | |
parent | 5212deb5b117fd93911c40d5427b55b3063eea4e (diff) |
Update themes::load_theme() to work with mod_rewrite's short urls.
-rw-r--r-- | modules/gallery/helpers/gallery_event.php | 2 | ||||
-rw-r--r-- | modules/gallery/helpers/theme.php | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/modules/gallery/helpers/gallery_event.php b/modules/gallery/helpers/gallery_event.php index 9fc68af5..216efa36 100644 --- a/modules/gallery/helpers/gallery_event.php +++ b/modules/gallery/helpers/gallery_event.php @@ -23,7 +23,7 @@ class gallery_event_Core { * Initialization. */ static function gallery_ready() { - theme::load_themes(Input::instance()->server("PATH_INFO")); + theme::load_themes(); identity::load_user(); locales::set_request_locale(); } diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index 5588fbce..64e919e3 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -28,13 +28,17 @@ class theme_Core { * Load the active theme. This is called at bootstrap time. We will only ever have one theme * active for any given request. */ - static function load_themes($path) { - $modules = Kohana::config("core.modules"); - if (strpos($path, "/admin") === 0) { - array_unshift($modules, THEMEPATH . module::get_var("gallery", "active_admin_theme")); - } else { - array_unshift($modules, THEMEPATH . module::get_var("gallery", "active_site_theme")); + static function load_themes() { + $path = Input::instance()->server("PATH_INFO"); + if (empty($path)) { + $path = "/" . Input::instance()->get("kohana_uri"); } + + $theme_name = module::get_var( + "gallery", + !strncmp($path, "/admin", 6) ? "active_admin_theme" : "active_site_theme"); + $modules = Kohana::config("core.modules"); + array_unshift($modules, THEMEPATH . $theme_name); Kohana::config_set("core.modules", $modules); } |