X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=include%2Ffunctions2.php;h=669bbe038634c83cddd42532b13f623f6041d3b9;hb=21d7585a54925f845cd90c4967dd19b3ad92bb02;hp=31ca98035e953b87fb940a733d4dd68a42c94200;hpb=c63850fad00f228ae9613d8f662dd4d2ff05e528;p=tt-rss.git diff --git a/include/functions2.php b/include/functions2.php index 31ca9803..669bbe03 100644 --- a/include/functions2.php +++ b/include/functions2.php @@ -17,7 +17,10 @@ $params["default_view_order_by"] = get_pref("_DEFAULT_VIEW_ORDER_BY"); $params["bw_limit"] = (int) $_SESSION["bw_limit"]; $params["label_base_index"] = (int) LABEL_BASE_INDEX; - $params["theme"] = get_pref("USER_CSS_THEME", false, false); + + $theme = get_pref( "USER_CSS_THEME", false, false); + $params["theme"] = theme_valid("$theme") ? $theme : ""; + $params["plugins"] = implode(", ", PluginHost::getInstance()->get_plugin_names()); $params["php_platform"] = PHP_OS; @@ -2422,4 +2425,21 @@ return LABEL_BASE_INDEX - 1 + abs($feed); } + function theme_valid($file) { + if ($file == "default.css" || $file == "night.css") return true; // needed for array_filter + $file = "themes/" . basename($file); + + if (file_exists($file) && is_readable($file)) { + $fh = fopen($file, "r"); + + if ($fh) { + $header = fgets($fh); + fclose($fh); + + return strpos($header, "supports-version:" . VERSION_STATIC) !== FALSE; + } + } + + return false; + } ?>