From 7f67403be15ab347efbe5c080ce5f8cb5b314ba7 Mon Sep 17 00:00:00 2001 From: dMetzger Date: Tue, 2 Oct 2012 13:42:26 +0000 Subject: [PATCH] // Automatically add themes available in /themes --- controllers/admin/AdminThemesController.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/controllers/admin/AdminThemesController.php b/controllers/admin/AdminThemesController.php index f3cd32d1f..042c53888 100644 --- a/controllers/admin/AdminThemesController.php +++ b/controllers/admin/AdminThemesController.php @@ -357,6 +357,18 @@ class AdminThemesControllerCore extends AdminController public function initContent() { + $themes = array(); + foreach (Theme::getThemes() as $theme) + $themes[] = $theme->directory; + + foreach (scandir(_PS_ALL_THEMES_DIR_) as $theme_dir) + if ($theme_dir[0] != '.' && Validate::isDirName($theme_dir) && is_dir(_PS_ALL_THEMES_DIR_.$theme_dir) && file_exists(_PS_ALL_THEMES_DIR_.$theme_dir.'/preview.jpg') && !in_array($theme_dir, $themes)) + { + $theme = new Theme(); + $theme->name = $theme->directory = $theme_dir; + $theme->add(); + } + $content = ''; if (file_exists(_PS_IMG_DIR_.'logo.jpg')) {