"; print $return; } if ($_REQUEST['cb']== 1){# and $_SERVER['REMOTE_ADDR']== '127.0.0.1'){ get_networks(1); } if ($_REQUEST['cbw']== 1){# and $_SERVER['REMOTE_ADDR']== '127.0.0.1'){ get_networks(2); } function countryblock_get_countries(){ $files= array ( "Africa" => "/usr/loca/pkg/Africa_cidr.txt", "Antartica" => "/usr/loca/pkg/Antartica_cidr.txt", "Asia" => "/usr/loca/pkg/Asia_cidr.txt", "Europe" => "/usr/loca/pkg/Europe_cidr.txt", "North America" => "/usr/loca/pkg/North_America_cidr.txt", "Oceania" => "/usr/loca/pkg/Oceania_cidr.txt", "South America"=>"/usr/loca/pkg/South_America_cidr.txt"); $cdir='/usr/local/pkg/countryblock'; if (! is_dir($cdir)) mkdir ($cdir,0755); foreach ($files as $cont => $file){ $ips=file_get_contents($file); $convert = explode("\n", $ips); print $cont."\n"; $active= array("$cont" => ''); $options=""; $total=1; foreach ($convert as $line){ if (preg_match('/#(.*):\s+(.*)$/',$line,$matches)){ if ($ISOCode <> "" && $ISOCode <> $matches[2] && preg_match("/ISO Code/",$line)){ file_put_contents($cdir.'/'.$ISOCode.'.txt',${$ISOCode},LOCK_EX); $total++; } ${preg_replace("/\s/","",$matches[1])}=$matches[2]; } else{ if (${$ISOCode}==0){ ${$ISOCode}++; $options.= ''."\n"; } ${$ISOCode}.=$line."\n"; } } $cont_name= preg_replace("/ /","",$cont); #file_put_contents($cdir.'/'.$cont_name.'.txt',$ips,LOCK_EX); $xml= << Describe your package here Describe your package requirements here Currently there are no FAQ items provided. countryblock_{$cont_name} 1.0 Firewall: Countryblock /usr/local/pkg/countryblock.inc Countryblock Configure Countryblock
Firewall
pkg_edit.php?xml=countryblock.xml&id=0
countryblock General /pkg_edit.php?xml=countryblock.xml&id=0 Africa /pkg_edit.php?xml=countryblock_Africa.xml&id=0 {$active['Africa']} Antartica /pkg_edit.php?xml=countryblock_Antartica.xml&id=0 {$active['Antartica']} Asia /pkg_edit.php?xml=countryblock_Asia.xml&id=0 {$active['Asia']} Europe /pkg_edit.php?xml=countryblock_Europe.xml&id=0 {$active['Europe']} North America /pkg_edit.php?xml=countryblock_NorthAmerica.xml&id=0 {$active['North America']} Oceania /pkg_edit.php?xml=countryblock_Oceania.xml&id=0 {$active['Oceania']} South America /pkg_edit.php?xml=countryblock_SouthAmerica.xml&id=0 {$active['South America']} XMLRPC Sync /pkg_edit.php?xml=countryblock_sync.xml&id=0 Continent {$cont} listtopic Countries countries select {$options} {$total} countryblock_php_install_command(); countryblock_php_deinstall_command(); countryblock_validate_input(\$_POST, &\$input_errors); sync_package_countryblock();
EOF; file_put_contents('/usr/local/pkg/countryblock_'.$cont_name.'.xml',$xml,LOCK_EX); #var_dump($ips); } } ?>