mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-12-26 23:26:47 +01:00
Fix undefined vars in class methods + includes
This commit is contained in:
@@ -88,6 +88,7 @@ function DisplayDashboard(&$extraFooterScripts): void
|
||||
} else {
|
||||
$firewallManaged = '<a href="/plugin__Firewall">';
|
||||
$firewallStatus = ($dashboard->firewallEnabled() == true) ? "active" : "";
|
||||
$firewallUnavailable = null;
|
||||
}
|
||||
|
||||
echo renderTemplate(
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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'])) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<input class="form-check-input" id="wgLogEnable" type="checkbox" name="wgLogEnable" value="1" <?php echo $optLogEnable ? ' checked="checked"' : "" ?> aria-describedby="wgLogEnable">
|
||||
<label class="form-check-label" for="wgLogEnable"><?php echo _("Logfile output") ?></label>
|
||||
</div>
|
||||
<?php echo '<textarea class="logoutput text-secondary my-3">'.htmlspecialchars($wg_log, ENT_QUOTES).'</textarea>';
|
||||
<?php echo '<textarea class="logoutput text-secondary my-3">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
|
||||
?>
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
|
||||
Reference in New Issue
Block a user