0) { conf_mount_rw(); $ent = array(); if ($_POST['enable'] == 1) { //echo "enabled"; $config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] = 1; //Process list by downloading and extracting $myFile = "lists.txt"; $myWFile = "wlists.txt"; $fileContents = file_get_contents($myFile); $fileWContents = file_get_contents($myWFile); $lines = explode(PHP_EOL, $fileContents); $Wlines = explode(PHP_EOL, $fileWContents); //Remove DIR lists to eliminate duplates exec("/bin/rm -R lists"); exec("/bin/rm -R Wlists"); //Process each list URL, Extract, and put in DIR lists exec("/bin/mkdir lists"); exec("/bin/mkdir Wlists"); foreach ($lines as $line) { exec("/usr/bin/fetch -o lists $line"); $filename = basename($line); //Extract list exec("/usr/bin/gzip -d lists/$filename"); } foreach ($Wlines as $Wline) { exec("/usr/bin/fetch -o Wlists $Wline"); $Wfilename = basename($Wline); //Extract Whitelist exec("/usr/bin/gzip -d Wlists/$Wfilename"); } //Prep pfctl mwexec("/usr/bin/touch lists/ipfw.ipfw"); mwexec("/usr/bin/touch Wlists/whitelist"); //Now clear ipfw, and process each list to ipfw commands exec("/bin/sh convert-execute.sh"); } else { //echo "disabled"; $config['installedpackages']['ipblocklist_settings']['config'][0]['enable'] = 0; //Clear Lists mwexec("ipfw -f flush"); mwexec("pfctl -t ipblocklist -T kill"); mwexec("rm -R /usr/local/www/packages/ipblocklist/lists"); mwexec("sed -i -e '/ipblocklist/d' /tmp/rules.debug"); mwexec("pfctl -o basic -f /tmp/rules.debug"); //Clear errorOUT.txt mwexec("rm errorOUT.txt"); } write_config(); //services_dnsmasq_configure(); sleep(1); $savemsg_dnsb = "IP-Blocklist settings have been saved/updated. "; conf_mount_ro(); } ?>
=$pgtitle?>