From 4e8dd82f957006899f1babb2e521b8fd3cdcd2ce Mon Sep 17 00:00:00 2001 From: Marcello Coutinho Date: Mon, 9 Jul 2012 12:25:07 -0300 Subject: dansguardian - improve exceptioniplist array creation and test --- config/dansguardian/dansguardian.inc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'config') diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc index 0ef32a07..f61936a7 100755 --- a/config/dansguardian/dansguardian.inc +++ b/config/dansguardian/dansguardian.inc @@ -32,7 +32,13 @@ require_once("util.inc"); require("globals.inc"); #require("guiconfig.inc"); -$uname=posix_uname(); +$pf_version=substr(trim(file_get_contents("/etc/version")),0,3); +if ($pf_version > 2.0) + define('DANSGUARDIAN_DIR', '/usr/pbi/dansguardian-' . php_uname("m")); +else + define('DANSGUARDIAN_DIR', '/usr/local'); + + $uname=posix_uname(); if ($uname['machine']=='amd64') ini_set('memory_limit', '250M'); @@ -423,7 +429,7 @@ function sync_package_dansguardian() { file_put_contents($dansguardian_dir."/lists/logsitelist.".$dansguardian_site['name'],($dansguardian_site['urlsite_enabled']?dg_text_area_decode($config['installedpackages']['dansguardiansiteacl']['config'][$count]['log_sitelist']):""),LOCK_EX); $count++; } - + #URL ACL #create a default setup if not exists if (!is_array($config['installedpackages']['dansguardianurlacl']['config'])) @@ -682,11 +688,12 @@ function sync_package_dansguardian() { $dansguardian_log['report_file']=base64_encode($report_file); $load_samples++; } + #exception ip list #create a default setup if not exists if (!is_array($config['installedpackages']['dansguardianips']['config'])) - $config['installedpackages']['dansguardianips']['config'][0]=array(); - if($config['installedpackages']['dansguardianips']['config'][0]['exceptioniplist']){ + $config['installedpackages']['dansguardianips']['config'][0]=array("exceptioniplist" => ""); + if($config['installedpackages']['dansguardianips']['config'][0]['exceptioniplist'] == "" && file_exists ($dansguardian_dir.'/lists/exceptioniplist.sample')){ $config['installedpackages']['dansguardianips']['config'][0]['exceptioniplist']=base64_encode(file_get_contents($dansguardian_dir.'/lists/exceptioniplist.sample')); $load_samples++; } -- cgit v1.2.3