mirror of
https://github.com/pi-hole/web.git
synced 2026-04-24 02:39:25 +01:00
Use and set the unit on setupVars.conf option TEMPERATUREUNIT
New behavior!!! The temperature unit will be set GLOBALLY and not per browser. - if a TEMPERATUREUNIT is set in setupVars.conf file, the value will be used. - if there is no unit set in setupVars.conf, "C" will be used; - changing the value on the web interface WILL CHANGE setupVars.conf. - if the browser has an old value set on locastorage, this will be ingnored. Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
@@ -98,7 +98,22 @@ function getTemperature()
|
||||
$limit = null;
|
||||
}
|
||||
|
||||
return array($celsius, $limit);
|
||||
// Get user-defined temperature limit if set
|
||||
if (isset($setupVars['TEMPERATUREUNIT'])) {
|
||||
switch (strtoupper($setupVars['TEMPERATUREUNIT'])) {
|
||||
case 'F':
|
||||
case 'K':
|
||||
$unit = strtoupper($setupVars['TEMPERATUREUNIT']);
|
||||
break;
|
||||
|
||||
default:
|
||||
$unit = 'C';
|
||||
}
|
||||
} else {
|
||||
$unit = 'C';
|
||||
}
|
||||
|
||||
return array($celsius, $limit, $unit);
|
||||
}
|
||||
|
||||
check_cors();
|
||||
@@ -113,7 +128,7 @@ $token = $_SESSION['token'];
|
||||
$maxlifetime = ini_get('session.gc_maxlifetime');
|
||||
|
||||
// Get temperature
|
||||
list($celsius, $temperaturelimit) = getTemperature();
|
||||
list($celsius, $temperaturelimit, $temperatureunit) = getTemperature();
|
||||
|
||||
// Get CPU load
|
||||
$loaddata = sys_getloadavg();
|
||||
|
||||
Reference in New Issue
Block a user