From 35f250352f2e1020384b1cf7a12240e16e360bb7 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Thu, 24 Nov 2016 12:46:59 +0100 Subject: [PATCH] Small fix for header.php (prevent accumulation of "PHP Notice: Undefined index: TEMPERATUREUNIT" in lighttpd's error.log) --- header.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/header.php b/header.php index 566c4b58..73d54fe5 100644 --- a/header.php +++ b/header.php @@ -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();