diff --git a/includes/dashboard.php b/includes/dashboard.php index 303060f1..664536ad 100755 --- a/includes/dashboard.php +++ b/includes/dashboard.php @@ -88,6 +88,7 @@ function DisplayDashboard(&$extraFooterScripts): void } else { $firewallManaged = ''; $firewallStatus = ($dashboard->firewallEnabled() == true) ? "active" : ""; + $firewallUnavailable = null; } echo renderTemplate( diff --git a/includes/wireguard.php b/includes/wireguard.php index af6dbe28..0493510c 100755 --- a/includes/wireguard.php +++ b/includes/wireguard.php @@ -49,7 +49,9 @@ function DisplayWireGuardConfig() exec('sudo cat '. RASPI_WIREGUARD_CONFIG, $return); $conf = ParseConfig($return, $parseFlag); $wg_srvpubkey = exec('sudo cat '. RASPI_WIREGUARD_PATH .'wg-server-public.key', $return); - $wg_srvport = ($conf['ListenPort'] == '') ? getDefaultNetValue('wireguard','server','ListenPort') : $conf['ListenPort']; + $wg_srvport = ($conf['ListenPort'] ?? '') === '' + ? getDefaultNetValue('wireguard','server','ListenPort') + : $conf['ListenPort']; $wg_srvipaddress = ($conf['Address'] == '') ? getDefaultNetValue('wireguard','server','Address') : $conf['Address']; $wg_srvdns = ($conf['DNS'] == '') ? getDefaultNetValue('wireguard','server','DNS') : $conf['DNS']; if (is_array($wg_srvdns)) { diff --git a/src/RaspAP/Networking/Hotspot/DnsmasqManager.php b/src/RaspAP/Networking/Hotspot/DnsmasqManager.php index 6076ff44..ddfb1aa5 100644 --- a/src/RaspAP/Networking/Hotspot/DnsmasqManager.php +++ b/src/RaspAP/Networking/Hotspot/DnsmasqManager.php @@ -168,7 +168,7 @@ class DnsmasqManager if ($post_data['no-resolv'] == "1") { $config[] = "no-resolv"; } - foreach ($post_data['server'] as $server) { + foreach (($post_data['server'] ?? []) as $server) { $config[] = "server=$server"; } if (!empty($post_data['DNS1'])) { diff --git a/src/RaspAP/System/Sysinfo.php b/src/RaspAP/System/Sysinfo.php index 0e636709..b731503f 100755 --- a/src/RaspAP/System/Sysinfo.php +++ b/src/RaspAP/System/Sysinfo.php @@ -173,12 +173,14 @@ class Sysinfo { exec('cat '. RASPI_ADBLOCK_CONFIG, $return); $arrConf = ParseConfig($return); + $enabled = false; if (sizeof($arrConf) > 0) { $enabled = true; } exec('pidof dnsmasq | wc -l', $dnsmasq); $dnsmasq_state = ($dnsmasq[0] > 0); - $status = $dnsmasq_state && $enabled ? true : false; + + $status = $dnsmasq_state && $enabled; return $status; } diff --git a/src/RaspAP/UI/Dashboard.php b/src/RaspAP/UI/Dashboard.php index fea6804a..3f31811a 100644 --- a/src/RaspAP/UI/Dashboard.php +++ b/src/RaspAP/UI/Dashboard.php @@ -301,14 +301,12 @@ class Dashboard { */ public function firewallEnabled(): bool { - $conf = array(); - if (file_exists($this->firewallConfig) ) { - $conf = parse_ini_file($this->firewallConfig); + if (!file_exists($this->firewallConfig)) { + return false; } - if ($conf["firewall-enable"] == 1) { - return true; - } - return false; + + $conf = parse_ini_file($this->firewallConfig) ?: []; + return !empty($conf['firewall-enable']) && (int)$conf['firewall-enable'] === 1; } /* diff --git a/templates/wg/logging.php b/templates/wg/logging.php index 26ab9e5d..6e52e956 100644 --- a/templates/wg/logging.php +++ b/templates/wg/logging.php @@ -8,7 +8,7 @@ aria-describedby="wgLogEnable"> - '.htmlspecialchars($wg_log, ENT_QUOTES).''; + '.htmlspecialchars($log, ENT_QUOTES).''; ?>