Update templates w/ getLogLimited, add $logdata to payload

This commit is contained in:
billz 2023-11-28 10:05:06 +00:00
parent 05210e8967
commit 74656c63ed
6 changed files with 14 additions and 10 deletions

View file

@ -92,6 +92,7 @@ function DisplayAdBlockConfig()
} else { } else {
$adblock_log = "Unable to open log file"; $adblock_log = "Unable to open log file";
} }
$logdata = getLogLimited(RASPI_DHCPCD_LOG, $adblock_log);
echo renderTemplate( echo renderTemplate(
"adblock", compact( "adblock", compact(
@ -101,7 +102,7 @@ function DisplayAdBlockConfig()
"enabled", "enabled",
"custom_enabled", "custom_enabled",
"adblock_custom_content", "adblock_custom_content",
"adblock_log" "logdata"
) )
); );
} }

View file

@ -60,6 +60,9 @@ function DisplayDHCPConfig()
count($log_dhcp) > 0 ? $conf['log-dhcp'] = true : false ; count($log_dhcp) > 0 ? $conf['log-dhcp'] = true : false ;
count($log_queries) > 0 ? $conf['log-queries'] = true : false ; count($log_queries) > 0 ? $conf['log-queries'] = true : false ;
exec('sudo /bin/chmod o+r '.RASPI_DHCPCD_LOG);
$logdata = getLogLimited(RASPI_DHCPCD_LOG);
echo renderTemplate( echo renderTemplate(
"dhcp", compact( "dhcp", compact(
"status", "status",
@ -70,7 +73,8 @@ function DisplayDHCPConfig()
"hosts", "hosts",
"upstreamServers", "upstreamServers",
"interfaces", "interfaces",
"leases" "leases",
"logdata"
) )
); );
} }

View file

@ -135,6 +135,8 @@ function DisplayHostAPDConfig()
$selectedHwMode = 'w'; $selectedHwMode = 'w';
} }
} }
exec('sudo /bin/chmod o+r '.RASPI_HOSTAPD_LOG);
$logdata = getLogLimited(RASPI_HOSTAPD_LOG);
echo renderTemplate( echo renderTemplate(
"hostapd", compact( "hostapd", compact(
@ -153,7 +155,8 @@ function DisplayHostAPDConfig()
"arrHostapdConf", "arrHostapdConf",
"operatingSystem", "operatingSystem",
"selectedHwMode", "selectedHwMode",
"countryCodes" "countryCodes",
"logdata"
) )
); );
} }

View file

@ -3,7 +3,7 @@
<h4 class="mt-3"><?php echo _("Logging"); ?></h4> <h4 class="mt-3"><?php echo _("Logging"); ?></h4>
<div class="row"> <div class="row">
<div class="form-group col-md-8"> <div class="form-group col-md-8">
<?php echo '<textarea class="logoutput">'.htmlspecialchars($adblock_log, ENT_QUOTES).'</textarea>'; ?> <?php echo '<textarea class="logoutput">'.htmlspecialchars($logdata, ENT_QUOTES).'</textarea>'; ?>
</div> </div>
</div> </div>
</div><!-- /.tab-pane --> </div><!-- /.tab-pane -->

View file

@ -17,9 +17,7 @@
<div class="form-group col-md-8 mt-2"> <div class="form-group col-md-8 mt-2">
<?php <?php
if ($conf['log-dhcp'] == 1 || $conf['log-queries'] == 1) { if ($conf['log-dhcp'] == 1 || $conf['log-queries'] == 1) {
exec('sudo /bin/chmod o+r '.RASPI_DHCPCD_LOG); echo '<textarea class="logoutput" id="dnsmasq-log">'.htmlspecialchars($logdata, ENT_QUOTES).'</textarea>';
$log = file_get_contents(RASPI_DHCPCD_LOG);
echo '<textarea class="logoutput" id="dnsmasq-log">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
} else { } else {
echo '<textarea class="logoutput my-3"></textarea>'; echo '<textarea class="logoutput my-3"></textarea>';
} }

View file

@ -14,9 +14,7 @@
<div class="form-group col-md-8 mt-2"> <div class="form-group col-md-8 mt-2">
<?php <?php
if ($arrHostapdConf['LogEnable'] == 1) { if ($arrHostapdConf['LogEnable'] == 1) {
exec('sudo /bin/chmod o+r /tmp/hostapd.log'); echo '<textarea class="logoutput" id="hostapd-log">'.htmlspecialchars($logdata, ENT_QUOTES).'</textarea>';
$log = file_get_contents('/tmp/hostapd.log');
echo '<textarea class="logoutput" id="hostapd-log">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
} else { } else {
echo '<textarea class="logoutput my-3"></textarea>'; echo '<textarea class="logoutput my-3"></textarea>';
} }