summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rwxr-xr-xinclude/controls.php14
-rwxr-xr-xinclude/functions.php63
2 files changed, 39 insertions, 38 deletions
diff --git a/include/controls.php b/include/controls.php
index 037e331cc..012bcf76c 100755
--- a/include/controls.php
+++ b/include/controls.php
@@ -233,10 +233,12 @@ function print_feed_cat_select($id, $default_id,
}
}
-function stylesheet_tag($filename) {
+function stylesheet_tag($filename, $id = false) {
$timestamp = filemtime($filename);
- return "<link rel=\"stylesheet\" type=\"text/css\" href=\"$filename?$timestamp\"/>\n";
+ $id_part = $id ? "id=\"$id\"" : "";
+
+ return "<link rel=\"stylesheet\" $id_part type=\"text/css\" href=\"$filename?$timestamp\"/>\n";
}
function javascript_tag($filename) {
@@ -286,18 +288,22 @@ function format_inline_player($url, $ctype) {
if (strpos($ctype, "audio/") === 0) {
+ $entry .= "<div class='inline-player'>";
+
if ($_SESSION["hasAudio"] && (strpos($ctype, "ogg") !== false ||
$_SESSION["hasMp3"])) {
$entry .= "<audio preload=\"none\" controls>
<source type=\"$ctype\" src=\"$url\"/>
- </audio>";
+ </audio> ";
}
- if ($entry) $entry .= "&nbsp; <a target=\"_blank\" rel=\"noopener noreferrer\"
+ if ($entry) $entry .= "<a target=\"_blank\" rel=\"noopener noreferrer\"
href=\"$url\">" . basename($url) . "</a>";
+ $entry .= "</div>";
+
return $entry;
}
diff --git a/include/functions.php b/include/functions.php
index 1ff18c8bb..9c7d98b69 100755
--- a/include/functions.php
+++ b/include/functions.php
@@ -1,6 +1,6 @@
<?php
define('EXPECTED_CONFIG_VERSION', 26);
- define('SCHEMA_VERSION', 134);
+ define('SCHEMA_VERSION', 135);
define('LABEL_BASE_INDEX', -1024);
define('PLUGIN_FEED_BASE_INDEX', -128);
@@ -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());
@@ -1107,9 +1107,6 @@
$params['simple_update'] = defined('SIMPLE_UPDATE_MODE') && SIMPLE_UPDATE_MODE;
- $params["icon_alert"] = base64_img("images/alert.png");
- $params["icon_information"] = base64_img("images/information.png");
- $params["icon_cross"] = base64_img("images/cross.png");
$params["icon_indicator_white"] = base64_img("images/indicator_white.gif");
$params["labels"] = Labels::get_all_labels($_SESSION["uid"]);
@@ -1177,6 +1174,7 @@
"create_label" => __("Create label"),
"create_filter" => __("Create filter"),
"collapse_sidebar" => __("Un/collapse sidebar"),
+ "toggle_night_mode" => __("Toggle night mode"),
"help_dialog" => __("Show help dialog"))
);
@@ -1248,6 +1246,7 @@
"c l" => "create_label",
"c f" => "create_filter",
"c s" => "collapse_sidebar",
+ "a *n" => "toggle_night_mode",
"^(191)|Ctrl+/" => "help_dialog",
);
@@ -1948,7 +1947,8 @@
}
}
- $filter = array();
+ $filter = [];
+ $filter["id"] = $filter_id;
$filter["match_any_rule"] = sql_bool_to_bool($line["match_any_rule"]);
$filter["inverse"] = sql_bool_to_bool($line["inverse"]);
$filter["rules"] = $rules;
@@ -1963,17 +1963,31 @@
}
function get_score_pic($score) {
- if ($score > 100) {
- return "score_high.png";
+ if ($score > 500) {
+ return "trending_up";
} else if ($score > 0) {
- return "score_half_high.png";
+ return "trending_up";
+ } else if ($score < 0) {
+ return "trending_down";
+ } else {
+ return "trending_neutral";
+ }
+ }
+
+ function get_score_class($score) {
+ if ($score > 500) {
+ $score_class = "score-high";
+ } else if ($score > 0) {
+ $score_class = "score-half-high";
} else if ($score < -100) {
- return "score_low.png";
+ $score_class = "score-low";
} else if ($score < 0) {
- return "score_half_low.png";
+ $score_class = "score-half-low";
} else {
- return "score_neutral.png";
+ $score_class = "score-neutral";
}
+
+ return $score_class;
}
function init_plugins() {
@@ -2430,27 +2444,8 @@
if (file_exists($check)) return $check;
}
- function theme_valid($theme) {
- $bundled_themes = [ "default.php", "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");
}
/**
@@ -2577,4 +2572,4 @@
}
return $ts;
- } \ No newline at end of file
+ }