Small fix for header.php (prevent accumulation of "PHP Notice: Undefined index: TEMPERATUREUNIT" in lighttpd's error.log)

This commit is contained in:
DL6ER
2016-11-24 12:46:59 +01:00
parent 8f1b3a4101
commit 35f250352f
+10 -1
View File
@@ -28,7 +28,16 @@
$output = shell_exec($cmd);
$celsius = str_replace(array("\r\n","\r","\n"),"", $output);
$fahrenheit = round(str_replace(["\r\n","\r","\n"],"", $output*9./5)+32);
$temperatureunit = parse_ini_file("/etc/pihole/setupVars.conf")['TEMPERATUREUNIT'];
$setupVars = parse_ini_file("/etc/pihole/setupVars.conf");
if(isset($setupVars['TEMPERATUREUNIT']))
{
$temperatureunit = $setupVars['TEMPERATUREUNIT'];
}
else
{
$temperatureunit = "C";
}
// Get load
$loaddata = sys_getloadavg();