"; //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) { $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)) { fwrite($fh2, "address=/" .trim($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."; } ?>

Services: DNS Blacklist

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

\n"; if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { // echo "\n"; } else { // 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 and porn categories are rather memory intensive, requiring 200Mb together.)


function ListFiles($dir) { if($dh = opendir($dir)) { $files = Array(); $inner_files = Array(); while($file = readdir($dh)) { if($file != "." && $file != ".." && $file[0] != '.') { if(is_dir($dir . "/" . $file)) { array_push($files, $dir); //$inner_files = ListFiles($dir . "/" . $file); //if(is_array($inner_files)) $files = array_merge($files, $inner_files); } else { //array_push($files, $dir . "/" . $file); } } } closedir($dh); return $files; } } foreach (ListFiles('/usr/local/www/packages/dnsblacklist/') as $key=>$file){ echo $file ."
\n"; }
\n"; foreach($category as $key => $value) { $domain_count = line_number("blacklists/$key/domains"); //echo "name: ".$key."
"; echo "
$key$value($domain_count domains)$key$value($domain_count domains)
\n"; */ ?>

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