]> git.mxchange.org Git - friendica.git/commitdiff
Add Theme::getAllowedList method
authorHypolite Petovan <hypolite@mrpetovan.com>
Mon, 1 Apr 2019 01:41:38 +0000 (21:41 -0400)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 1 Apr 2019 01:41:38 +0000 (21:41 -0400)
src/Core/Theme.php

index 5479f8f46f8e2deeb097d1dd0c98d9401da0cccb..02ffe3ada47e1ff3bf470d73dd87217c361a86a0 100644 (file)
@@ -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.
         *