remove theme supports-version etc checking
This commit is contained in:
parent
b2c079893b
commit
703351c79e
|
@ -552,10 +552,10 @@ class Pref_Prefs extends Handler_Protected {
|
|||
|
||||
$themes = array_merge(glob("themes/*.php"), glob("themes/*.css"), glob("themes.local/*.css"));
|
||||
$themes = array_map("basename", $themes);
|
||||
$themes = array_filter($themes, "theme_valid");
|
||||
$themes = array_filter($themes, "theme_exists");
|
||||
asort($themes);
|
||||
|
||||
if (!theme_valid($value)) $value = "default.php";
|
||||
if (!theme_exists($value)) $value = "default.php";
|
||||
|
||||
print "<select name='$pref_name' id='$pref_name' dojoType='dijit.form.Select'>";
|
||||
|
||||
|
|
|
@ -1078,7 +1078,7 @@
|
|||
$params["label_base_index"] = (int) LABEL_BASE_INDEX;
|
||||
|
||||
$theme = get_pref( "USER_CSS_THEME", false, false);
|
||||
$params["theme"] = theme_valid("$theme") ? $theme : "";
|
||||
$params["theme"] = theme_exists($theme) ? $theme : "";
|
||||
|
||||
$params["plugins"] = implode(", ", PluginHost::getInstance()->get_plugin_names());
|
||||
|
||||
|
@ -2442,27 +2442,8 @@
|
|||
if (file_exists($check)) return $check;
|
||||
}
|
||||
|
||||
function theme_valid($theme) {
|
||||
$bundled_themes = [ "night.css", "compact.css" ];
|
||||
|
||||
if (in_array($theme, $bundled_themes)) return true;
|
||||
|
||||
$file = "themes/" . basename($theme);
|
||||
|
||||
if (!file_exists($file)) $file = "themes.local/" . basename($theme);
|
||||
|
||||
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;
|
||||
function theme_exists($theme) {
|
||||
return file_exists("themes/$theme") || file_exists("themes.local/$theme");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
<?php if ($_SESSION["uid"]) {
|
||||
$theme = get_pref("USER_CSS_THEME", false, false);
|
||||
if ($theme && theme_valid("$theme")) {
|
||||
if ($theme && theme_exists("$theme")) {
|
||||
echo stylesheet_tag(get_theme_path($theme));
|
||||
} else {
|
||||
echo stylesheet_tag("css/default.css");
|
||||
|
|
Loading…
Reference in New Issue