aboutsummaryrefslogtreecommitdiffstats
path: root/config/pf-blocker/pfblocker.php
diff options
context:
space:
mode:
authorMarcello Coutinho <marcellocoutinho@gmail.com>2011-11-11 02:14:08 -0200
committermarcelloc <marcellocoutinho@gmail.com>2011-11-11 02:14:08 -0200
commit9bccbdf46d1ac7c8dc41612a1a6a5e1120fcf326 (patch)
treecd14f889092528774631e8aace62d83d036be4ad /config/pf-blocker/pfblocker.php
parenteb3a508cd0728fa9143a841654c61f6b064c7cfb (diff)
downloadpfsense-packages-9bccbdf46d1ac7c8dc41612a1a6a5e1120fcf326.tar.gz
pfsense-packages-9bccbdf46d1ac7c8dc41612a1a6a5e1120fcf326.tar.bz2
pfsense-packages-9bccbdf46d1ac7c8dc41612a1a6a5e1120fcf326.zip
pfBlocker - version 0.1.4.5 is out with lists update frequency and widget rule package count
Diffstat (limited to 'config/pf-blocker/pfblocker.php')
-rw-r--r--config/pf-blocker/pfblocker.php43
1 files changed, 34 insertions, 9 deletions
diff --git a/config/pf-blocker/pfblocker.php b/config/pf-blocker/pfblocker.php
index d6803b49..e6fcd75e 100644
--- a/config/pf-blocker/pfblocker.php
+++ b/config/pf-blocker/pfblocker.php
@@ -12,16 +12,41 @@ if (preg_match("/(\w+)/",$_REQUEST['pfb'],$matches))
get_networks($matches[1]);
#}
-if ($argv[1]=='cron' && preg_match("/\d+/",$argv[2],$matches)){
- #require_once("/etc/inc/util.inc");
- #require_once("/etc/inc/functions.inc");
- #require_once("/etc/inc/etpkg-utils.inc");
- #require_once("/etc/inc/globals.inc");
- #require_once("/etc/inc/filter.inc");
+if ($argv[1]=='cron'){
+ require_once("/etc/inc/util.inc");
+ require_once("/etc/inc/functions.inc");
+ require_once("/etc/inc/pkg-utils.inc");
+ require_once("/etc/inc/globals.inc");
+ require_once("/etc/inc/filter.inc");
+ $hour=date('H');
+ $pfbdir='/usr/local/pkg/pfblocker';
+ $updates=0;
+ $cron=array('01hour' => 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";
- print "id".$argv[2];
- sync_package_pfblocker($argv[2]);
- }
+ sync_package_pfblocker();
+ }
+ }
function pfblocker_get_countries(){
$files= array ( "Africa" => "/usr/local/pkg/Africa_cidr.txt",