Moved Pi-Hole domain name setting to DHCP Server tab as it is a DHCP server setting...

This commit is contained in:
DL6ER
2016-12-14 14:40:37 +01:00
parent aeee6c33d5
commit 67df29c794
2 changed files with 22 additions and 32 deletions
+9 -15
View File
@@ -251,9 +251,18 @@ function validDomain($domain_name)
$error .= "Router IP (".$router.") is invalid!<br>";
}
$domain = $_POST["domain"];
// Validate Domain name
if(!validDomain($domain))
{
$error .= "Domain name ".$domain." is invalid!<br>";
}
if(!strlen($error))
{
exec("sudo pihole -a enabledhcp ".$from." ".$to." ".$router);
exec("sudo pihole -a domainname ".$domain);
$success .= "The DHCP server has been activated";
}
}
@@ -265,21 +274,6 @@ function validDomain($domain_name)
break;
// Set DNS server domain name
case "domainname":
$domain = $_POST["domain"];
if(!validDomain($domain))
{
$error .= "Domain name ".$domain." is invalid!<br>The domain name has been reset to its previous value";
}
else
{
exec("sudo pihole -a domainname ".$domain);
}
break;
default:
// Option not found
$debug = true;
+13 -17
View File
@@ -48,11 +48,6 @@
} else {
$piHoleIPv6 = "unknown";
}
if(isset($setupVars["PIHOLE_DOMAIN"])){
$piHoleDomain = $setupVars["PIHOLE_DOMAIN"];
} else {
$piHoleDomain = "local";
}
$hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F");
?>
<div class="box box-warning">
@@ -88,18 +83,6 @@
<input type="text" class="form-control" disabled value="<?php echo $hostname; ?>">
</div>
</div>
<div class="form-group">
<label>Pi-Hole domain name</label>
<form role="form" method="post">
<div class="input-group">
<input type="hidden" name="field" value="domainname">
<input type="text" class="form-control" name="domain" value="<?php echo $piHoleDomain; ?>">
<div class="input-group-btn">
<button type="submit" class="btn btn-primary">Save</button>
</div>
</div>
</form>
</div>
</div>
</div>
<?php
@@ -128,6 +111,11 @@
$DHCPend = $DHCPdomain[0].".".$DHCPdomain[1].".".$DHCPdomain[2].".251";
$DHCProuter = $DHCPdomain[0].".".$DHCPdomain[1].".".$DHCPdomain[2].".1";
}
if(isset($setupVars["PIHOLE_DOMAIN"])){
$piHoleDomain = $setupVars["PIHOLE_DOMAIN"];
} else {
$piHoleDomain = "local";
}
?>
<div class="box box-warning">
<div class="box-header with-border">
@@ -159,6 +147,14 @@
<input type="text" class="form-control DHCPgroup" name="router" value="<?php echo $DHCProuter; ?>" data-inputmask="'alias': 'ip'" data-mask <?php if(!$DHCP){ ?>disabled<?php } ?>>
</div>
</div><br/>
<label>Pi-Hole domain name</label>
<div class="col-md-12">
<div class="input-group">
<div class="input-group-addon">Domain</div>
<input type="text" class="form-control DHCPgroup" name="domain" value="<?php echo $piHoleDomain; ?>" <?php if(!$DHCP){ ?>disabled<?php } ?>>
</div>
</div>
<br/>
<?php if($DHCP) {
// Read leases file