diff --git a/admin/include/themes.class.php b/admin/include/themes.class.php index ad32b6f7f..82622d878 100644 --- a/admin/include/themes.class.php +++ b/admin/include/themes.class.php @@ -80,6 +80,20 @@ class themes // the theme is already active break; } + + $missing_parent = $this->missing_parent_theme($theme_id); + if (isset($missing_parent)) + { + array_push( + $errors, + sprintf( + l10n('Impossible to activate this theme, the parent theme is missing: %s'), + $missing_parent + ) + ); + + break; + } $query = " INSERT INTO ".THEMES_TABLE." @@ -168,6 +182,28 @@ DELETE return $errors; } + function missing_parent_theme($theme_id) + { + if (!isset($this->fs_themes[$theme_id]['parent'])) + { + return null; + } + + $parent = $this->fs_themes[$theme_id]['parent']; + + if ('default' == $parent) + { + return null; + } + + if (!isset($this->fs_themes[$parent])) + { + return $parent; + } + + return $this->missing_parent_theme($parent); + } + function get_children_themes($theme_id) { $children = array(); diff --git a/admin/themes/default/template/themes_installed.tpl b/admin/themes/default/template/themes_installed.tpl index 0a5a0cc85..4b050c51c 100644 --- a/admin/themes/default/template/themes_installed.tpl +++ b/admin/themes/default/template/themes_installed.tpl @@ -33,13 +33,21 @@