mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-14 03:45:54 +00:00
require version information in all additional themes
This commit is contained in:
@@ -571,7 +571,8 @@ class Pref_Prefs extends Handler_Protected {
|
|||||||
|
|
||||||
} else if ($pref_name == "USER_CSS_THEME") {
|
} else if ($pref_name == "USER_CSS_THEME") {
|
||||||
|
|
||||||
$themes = array_map("basename", glob("themes/*.css"));
|
$themes = array_filter(array_map("basename", glob("themes/*.css")),
|
||||||
|
"theme_valid");
|
||||||
|
|
||||||
print_select($pref_name, $value, $themes,
|
print_select($pref_name, $value, $themes,
|
||||||
'dojoType="dijit.form.Select"');
|
'dojoType="dijit.form.Select"');
|
||||||
|
|||||||
@@ -17,7 +17,10 @@
|
|||||||
$params["default_view_order_by"] = get_pref("_DEFAULT_VIEW_ORDER_BY");
|
$params["default_view_order_by"] = get_pref("_DEFAULT_VIEW_ORDER_BY");
|
||||||
$params["bw_limit"] = (int) $_SESSION["bw_limit"];
|
$params["bw_limit"] = (int) $_SESSION["bw_limit"];
|
||||||
$params["label_base_index"] = (int) LABEL_BASE_INDEX;
|
$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["plugins"] = implode(", ", PluginHost::getInstance()->get_plugin_names());
|
||||||
|
|
||||||
$params["php_platform"] = PHP_OS;
|
$params["php_platform"] = PHP_OS;
|
||||||
@@ -2422,4 +2425,21 @@
|
|||||||
return LABEL_BASE_INDEX - 1 + abs($feed);
|
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;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<?php if ($_SESSION["uid"]) {
|
<?php if ($_SESSION["uid"]) {
|
||||||
$theme = get_pref( "USER_CSS_THEME", $_SESSION["uid"], false);
|
$theme = get_pref( "USER_CSS_THEME", $_SESSION["uid"], false);
|
||||||
if ($theme && file_exists("themes/$theme")) {
|
if ($theme && theme_valid("$theme")) {
|
||||||
echo stylesheet_tag("themes/$theme");
|
echo stylesheet_tag("themes/$theme");
|
||||||
} else {
|
} else {
|
||||||
echo stylesheet_tag("themes/default.css");
|
echo stylesheet_tag("themes/default.css");
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<?php if ($_SESSION["uid"]) {
|
<?php if ($_SESSION["uid"]) {
|
||||||
$theme = get_pref( "USER_CSS_THEME", $_SESSION["uid"], false);
|
$theme = get_pref( "USER_CSS_THEME", $_SESSION["uid"], false);
|
||||||
if ($theme && file_exists("themes/$theme")) {
|
if ($theme && theme_valid("$theme")) {
|
||||||
echo stylesheet_tag("themes/$theme");
|
echo stylesheet_tag("themes/$theme");
|
||||||
} else {
|
} else {
|
||||||
echo stylesheet_tag("themes/default.css");
|
echo stylesheet_tag("themes/default.css");
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* supports-version:1.15 */
|
||||||
@import "default.css";
|
@import "default.css";
|
||||||
|
|
||||||
body#ttrssMain #feeds-holder {
|
body#ttrssMain #feeds-holder {
|
||||||
|
|||||||
Reference in New Issue
Block a user