";
print $return;
}
# to be uncomented when this packages gets stable state
#if($_SERVER['REMOTE_ADDR']== '127.0.0.1'){
switch ($_REQUEST['pfb']){
case "in":
get_networks(1);
break;
case "out":
get_networks(2);
break;
case "white":
get_networks(3);
break;
}
#}
function pfblocker_get_countries(){
$files= array ( "Africa" => "/usr/local/pkg/Africa_cidr.txt",
"Asia" => "/usr/local/pkg/Asia_cidr.txt",
"Europe" => "/usr/local/pkg/Europe_cidr.txt",
"North America" => "/usr/local/pkg/North_America_cidr.txt",
"Oceania" => "/usr/local/pkg/Oceania_cidr.txt",
"South America"=>"/usr/local/pkg/South_America_cidr.txt");
$cdir='/usr/local/pkg/pfblocker';
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";
}
}
#save last country networks
file_put_contents($cdir.'/'.$ISOCode.'.txt',${$ISOCode},LOCK_EX);
$cont_name= preg_replace("/ /","",$cont);
$cont_name_lower= strtolower($cont_name);
#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.
pfblocker{$cont_name_lower}
1.0
Firewall: pfblocker
/usr/local/pkg/pfblocker.inc
General
/pkg_edit.php?xml=pfblocker.xml&id=0
Top Spammers
/pkg_edit.php?xml=pfblocker_topspammers.xml&id=0
{$active['top']}
Africa
/pkg_edit.php?xml=pfblocker_Africa.xml&id=0
{$active['Africa']}
Asia
/pkg_edit.php?xml=pfblocker_Asia.xml&id=0
{$active['Asia']}
Europe
/pkg_edit.php?xml=pfblocker_Europe.xml&id=0
{$active['Europe']}
North America
/pkg_edit.php?xml=pfblocker_NorthAmerica.xml&id=0
{$active['North America']}
Oceania
/pkg_edit.php?xml=pfblocker_Oceania.xml&id=0
{$active['Oceania']}
South America
/pkg_edit.php?xml=pfblocker_SouthAmerica.xml&id=0
{$active['South America']}
XMLRPC Sync
/pkg_edit.php?xml=pfblocker_sync.xml&id=0
Continent {$cont}
listtopic
Countries
countries
select
{$options}
{$total}
pfblocker_php_install_command();
pfblocker_php_deinstall_command();
pfblocker_validate_input(\$_POST, &\$input_errors);
sync_package_pfblocker();
EOF;
file_put_contents('/usr/local/pkg/pfblocker_'.$cont_name.'.xml',$xml,LOCK_EX);
}
}
?>