1,
'04hours' => 4,
'12hours' => 12,
'EveryDay' => 23);
if($config['installedpackages']['pfblockerlists']['config'] != "")
foreach($config['installedpackages']['pfblockerlists']['config'] as $list){
if (is_array($list['row']))
foreach ($list['row'] as $row){
if ($row['url'] != "" && $hour > 0 ){
$md5_url = md5($row['url']);
$update_hour=(array_key_exists($list['cron'], $cron)?$cron[$list['cron']]:25);
if($row['url'] && ($hour%$update_hour == 0)){
print $update_hour." ".$pfbdir.'/'.$md5_url.'.txt'."\n";
unlink_if_exists($pfbdir.'/'.$md5_url.'.txt');
$updates++;
}
}
}
}
if ($updates > 0){
include "/usr/local/pkg/pfblocker.inc";
sync_package_pfblocker("cron");
}
}
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."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 hereDescribe your package requirements hereCurrently there are no FAQ items provided.pfblocker{$cont_name_lower}1.0Firewall: pfblocker/usr/local/pkg/pfblocker.incGeneral/pkg_edit.php?xml=pfblocker.xml&id=0Lists/pkg.php?xml=pfblocker_lists.xmlTop 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=0Continent {$cont}listtopicCountriescountriesUse CTRL + CLICK to unselect countries]]>
select
{$options}
{$total}ActionactionDisabled
Select action for countries you have selected in {$cont}
Note: 'Deny Both' - Will deny access on Both directions.
'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.
'Disabled' - Will just keep selection and do nothing to selected countries.
'Alias Only' - Will create alias pfBlocker{$cont} with selected countries to help custom rule assignments.
While creating rules with this alias, keep aliasname in the beggining of rule description and do not end description with 'rule'.
Custom rules with 'Aliasname something rule' description will be removed by package.]]>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);
}
}
?>