From 6aac84dc8e5f575af15cd2f67e3af045694ebe21 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sun, 31 Mar 2019 21:41:38 -0400 Subject: [PATCH] Add Theme::getAllowedList method --- src/Core/Theme.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Core/Theme.php b/src/Core/Theme.php index 5479f8f46f..02ffe3ada4 100644 --- a/src/Core/Theme.php +++ b/src/Core/Theme.php @@ -16,6 +16,23 @@ require_once 'boot.php'; */ class Theme { + public static function getAllowedList() + { + $allowed_themes_str = Config::get('system', 'allowed_themes'); + $allowed_themes_raw = explode(',', $allowed_themes_str); + $allowed_themes = []; + if (count($allowed_themes_raw)) { + foreach ($allowed_themes_raw as $theme) { + $theme = Strings::sanitizeFilePathItem(trim($theme)); + if (strlen($theme) && is_dir("view/theme/$theme")) { + $allowed_themes[] = $theme; + } + } + } + + return $allowed_themes; + } + /** * @brief Parse theme comment in search of theme infos. * -- 2.39.5