Skip to content

Commit

Permalink
Detect if the users theme is missing (or missing a theme.info) and in
Browse files Browse the repository at this point in the history
that case fall back to the wind theme.  Fixes #1655.
  • Loading branch information
bharat committed Apr 22, 2011
1 parent 1d9afcf commit 11703b2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/gallery/helpers/theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,25 @@ static function load_themes() {

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
Expand Down

0 comments on commit 11703b2

Please sign in to comment.