summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2014-12-09 15:16:53 +0300
committerAndrew Dolgov <[email protected]>2014-12-09 15:16:53 +0300
commitf6cbe9a5a03056be4e8f20747ef5f933e2a55f12 (patch)
tree15d08ffc7ec733d6a310066714cff2244af7aecf /include
parent9b46c8e5e74ce512e92df156ba9caa5156d637fb (diff)
require version information in all additional themes
Diffstat (limited to 'include')
-rw-r--r--include/functions2.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/include/functions2.php b/include/functions2.php
index 31ca98035..45c73b373 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") 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;
+ }
?>