From 001e86456d5aa8460dabba6b5e9d9ab3dd5e2118 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sun, 23 Nov 2014 03:40:04 +1100 Subject: [PATCH] Fixes #788 - Fall back to config theme when db theme fails. --- modules/cms/classes/Theme.php | 6 +++--- modules/cms/controllers/themes/_theme_list.htm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/cms/classes/Theme.php b/modules/cms/classes/Theme.php index 6e1c3dafc..2b9050674 100644 --- a/modules/cms/classes/Theme.php +++ b/modules/cms/classes/Theme.php @@ -95,8 +95,8 @@ class Theme */ public static function exists($dirName) { - $theme = new static; - $path = $theme->getPath($dirName); + $theme = static::load($dirName); + $path = $theme->getPath(); return File::isDirectory($path); } @@ -133,7 +133,7 @@ class Theme ->pluck('value') ; - if ($dbResult !== null) { + if ($dbResult !== null && static::exists($dbResult)) { $activeTheme = $dbResult; } } diff --git a/modules/cms/controllers/themes/_theme_list.htm b/modules/cms/controllers/themes/_theme_list.htm index 3fe0fcb7b..66070e94e 100644 --- a/modules/cms/controllers/themes/_theme_list.htm +++ b/modules/cms/controllers/themes/_theme_list.htm @@ -6,7 +6,7 @@ $theme): ?> getDirName() == $theme->getDirName(); + $isActive = $activeTheme && $activeTheme->getDirName() == $theme->getDirName(); $author = $theme->getConfigValue('author'); ?>