diff options
author | Chad Kieffer <ckieffer@gmail.com> | 2011-04-22 12:38:10 -0400 |
---|---|---|
committer | Chad Kieffer <ckieffer@gmail.com> | 2011-04-22 12:38:10 -0400 |
commit | fbf02970e1c454ad99b2fc01a897a8de834d7e7c (patch) | |
tree | df6f587fe1ed2635d8becd655d9a9518a5d0bc3a /modules/gallery/helpers | |
parent | 4a9b45c9c3bbd574103e01debcd84cab1a18352a (diff) | |
parent | 55da59c942c0f7171b515f0718fea8506ed4b116 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/theme.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index f285834c..37707f28 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -41,11 +41,34 @@ class theme_Core { $config = Kohana_Config::instance(); $modules = $config->get("core.modules"); + + // Normally Router::find_uri() strips off the url suffix for us, but we're working off of the + // PATH_INFO here so we need to strip it off manually + if ($suffix = Kohana::config("core.url_suffix")) { + $path = preg_replace("#" . preg_quote($suffix) . "$#u", "", $path); + } + self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7); self::$site_theme_name = module::get_var("gallery", "active_site_theme"); + + // If the site theme doesn't exist, fall back to wind. + if (!file_exists(THEMEPATH . self::$site_theme_name . "/theme.info")) { + site_status::error(t("Theme '%name' is missing. Falling back to the Wind theme.", + array("name" => self::$site_theme_name)), "missing_site_theme"); + module::set_var("gallery", "active_site_theme", self::$site_theme_name = "wind"); + } + if (self::$is_admin) { // Load the admin theme self::$admin_theme_name = module::get_var("gallery", "active_admin_theme"); + + // If the admin theme doesn't exist, fall back to admin_wind. + if (!file_exists(THEMEPATH . self::$admin_theme_name . "/theme.info")) { + site_status::error(t("Admin theme '%name' is missing! Falling back to the Wind theme.", + array("name" => self::$admin_theme_name)), "missing_admin_theme"); + module::set_var("gallery", "active_admin_theme", self::$admin_theme_name = "admin_wind"); + } + array_unshift($modules, THEMEPATH . self::$admin_theme_name); // If the site theme has an admin subdir, load that as a module so that |