Be less specific, as this feature can be used for any time of local resolver running on a custom port

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2018-04-18 17:31:16 +02:00
parent f2cefe6ce1
commit 7fa6cd85d3
2 changed files with 22 additions and 23 deletions
+12 -13
View File
@@ -200,32 +200,31 @@ function readAdlists()
}
$DNSservercount = count($DNSservers);
// Check if at least one DNS server has been added
if(isset($_POST["localrecursive"]))
if(isset($_POST["localDNS"]))
{
if(isset($_POST["localrecursiveport"]) &&
is_numeric($_POST["localrecursiveport"]))
if(isset($_POST["localDNSport"]) &&
is_numeric($_POST["localDNSport"]))
{
// Save port and modify dnsmasq.d config file
exec("sudo pihole -a localrecursivedns ".intval($_POST["localrecursiveport"]));
exec("sudo pihole -a localdnsport ".intval($_POST["localDNSport"]));
$DNSservercount++;
}
else if(isset($localrecursive))
else if(isset($localdns))
{
// Remove entry without valid port
exec("sudo pihole -a localrecursivedns 0");
exec("sudo pihole -a localdnsport 0");
}
}
else
{
// Remove possible entry if unticked
exec("sudo pihole -a localrecursivedns 0");
// Check if at least one DNS server has been added
if($DNSservercount < 1)
{
$error .= "No DNS server has been selected.<br>";
}
exec("sudo pihole -a localdnsport 0");
}
// Check if at least one DNS server has been added
if($DNSservercount < 1)
{
$error .= "No DNS server has been selected.<br>";
}
// Check if domain-needed is requested
+10 -10
View File
@@ -206,14 +206,14 @@ if (isset($setupVars["QUERY_LOGGING"])) {
$piHoleLogging = true;
}
if (isset($setupVars["LOCAL_RECURSIVE"])) {
if($setupVars["LOCAL_RECURSIVE"]) {
$localrecursive = $setupVars["LOCAL_RECURSIVE"];
if (isset($setupVars["LOCAL_DNS_PORT"])) {
if($setupVars["LOCAL_DNS_PORT"]) {
$localDNS = $setupVars["LOCAL_DNS_PORT"];
} else {
$localrecursive = false;
$localDNS = false;
}
} else {
$localrecursive = false;
$localDNS = false;
}
?>
@@ -754,15 +754,15 @@ if (isset($_GET['tab']) && in_array($_GET['tab'], array("sysadmin", "blocklists"
data-inputmask="'alias': 'ipv6'" data-mask
<?php if (isset($custom4)){ ?>value="<?php echo $custom4; ?>"<?php } ?>>
</div>
<label>Local recursive server (see <a href="https://github.com/pi-hole/pi-hole/wiki/Pi-hole-as-recursive-DNS-server">here</a>)</label>
<label>Local DNS server on custom port</label>
<div class="input-group">
<div class="input-group-addon">
<input type="checkbox" name="localrecursive" value="yes"
<?php if ($localrecursive){ ?>checked<?php } ?>>
<input type="checkbox" name="localDNS" value="yes"
<?php if ($localDNS){ ?>checked<?php } ?>>
</div>
<input type="text" placeholder="127.0.0.1" class="form-control" disabled style="background: white; width: 25%;">
<input type="text" name="localrecursiveport" class="form-control" placeholder="port" style="width: 75%"
<?php if ($localrecursive){ ?>value="<?php echo $localrecursive; ?>"<?php } ?>>
<input type="text" name="localDNSport" class="form-control" placeholder="port" style="width: 75%"
<?php if ($localDNS){ ?>value="<?php echo $localDNS; ?>"<?php } ?>>
</div>
</div>
</div>