From 3c90519e3bcf30fe514754a8702de5aadc5df94d Mon Sep 17 00:00:00 2001 From: mcrane Date: Mon, 5 Oct 2009 17:39:11 -0600 Subject: DNS Blacklist enable ability to deselect every category --- config/dnsblacklist/dnsblacklist.tmp | 26 +++++++++++++++++++------- config/dnsblacklist/dnsblacklist.xml | 2 +- 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'config') diff --git a/config/dnsblacklist/dnsblacklist.tmp b/config/dnsblacklist/dnsblacklist.tmp index a6d67bb1..a00bdb82 100644 --- a/config/dnsblacklist/dnsblacklist.tmp +++ b/config/dnsblacklist/dnsblacklist.tmp @@ -61,10 +61,21 @@ if (count($_POST)>0) { $targetfile = "/usr/local/etc/dnsmasq.blacklist.conf"; $includestring = "conf-file=/usr/local/etc/dnsmasq.blacklist.conf"; $dnsmasqconf = "/usr/local/etc/dnsmasq.conf"; + //clear previous values + $ent = array(); foreach($category as $key => $value) { - $config['installedpackages']['dnsblacklist']['config'][0][$key] = ''; + $ent[$key] = '0'; + } + $config['installedpackages']['dnsblacklist']['config'][0] = $ent; + //write_config(); + + //truncate the dnsmasq.blacklist.conf file + if (file_exists($targetfile)) { + $fh = fopen($targetfile, 'w'); + fclose($fh); } + if ($_POST['enable'] == 1) { //echo "enabled"; $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; @@ -73,6 +84,7 @@ if (count($_POST)>0) { //echo "disabled"; $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 0; } + //add the include entry for dnsmasq.blacklist.conf to dnsmasq.conf if (file_exists($dnsmasqfile)) { $getdnsmasq = file_get_contents($dnsmasqfile); @@ -90,11 +102,7 @@ if (count($_POST)>0) { fwrite($my2fhandle, $includestring); fclose($my2fhandle); } - //truncate the dnsmasq.blacklist.conf file - if (file_exists($targetfile)) { - $fh = fopen($targetfile, 'w'); - fclose($fh); - } + //build the dnsmasq.blacklist.conf if (count($_POST["blacklist"]) > 0) { foreach($_POST["blacklist"] as $value) { @@ -116,6 +124,7 @@ if (count($_POST)>0) { } } } + write_config(); services_dnsmasq_configure(); sleep(1); @@ -192,7 +201,10 @@ Select a category to edit:

--> - +"; +?> diff --git a/config/dnsblacklist/dnsblacklist.xml b/config/dnsblacklist/dnsblacklist.xml index 3e8c1667..2f3e2996 100644 --- a/config/dnsblacklist/dnsblacklist.xml +++ b/config/dnsblacklist/dnsblacklist.xml @@ -41,7 +41,7 @@ Describe your package requirements here Currently there are no FAQ items provided. DNS Blacklist Settings - 0.2.3 + 0.2.4 Settings /usr/local/pkg/dnsblacklist.inc -- cgit v1.2.3