"; //echo "\$category['$value'] = 'zzz';
\n"; //$x++; //} //unset($x); //echo "
";
	//print_r($_POST["blacklist"]);
	//echo "
"; //foreach($_POST["blacklist"] as $key => $value) { //echo "name: ".$value."
"; //$x++; //} if (count($_POST)>0) { conf_mount_rw(); $dnsmasqfile = "/usr/local/etc/dnsmasq.conf"; $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 foreach($category as $key => $value) { $config['installedpackages']['dnsblacklist']['config'][0][$key] = ''; } if ($_POST['enable'] == 1) { //echo "enabled"; $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; } else { //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); if(stristr($getdnsmasq,'conf-file=/usr/local/etc/dnsmasq.blacklist.conf') === TRUE) { //include found no need to add it } else { $myfhandle = fopen($dnsmasqconf, 'r+'); fwrite($myfhandle, $includestring); fclose($myfhandle); } } else { $my2fhandle = fopen($dnsmasqconf, 'x+'); 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) { //set the current selected values $blackfile = "blacklists/$value/domains"; $config['installedpackages']['dnsblacklist']['config'][0][$value] = 1; //if enabled write the selected categories to the dnsmasq.blacklist.conf if ($config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] == 1) { $fh2 = fopen($targetfile, 'a'); $fh = fopen($blackfile,'r'); while($line=fgets($fh)) { //remove all characters other than alpha numeric period and dash preg_match("/([a-zA-Z0-9.-]*)/i", $line, $arraymatches); $line = $arraymatches[1]; fwrite($fh2, "address=/" .$line. "/74.125.45.100". "\n"); } fclose($fh); fclose($fh2); } } } write_config(); services_dnsmasq_configure(); sleep(1); $savemsg_dnsb = "DNS Blacklist settings have been saved. "; conf_mount_ro(); } ?>

Services: DNS Blacklist

\n"; } else { echo "\n"; } ?> Enable DNS Blacklist

\n"; if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { echo "\n"; echo "\n"; echo "\n"; echo "\n"; } else { echo "\n"; echo "\n"; echo "\n"; echo "\n"; } echo "\n"; $x++; } echo "
Below is a scroll-box filled with categories you can select to be added to your blacklist.

Each category has a list of known domains/sites that will be denied access by users of this network.

(Note: Using all categories at once will require 300Mb of free memory. The adult category is rather memory intensive, requiring 200Mb.)


\n"; foreach($category as $key => $value) { $domain_count = line_number("blacklists/$key/domains"); echo "
".$value['name_en']."".$value['desc_en']."($domain_count domains)".$value['name_en']."".$value['desc_en']."($domain_count domains)
\n"; ?>

"Edit Category", ); ////$tmp_category = str_replace(" ", " ", $category); //echo "\n"; ?>