Skip to content

Commit

Permalink
Merge pull request #332 from pi-hole/devel
Browse files Browse the repository at this point in the history
[RELEASE] Pi-hole Web Admin 2.3.1
  • Loading branch information
dschaper committed Jan 4, 2017
2 parents f76317b + 2314970 commit 7be7956
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
4 changes: 2 additions & 2 deletions scripts/pi-hole/js/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function piholeChange(action, duration)
case "enable":
btnStatus = $("#flip-status-enable");
btnStatus.html("<i class='fa fa-spinner'> </i>");
$.getJSON("api.php?enable&token=" + token, (data) => {
$.getJSON("api.php?enable&token=" + token, function(data) {
if(data.status === "enabled") {
btnStatus.html("");
piholeChanged("enabled");
Expand All @@ -51,7 +51,7 @@ function piholeChange(action, duration)
case "disable":
btnStatus = $("#flip-status-disable");
btnStatus.html("<i class='fa fa-spinner'> </i>");
$.getJSON("api.php?disable=" + duration + "&token=" + token, (data) => {
$.getJSON("api.php?disable=" + duration + "&token=" + token, function(data) {
if(data.status === "disabled") {
btnStatus.html("");
piholeChanged("disabled");
Expand Down
4 changes: 2 additions & 2 deletions scripts/pi-hole/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ $(document).ready(function() {
enabled: true,
mode: "x-axis",
callbacks: {
title(tooltipItem, data) {
title: function(tooltipItem, data) {
var label = tooltipItem[0].xLabel;
var time = label.match(/(\d?\d):?(\d?\d?)/);
var h = parseInt(time[1], 10);
Expand All @@ -300,7 +300,7 @@ $(document).ready(function() {
var to = padNumber(h)+":"+padNumber(m+9)+":59";
return "Queries from "+from+" to "+to;
},
label(tooltipItems, data) {
label: function(tooltipItems, data) {
if(tooltipItems.datasetIndex === 1)
{
var percentage = 0.0;
Expand Down
20 changes: 10 additions & 10 deletions scripts/pi-hole/php/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="img/logo.svg" class="img-responsive" alt="Pi-hole logo" />
<img src="img/logo.svg" class="img-responsive" alt="Pi-hole logo" style="display: table; table-layout: fixed; height: 67px;" />
</div>
<div class="pull-left info">
<p>Status</p>
Expand Down Expand Up @@ -293,33 +293,33 @@
?>
<br/>
<?php
echo '<a href="#"><i class="fa fa-circle" style="color:';
echo "<a href=\"#\"><i class=\"fa fa-circle\" style=\"color:";
if ($loaddata[0] > $nproc) {
echo '#FF0000';
echo "#FF0000";
}
else
{
echo '#7FFF00';
echo "#7FFF00";
}
echo '""></i> Load:&nbsp;&nbsp;' . $loaddata[0] . '&nbsp;&nbsp;' . $loaddata[1] . '&nbsp;&nbsp;'. $loaddata[2] . '</a>';
echo "\"></i> Load:&nbsp;&nbsp;" . $loaddata[0] . "&nbsp;&nbsp;" . $loaddata[1] . "&nbsp;&nbsp;". $loaddata[2] . "</a>";
?>
<br/>
<?php
echo '<a href="#"><i class="fa fa-circle" style="color:';
echo "<a href=\"#\"><i class=\"fa fa-circle\" style=\"color:";
if ($memory_usage > 0.75 || $memory_usage < 0.0) {
echo '#FF0000';
echo "#FF0000";
}
else
{
echo '#7FFF00';
echo "#7FFF00";
}
if($memory_usage > 0.0)
{
echo '""></i> Memory usage:&nbsp;&nbsp;' . sprintf("%.1f",100.0*$memory_usage) . '%</a>';
echo "\"></i> Memory usage:&nbsp;&nbsp;" . sprintf("%.1f",100.0*$memory_usage) . "%</a>";
}
else
{
echo '""></i> Memory usage:&nbsp;&nbsp; N/A</a>';
echo "\"></i> Memory usage:&nbsp;&nbsp; N/A</a>";
}
?>
</div>
Expand Down
15 changes: 13 additions & 2 deletions scripts/pi-hole/php/savesettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,21 @@ function validDomain($domain_name)
$error .= "Lease time ".$leasetime." is invalid!<br>";
}

if(isset($_POST["useIPv6"]))
{
$ipv6 = "true";
$type = "(IPv4 + IPv6)";
}
else
{
$ipv6 = "false";
$type = "(IPv4)";
}

if(!strlen($error))
{
exec("sudo pihole -a enabledhcp ".$from." ".$to." ".$router." ".$leasetime." ".$domain);
$success .= "The DHCP server has been activated";
exec("sudo pihole -a enabledhcp ".$from." ".$to." ".$router." ".$leasetime." ".$domain." ".$ipv6);
$success .= "The DHCP server has been activated ".$type;
}
}
else
Expand Down
26 changes: 26 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,17 @@
</div>
<?php
// Pi-Hole DHCP server

// Detect IPv6
$usingipv6 = false;
if(strlen($piHoleIPv6) > 0 && $piHoleIPv6 != "unknown")
{
if(substr($piHoleIPv6, 0, 4) != "fe80")
{
$usingipv6 = true;
}
}

if(isset($setupVars["DHCP_ACTIVE"]))
{
if($setupVars["DHCP_ACTIVE"] == 1)
Expand Down Expand Up @@ -132,6 +143,15 @@
{
$DHCPleasetime = 24;
}
if(isset($setupVars["DHCP_IPv6"]))
{
$DHCPIPv6 = $setupVars["DHCP_IPv6"];
}
else
{
$DHCPIPv6 = $usingipv6;
}

}
else
{
Expand All @@ -149,6 +169,7 @@
$DHCProuter = "";
}
$DHCPleasetime = 24;
$DHCPIPv6 = $usingipv6;
}
if(isset($setupVars["PIHOLE_DOMAIN"])){
$piHoleDomain = $setupVars["PIHOLE_DOMAIN"];
Expand Down Expand Up @@ -205,6 +226,11 @@
<div class="box-tools pull-right"><button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i></button></div>
</div>
<div class="box-body">
<div class="col-md-12">
<div class="form-group">
<div class="checkbox"><label><input type="checkbox" name="useIPv6" <?php if($DHCPIPv6){ ?>checked<?php } ?> class="DHCPgroup" <?php if(!$DHCP){ ?>disabled<?php } ?>> Enable IPv6 support (SLAAC + RA)</label></div>
</div>
</div>
<div class="col-md-12">
<label>Pi-Hole domain name</label>
<div class="form-group">
Expand Down

0 comments on commit 7be7956

Please sign in to comment.