PHP8 support

This commit is contained in:
bergware
2023-02-27 03:35:33 +01:00
parent 041d1b5953
commit 644b369930
5 changed files with 13 additions and 13 deletions

View File

@@ -24,7 +24,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'main';
$login_locale = $display['locale'];
$login_locale = _var($display,'locale');
require_once "$docroot/webGui/include/Translations.php";
// remember current language

View File

@@ -72,7 +72,7 @@ while (true) {
$var = @parse_ini_file("$varroot/var.ini") ?: [];
// check for language changes
extract(parse_plugin_cfg('dynamix',true));
if (_var($display,'locale')!=$locale_init) {
if (_var($display,'locale') != $locale_init) {
$locale_init = _var($display,'locale');
update_translation($locale_init);
}

View File

@@ -159,8 +159,8 @@ function device_temp(&$disk, &$red, &$orange) {
global $display;
$spin = strpos(_var($disk,'color'),'blink')===false;
$temp = _var($disk,'temp','*');
$hot = $disk['hotTemp'] ?? $display['hot'] ?? 0;
$max = $disk['maxTemp'] ?? $display['max'] ?? 0;
$max = ($disk['maxTemp'] ?? $display['max'] ?? 0) ?: 0;
$hot = ($disk['hotTemp'] ?? $display['hot'] ?? 0) ?: 0;
$top = $display['top'] ?? 120;
$heat = false; $color = 'green';
if (exceed($temp,$max,$top)) {
@@ -168,7 +168,7 @@ function device_temp(&$disk, &$red, &$orange) {
} elseif (exceed($temp,$hot,$top)) {
$heat = 'fire'; $color = 'orange'; $orange++;
}
return ($spin && $temp>0) ? "<span class='$color-text'>".my_unit($temp,_var($display,'unit'))."</span>".($heat ? "<i class='fa fa-$heat $color-text heat'></i>" : "") : "*";
return ($spin && $temp>0) ? "<span class='$color-text'>".my_unit($temp,_var($display,'unit','C'))."</span>".($heat ? "<i class='fa fa-$heat $color-text heat'></i>" : "") : "*";
}
function device_smart(&$disk, &$fail, &$smart) {
global $numbers,$saved;
@@ -289,7 +289,7 @@ while (true) {
require "$docroot/webGui/include/Preselect.php";
// check for language changes
extract(parse_plugin_cfg('dynamix',true));
if (_var($display,'locale')!=$locale_init) {
if (_var($display,'locale') != $locale_init) {
$locale_init = _var($display,'locale');
update_translation($locale_init);
}
@@ -456,7 +456,7 @@ while (true) {
}
$echo[4] .= "\0";
if ($check) {
$frmt = $display['date'].($display['date']!='%c' ? ", {$display['time']}" : "");
$frmt = _var($display,'date').(_var($display,'date')!='%c' ? ", "._var($display,'time') : "");
$echo[4] .= sprintf(_('Next check scheduled on **%s**'),_(my_date($frmt,$time+$t),0));
$echo[4] .= "<br><i class='fa fa-fw fa-clock-o'></i> "._('Due in').": "._(my_clock(floor($t/60)),2);
} else {

View File

@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2021, Lime Technology
* Copyright 2012-2021, Bergware International.
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -26,7 +26,7 @@ if (!function_exists('_')) {
}
function ports() {
global $net;
exec("ls $net|grep -Po '^(lo|(bond|eth)\d+)$'",$ports);
exec("ls --indicator-style=none $net|grep -Po '^(lo|(bond|eth)\d+)$'",$ports);
return $ports;
}

View File

@@ -21,7 +21,7 @@ extract(parse_plugin_cfg('dynamix',true));
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
$login_locale = $display['locale'];
$login_locale = _var($display,'locale');
require_once "$docroot/webGui/include/Translations.php";
// remember current language
@@ -65,8 +65,8 @@ function update_translation($locale) {
while (true) {
// check for language changes
extract(parse_plugin_cfg('dynamix',true));
if ($display['locale'] != $locale_init) {
$locale_init = $display['locale'];
if (_var($display,'locale') != $locale_init) {
$locale_init = _var($display,'locale');
update_translation($locale_init);
}
unset($status,$rows,$power,$load,$freq,$output,$volt);