diff --git a/scripts/pi-hole/js/settings.js b/scripts/pi-hole/js/settings.js index 73c1dfab..4eee5c20 100644 --- a/scripts/pi-hole/js/settings.js +++ b/scripts/pi-hole/js/settings.js @@ -84,6 +84,23 @@ $(".confirm-flushlogs").confirm({ dialogClass: "modal-dialog modal-mg" }); +$(".confirm-disablelogging").confirm({ + text: "Note that disabling query logging will render graphs on the web user interface useless. Are you sure you want to disable your logging?", + title: "Confirmation required", + confirm(button) { + $("#disablelogsform").submit(); + }, + cancel(button) { + // nothing to do + }, + confirmButton: "Yes, disable logs", + cancelButton: "No, go back", + post: true, + confirmButtonClass: "btn-danger", + cancelButtonClass: "btn-success", + dialogClass: "modal-dialog modal-mg" +}); + $(".api-token").confirm({ text: "Make sure that nobody else can scan this code around you. They will have full access to the API without having to know the password. Note that the generation of the QR code will take some time.", title: "Confirmation required", @@ -118,9 +135,6 @@ $(document).ready(function() { "scrollY": "200px", "scrollX" : true }); - $("#leaseexpand").on( "click", function () { - setTimeout(function(){leasetable.draw();},100); - } ); } if(document.getElementById("DHCPStaticLeasesTable")) { @@ -132,10 +146,13 @@ $(document).ready(function() { "scrollY": "200px", "scrollX" : true }); - $("#leaseexpand").on( "click", function () { - setTimeout(function(){staticleasetable.draw();},100); - } ); } + //call draw() on each table... they don't render properly with scrollX and scrollY set... ¯\_(ツ)_/¯ + $("a[data-toggle=\"tab\"]").on("shown.bs.tab", function (e) { + leasetable.draw(); + staticleasetable.draw(); + }); + } ); // Handle hiding of alerts @@ -152,12 +169,47 @@ $(document).ready(function(){ // Handle list deletion $("button[id^='adlist-btn-']").on("click", function (e) { + var id = parseInt($(this).context.id.replace(/[^0-9\.]/g, ""), 10); e.preventDefault(); - var status = $(this).siblings("input[name^='adlist-del-']").is(":checked"); + var status = $("input[name=\"adlist-del-"+id+"\"]").is(":checked"); var textType = status ? "none" : "line-through"; - $(this).siblings("input[name^='adlist-del-']").prop("checked", !status); - $(this).siblings("input[name^='adlist-enable-']").prop("disabled", !status); - $(this).siblings("a").css("text-decoration", textType); + // Check hidden delete box (or reset) + $("input[name=\"adlist-del-"+id+"\"]").prop("checked", !status); + // Untick and disable check box (or reset) + $("input[name=\"adlist-enable-"+id+"\"]").prop("checked", status).prop("disabled", !status); + // Strink through text (or reset) + $("a[id=\"adlist-text-"+id+"\"]").css("text-decoration", textType); + // Highlight that the button has to be clicked in order to make the change live + $("button[id=\"blockinglistsaveupdate\"]").addClass("btn-danger").css("font-weight", "bold"); + +}); + +// Javascript to go to specified tab on save or hyperlink +$(function () { + if(location.hash.length > 0) + { + var activeTab = $("[href=" + location.hash + "]"); + activeTab && activeTab.tab("show"); + } +}); +// Change hash for save and reload +$(".nav-tabs a").on("shown.bs.tab", function (e) { + window.location.hash = e.target.hash; + window.scrollTo(0, 0); +}); + +// Auto dismissal for info and error notifications +$(document).ready(function(){ + var alInfo = $("#alInfo"); + var alError = $("#alError"); + if(alInfo.length) + { + alInfo.delay(3000).fadeOut(2000, function() { alInfo.hide(); }); + } + if(alError.length) + { + alError.delay(3000).fadeOut(2000, function() { alError.hide(); }); + } }); diff --git a/settings.php b/settings.php index 2ef1de67..4450b873 100644 --- a/settings.php +++ b/settings.php @@ -5,940 +5,1218 @@ * * This file is copyright under the latest version of the EUPL. * Please see LICENSE file for your rights under this license. */ - require "scripts/pi-hole/php/header.php"; - require "scripts/pi-hole/php/savesettings.php"; - // Reread ini file as things might have been changed - $setupVars = parse_ini_file("/etc/pihole/setupVars.conf"); +require "scripts/pi-hole/php/header.php"; +require "scripts/pi-hole/php/savesettings.php"; +// Reread ini file as things might have been changed +$setupVars = parse_ini_file("/etc/pihole/setupVars.conf"); -function command_exist($cmd) { - return !empty(shell_exec(sprintf("which %s", escapeshellarg($cmd)))); +function command_exist($cmd) +{ + return !empty(shell_exec(sprintf("which %s", escapeshellarg($cmd)))); } + ?> refresh to the gravity page and start updating immediately -?> - - +if (isset($_POST["submit"])) { + if ($_POST["submit"] == "saveupdate") { + // If that is the case -> refresh to the gravity page and start updating immediately + ?> + + - - + + - 0){ ?> - + 0) { ?> + - 0){ ?> - + 0) { ?> + -
-
+ -
-
-

Networking

-
-
-
- -
-
- -
-
-
- -
-
- -
-
-
- -
-
- -
-

Warning: PHP has been compiled without IPv6 support.

-
-
- -
-
- -
-
-
-
+ -
-
-

Pi-hole DHCP Server

-
-
-
-
-
-
-
-
-
-

hidden>Make sure your router's DHCP server is disabled when using the Pi-hole DHCP server!

-
-
- -
-
-
-
-
From
- disabled> -
-
-
-
-
-
-
To
- disabled> -
-
-
-
- -
-
-
Router
- disabled> -
-
-
-
-
-
-

Advanced DHCP settings

-
-
-
-
-
-
-
-
-
- -
-
-
Domain
- disabled> -
-
-
-
- -
-
-
Lease time in hours
- disabled> -
-
-

Hint: 0 = infinite, 24 = one day, 168 = one week, 744 = one month, 8760 = one year

-
-
-
-
-unknown"; - } - - $clid = $line[4]; - if($clid == "*") - { - $clid = "unknown"; - } - - array_push($dhcp_leases,["TIME"=>$time, "hwaddr"=>strtoupper($line[1]), "IP"=>$line[2], "host"=>$host, "clid"=>$clid, "type"=>$type]); - } - } +$i = 1; +while (isset($setupVars["PIHOLE_DNS_" . $i])) { + if (isinserverlist($setupVars["PIHOLE_DNS_" . $i])) { + array_push($DNSactive, $setupVars["PIHOLE_DNS_" . $i]); + } elseif (strpos($setupVars["PIHOLE_DNS_" . $i], ".")) { + if (!isset($custom1)) { + $custom1 = $setupVars["PIHOLE_DNS_" . $i]; + } else { + $custom2 = $setupVars["PIHOLE_DNS_" . $i]; + } + } elseif (strpos($setupVars["PIHOLE_DNS_" . $i], ":")) { + if (!isset($custom3)) { + $custom3 = $setupVars["PIHOLE_DNS_" . $i]; + } else { + $custom4 = $setupVars["PIHOLE_DNS_" . $i]; + } + } + $i++; } -readStaticLeasesFile(); +if (isset($setupVars["DNS_FQDN_REQUIRED"])) { + if ($setupVars["DNS_FQDN_REQUIRED"]) { + $DNSrequiresFQDN = true; + } else { + $DNSrequiresFQDN = false; + } +} else { + $DNSrequiresFQDN = true; +} + +if (isset($setupVars["DNS_BOGUS_PRIV"])) { + if ($setupVars["DNS_BOGUS_PRIV"]) { + $DNSbogusPriv = true; + } else { + $DNSbogusPriv = false; + } +} else { + $DNSbogusPriv = true; +} + +if (isset($setupVars["DNSSEC"])) { + if ($setupVars["DNSSEC"]) { + $DNSSEC = true; + } else { + $DNSSEC = false; + } +} else { + $DNSSEC = false; +} + +if (isset($setupVars["DNSMASQ_LISTENING"])) { + if ($setupVars["DNSMASQ_LISTENING"] === "single") { + $DNSinterface = "single"; + } elseif ($setupVars["DNSMASQ_LISTENING"] === "all") { + $DNSinterface = "all"; + } else { + $DNSinterface = "local"; + } +} else { + $DNSinterface = "single"; +} ?> -
-
collapsed-box"> -
-

DHCP leases

-
-
-
-
- - - - - - - - - - - -
Remaining lease time:
DHCP UID: "> - -
MAC addressIP addressHostname

-
-
- - - - - - - - - - - - - - - - -
MAC addressIP addressHostname
0){ ?>
-

Specifying the MAC address is mandatory and only one entry per MAC address is allowed. If the IP address is omitted and a host name is given, the IP address will still be generated dynamically and the specified host name will be used. If the host name is omitted, only a static lease will be added.

-
-
-
-
-
- - -
-
-
-

Upstream DNS Servers

-
-
-
-
- - - - - - - - $value) { ?> - - - - - - - - - - - - -
IPv4IPv6Name
">" value="true" checked >">" value="true" checked >">" value="true" checked disabled >">" value="true" checked disabled >
-
-
- -
- -
-
checked>
- value=""> -
- -
-
checked>
- value=""> -
- -
-
checked>
- value=""> -
- -
-
checked>
- value=""> -
-
-
-
-
-
-

Advanced DNS settings

-
-
-
-
-
-
-
-
-
-
-

Note that enabling these two options may increase your privacy slightly, but may also prevent you from being able to access local hostnames if the Pi-hole is not used as DHCP server

-
-
-
-

Validate DNS replies and cache DNSSEC data. When forwarding DNS queries, Pi-hole requests the DNSSEC records needed to validate the replies. Use Google or Norton DNS servers when activating DNSSEC. Note that the size of your log might increase significantly when enabling DNSSEC. A DNSSEC resolver test can be found here.

-
- -
- -
-
- -
-
- -
-
- -
-
-
-
-
- - -
-
-
-
-
-

Query Logging (size of log )

-
-
-

Current status: - - Enabled (recommended) - - Disabled -

- -

Note that disabling will render graphs on the web user interface useless

- -
- -
- -
-
-

Pi-Hole's Block Lists

-
-
-
-
-
- - $value) { ?> -
-
- + +
+
+ +
+