diff options
author | Bharat Mediratta <bharat@menalto.com> | 2011-04-22 09:28:19 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2011-04-22 09:28:19 -0700 |
commit | 11703b24ffdf38443ac46afbfa65e6f07ec5648e (patch) | |
tree | fb1a44595990dc53c334dbca58be87e003a7fd6f /modules/gallery/helpers/theme.php | |
parent | 1d9afcf441d0f9684e298fd7c18991731e16a93d (diff) |
Detect if the users theme is missing (or missing a theme.info) and in
that case fall back to the wind theme. Fixes #1655.
Diffstat (limited to 'modules/gallery/helpers/theme.php')
-rw-r--r-- | modules/gallery/helpers/theme.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index a42fa7ad..37707f28 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -50,9 +50,25 @@ class theme_Core { 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 |