From 1055ccf4a31cd081edbe7565738566878fb50318 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 4 Apr 2018 14:20:19 +0200 Subject: [PATCH] Add privacy level tab to Settings page Signed-off-by: DL6ER --- scripts/pi-hole/php/savesettings.php | 14 +++++- settings.php | 71 +++++++++++++++++++++++++++- 2 files changed, 82 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/php/savesettings.php b/scripts/pi-hole/php/savesettings.php index af8a90ec..aa8d0a84 100644 --- a/scripts/pi-hole/php/savesettings.php +++ b/scripts/pi-hole/php/savesettings.php @@ -256,7 +256,7 @@ function readAdlists() $extra .= " conditional_forwarding ".$_POST["conditionalForwardingIP"]." ".$_POST["conditionalForwardingDomain"]." $reverseAddress"; } } - + // Check if DNSinterface is set if(isset($_POST["DNSinterface"])) { @@ -635,7 +635,19 @@ function readAdlists() // Reread available adlists $adlist = readAdlists(); + break; + case "privacyLevel": + $level = intval($_POST["privacylevel"]); + if($level >= 0 && $level <= 3) + { + exec("sudo pihole -a privacylevel ".$level); + $success .= "The privacy level has been updated"; + } + else + { + $error .= "Invalid privacy level (".$level.")!"; + } break; default: diff --git a/settings.php b/settings.php index 129f5e76..34c40b68 100644 --- a/settings.php +++ b/settings.php @@ -9,6 +9,15 @@ 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"); +$piholeFTLConfFile = "/etc/pihole/pihole-FTL.conf"; +if(is_readable($piholeFTLConfFile)) +{ + $piholeFTLConf = parse_ini_file($piholeFTLConfFile); +} +else +{ + $piholeFTLConf = array(); +} ?>