+ public static function getAllowedList()
+ {
+ $allowed_themes_str = DI::config()->get('system', 'allowed_themes');
+ $allowed_themes_raw = explode(',', str_replace(' ', '', $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 array_unique($allowed_themes);
+ }
+
+ public static function setAllowedList(array $allowed_themes)
+ {
+ DI::config()->set('system', 'allowed_themes', implode(',', array_unique($allowed_themes)));
+ }
+