"/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."c"}==""){ ${$ISOCode."c"}="ok"; $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 pfBlocker Configure pfblocker
Firewall
pkg_edit.php?xml=pfblocker.xml&id=0
General /pkg_edit.php?xml=pfblocker.xml&id=0 Lists /pkg.php?xml=pfblocker_lists.xml 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 Use CTRL + CLICK to unselect countries]]> select {$options} {$total} Action action Disabled
Select action for countries you have selected in {$cont}

Note:
'Deny Inbound' - Will deny access from selected countries to your network.
'Deny Outbound' - Will deny access from your users to countries you selected to block
'Permit Inbound' - Will allow access from selected countries to your network.
'Permit Outbound' - Will allow access from your users to countries you selected to block
'Alias Only' - Will create alias {$cont} with selected countries to help custom rule assignments.
'Disabled' - Will just keep selection and do nothing to selected countries.
]]>
select
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); } } ?>