Transfer template logic to includes, see #749 thx @mp035

This commit is contained in:
billz
2021-02-02 12:26:14 +00:00
parent 3d2d608477
commit b21ea0d28d
19 changed files with 216 additions and 193 deletions

View File

@@ -21,13 +21,7 @@
</div>
<div class="row">
<div class="form-group col-md-8">
<?php
$adblock_custom = file_get_contents(RASPI_ADBLOCK_LISTPATH .'custom.txt');
if (strlen($adblock_custom) == 0) {
$adblock_custom = _("Custom blocklist not defined");
}
echo '<textarea class="logoutput" name="adblock-custom-hosts">'.htmlspecialchars($adblock_custom, ENT_QUOTES).'</textarea>';
?>
<?php echo '<textarea class="logoutput" name="adblock-custom-hosts">'.htmlspecialchars($adblock_custom_content, ENT_QUOTES).'</textarea>'; ?>
</div>
</div>
</div><!-- /.tab-pane -->

View File

@@ -3,22 +3,7 @@
<h4 class="mt-3"><?php echo _("Logging"); ?></h4>
<div class="row">
<div class="form-group col-md-8">
<?php
$log = '';
exec('sudo chmod o+r /tmp/dnsmasq.log');
$handle = fopen("/tmp/dnsmasq.log", "r");
if ($handle) {
while (($line = fgets($handle)) !== false) {
if (preg_match('/(0.0.0.0)/', $line)){
$log.=$line;
}
}
} else {
$log = "Unable to open log file";
}
fclose($handle);
echo '<textarea class="logoutput">'.htmlspecialchars($log, ENT_QUOTES).'</textarea>';
?>
<?php echo '<textarea class="logoutput">'.htmlspecialchars($adblock_log, ENT_QUOTES).'</textarea>'; ?>
</div>
</div>
</div><!-- /.tab-pane -->