Template updates for custom blocklists

This commit is contained in:
billz 2020-09-19 22:27:32 +01:00
parent 3644109cec
commit 656e5d83ad
2 changed files with 36 additions and 1 deletions

View file

@ -31,7 +31,8 @@
<?php echo CSRFTokenFieldTag() ?>
<!-- Nav tabs -->
<ul class="nav nav-tabs">
<li class="nav-item"><a class="nav-link active" id="clienttab" href="#adblocklistsettings" data-toggle="tab"><?php echo _("Blocklist settings"); ?></a></li>
<li class="nav-item"><a class="nav-link active" id="blocklisttab" href="#adblocklistsettings" data-toggle="tab"><?php echo _("Blocklist settings"); ?></a></li>
<li class="nav-item"><a class="nav-link" id="customtab" href="#adblockcustom" data-toggle="tab"><?php echo _("Custom blocklist"); ?></a></li>
<li class="nav-item"><a class="nav-link" id="logoutputtab" href="#adblocklogfileoutput" data-toggle="tab"><?php echo _("Logging"); ?></a></li>
</ul>
@ -39,6 +40,7 @@
<div class="tab-content">
<?php echo renderTemplate("adblock/general", $__template_data) ?>
<?php echo renderTemplate("adblock/stats", $__template_data) ?>
<?php echo renderTemplate("adblock/custom", $__template_data) ?>
<?php echo renderTemplate("adblock/logging", $__template_data) ?>
</div><!-- /.tab-content -->

View file

@ -0,0 +1,33 @@
<!-- logging tab -->
<div class="tab-pane fade" id="adblockcustom">
<h4 class="mt-3"><?php echo _("Custom blocklist"); ?></h4>
<div class="row">
<div class="col-md-6">
<div class="input-group">
<input type="hidden" name="adblock-custom-enable" value="0">
<div class="custom-control custom-switch">
<input class="custom-control-input" id="adblock-custom-enable" type="checkbox" name="adblock-custom-enable" value="1" <?php echo $custom_enabled ? ' checked="checked"' : "" ?> aria-describedby="adblock-description">
<label class="custom-control-label" for="adblock-custom-enable"><?php echo _("Enable custom blocklist") ?></label>
</div>
</div>
<p id="adblock-description">
<small><?php echo _("Define custom hosts to be blocked by entering an IPv4 or IPv6 address followed by any whitespace (spaces or tabs) and the host name.") ?></small>
<small><?php echo _("<b>IPv4 example:</b> 0.0.0.0 badhost.com") ?></small>
<div>
<small class="text-muted"><?php echo _("This option adds an <code>addn-hosts</code> directive to the dnsmasq configuration.") ?></small>
</div>
</p>
</div>
</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>';
?>
</div>
</div>
</div><!-- /.tab-pane -->