From ae9a2ad6167aa341a34f8a80aa9fc81a11783ce9 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 10:57:39 +0100 Subject: [PATCH 1/9] Fix responsive icon on Gecko engine (Firefox + derivatives) --- scripts/pi-hole/php/header.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/header.php b/scripts/pi-hole/php/header.php index b5c1b66b..35d6269c 100644 --- a/scripts/pi-hole/php/header.php +++ b/scripts/pi-hole/php/header.php @@ -249,7 +249,7 @@
- Pi-hole logo + Pi-hole logo

Status

From 9221d8a5e74c8c39bae44b15e8f969e7103ed3d0 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 13:44:24 +0100 Subject: [PATCH 2/9] Avoid double " --- scripts/pi-hole/php/header.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/pi-hole/php/header.php b/scripts/pi-hole/php/header.php index b5c1b66b..cc2c8714 100644 --- a/scripts/pi-hole/php/header.php +++ b/scripts/pi-hole/php/header.php @@ -293,33 +293,33 @@ ?>
$nproc) { - echo '#FF0000'; + echo "#FF0000"; } else { - echo '#7FFF00'; + echo "#7FFF00"; } - echo '""> Load:  ' . $loaddata[0] . '  ' . $loaddata[1] . '  '. $loaddata[2] . ''; + echo "\"> Load:  " . $loaddata[0] . "  " . $loaddata[1] . "  ". $loaddata[2] . ""; ?>
0.75 || $memory_usage < 0.0) { - echo '#FF0000'; + echo "#FF0000"; } else { - echo '#7FFF00'; + echo "#7FFF00"; } if($memory_usage > 0.0) { - echo '""> Memory usage:  ' . sprintf("%.1f",100.0*$memory_usage) . '%'; + echo "\"> Memory usage:  " . sprintf("%.1f",100.0*$memory_usage) . "%"; } else { - echo '""> Memory usage:   N/A'; + echo "\"> Memory usage:   N/A"; } ?>
From 5d0da1a8eb30b6bc39c9e93ebbc61a50bdbe82ef Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 13:48:02 +0100 Subject: [PATCH 3/9] Fix JS inconsistency that is tolerated by FF and Chrome but not IE --- scripts/pi-hole/js/footer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/footer.js b/scripts/pi-hole/js/footer.js index e59beed3..ce640155 100644 --- a/scripts/pi-hole/js/footer.js +++ b/scripts/pi-hole/js/footer.js @@ -40,7 +40,7 @@ function piholeChange(action, duration) case "enable": btnStatus = $("#flip-status-enable"); btnStatus.html(" "); - $.getJSON("api.php?enable&token=" + token, (data) => { + $.getJSON("api.php?enable&token=" + token, function(data) { if(data.status === "enabled") { btnStatus.html(""); piholeChanged("enabled"); @@ -51,7 +51,7 @@ function piholeChange(action, duration) case "disable": btnStatus = $("#flip-status-disable"); btnStatus.html(" "); - $.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"); From 645aab6571b4aca82fd6fd7d24d78f8eb40a05c2 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 14:07:16 +0100 Subject: [PATCH 4/9] Add option to disable IPv6 part of the DHCP server --- scripts/pi-hole/php/savesettings.php | 11 ++++++++++- settings.php | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index e65a7a61..ddda5138 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -355,9 +355,18 @@ function validDomain($domain_name) $error .= "Lease time ".$leasetime." is invalid!
"; } + if(isset($_POST["useIPv6"])) + { + $ipv6 = "useIPv6"; + } + else + { + $ipv6 = "noIPv6"; + } + if(!strlen($error)) { - exec("sudo pihole -a enabledhcp ".$from." ".$to." ".$router." ".$leasetime." ".$domain); + exec("sudo pihole -a enabledhcp ".$from." ".$to." ".$router." ".$leasetime." ".$domain." ".$ipv6); $success .= "The DHCP server has been activated"; } } diff --git a/settings.php b/settings.php index 175af9f1..9fd34070 100644 --- a/settings.php +++ b/settings.php @@ -132,6 +132,15 @@ { $DHCPleasetime = 24; } + if(isset($setupVars["DHCP_IPV6"])) + { + $DHCPIPv6 = $setupVars["DHCP_IPV6"]; + } + else + { + $DHCPIPv6 = true; + } + } else { @@ -149,6 +158,7 @@ $DHCProuter = ""; } $DHCPleasetime = 24; + $DHCPIPv6 = true; } if(isset($setupVars["PIHOLE_DOMAIN"])){ $piHoleDomain = $setupVars["PIHOLE_DOMAIN"]; @@ -205,6 +215,11 @@
+
+
+
+
+
From a04c89f12f710bc704904e3d67c15df0b15d92bf Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 14:25:38 +0100 Subject: [PATCH 5/9] Pass true/false to backend --- scripts/pi-hole/php/savesettings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index ddda5138..751ab12d 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -357,11 +357,11 @@ function validDomain($domain_name) if(isset($_POST["useIPv6"])) { - $ipv6 = "useIPv6"; + $ipv6 = "true"; } else { - $ipv6 = "noIPv6"; + $ipv6 = "false"; } if(!strlen($error)) From c6d98a88e4209619f7d30bbd6a90fa9061c61b0b Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 14:29:20 +0100 Subject: [PATCH 6/9] Tell if IPv6 has been enabled or not in success message --- scripts/pi-hole/php/savesettings.php | 4 +++- settings.php | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index 751ab12d..050165ec 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -358,16 +358,18 @@ function validDomain($domain_name) 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." ".$ipv6); - $success .= "The DHCP server has been activated"; + $success .= "The DHCP server has been activated ".$type; } } else diff --git a/settings.php b/settings.php index 9fd34070..7f5a9ef1 100644 --- a/settings.php +++ b/settings.php @@ -132,9 +132,9 @@ { $DHCPleasetime = 24; } - if(isset($setupVars["DHCP_IPV6"])) + if(isset($setupVars["DHCP_IPv6"])) { - $DHCPIPv6 = $setupVars["DHCP_IPV6"]; + $DHCPIPv6 = $setupVars["DHCP_IPv6"]; } else { From 810b994af25cf34bd799ddcb6b7fb6dc3e72f797 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 14:59:37 +0100 Subject: [PATCH 7/9] Fix IE support for main page (untested). Has been broken because codacy enforces Object Literal Shorthand Syntax --- scripts/pi-hole/js/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 3eec3bea..0edfc22b 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -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); @@ -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; From cd0c62665db62fa56eb5fed9f67045deb647349c Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 15:54:45 +0100 Subject: [PATCH 8/9] Minor change to kick codacy --- scripts/pi-hole/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 0edfc22b..5030af14 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -291,7 +291,7 @@ $(document).ready(function() { enabled: true, mode: "x-axis", callbacks: { - title: function(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); From c5f99af46c1ee905122cbafd7ffffbdf00415cc5 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 3 Jan 2017 18:04:20 +0100 Subject: [PATCH 9/9] Detect if IPv6 is used --- settings.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/settings.php b/settings.php index 7f5a9ef1..7983e107 100644 --- a/settings.php +++ b/settings.php @@ -104,6 +104,17 @@
0 && $piHoleIPv6 != "unknown") + { + if(substr($piHoleIPv6, 0, 4) != "fe80") + { + $usingipv6 = true; + } + } + if(isset($setupVars["DHCP_ACTIVE"])) { if($setupVars["DHCP_ACTIVE"] == 1) @@ -138,7 +149,7 @@ } else { - $DHCPIPv6 = true; + $DHCPIPv6 = $usingipv6; } } @@ -158,7 +169,7 @@ $DHCProuter = ""; } $DHCPleasetime = 24; - $DHCPIPv6 = true; + $DHCPIPv6 = $usingipv6; } if(isset($setupVars["PIHOLE_DOMAIN"])){ $piHoleDomain = $setupVars["PIHOLE_DOMAIN"];