diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-07-02 11:32:02 -0300 |
---|---|---|
committer | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-07-02 11:32:02 -0300 |
commit | 111c95c8f9b11e24121ec9f0c128e94c4c55f279 (patch) | |
tree | c8bd8cec078db17ebacff86fa5eb3c9cd777b3f7 /config/dansguardian/dansguardian.inc | |
parent | 233e9068bd5b186cebbfb0ceff6ead0ae81a2a43 (diff) | |
download | pfsense-packages-111c95c8f9b11e24121ec9f0c128e94c4c55f279.tar.gz pfsense-packages-111c95c8f9b11e24121ec9f0c128e94c4c55f279.tar.bz2 pfsense-packages-111c95c8f9b11e24121ec9f0c128e94c4c55f279.zip |
dansguardian - replace split function with preg_match
related post:
http://forum.pfsense.org/index.php/topic,51001.msg272499.html#msg272499
Diffstat (limited to 'config/dansguardian/dansguardian.inc')
-rwxr-xr-x | config/dansguardian/dansguardian.inc | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc index 850c04e0..61f03c6a 100755 --- a/config/dansguardian/dansguardian.inc +++ b/config/dansguardian/dansguardian.inc @@ -94,7 +94,7 @@ function sync_package_dansguardian() { else $boot_process="on"; } - +unset($boot_process); if (is_process_running('dansguardian') && isset($boot_process)) return; @@ -132,14 +132,22 @@ function sync_package_dansguardian() { $filterport=($dansguardian['filterports']?$dansguardian['filterports']:"8080"); $softrestart=(preg_match('/softrestart/',$dansguardian['daemon_options'])?"yes":"no"); $nodaemon=(preg_match('/nodaemon/',$dansguardian['daemon_options'])?"yes":"off"); - if (preg_match("/\d+\/\d+/",$dansguardian['children'])) - list($minchildren,$maxchildren) = split ("/", $dansguardian['children'], 2); - else - list($minchildren,$maxchildren) = split ("/", "8/120", 2); - if (preg_match("/\d+\/\d+/",$dansguardian['sparechildren'])) - list($minsparechildren,$maxsparechildren) = split ("/", $dansguardian['sparechildren'], 2); - else - list($minsparechildren,$maxsparechildren) = split ("/", "8/64", 2); + if (preg_match("/(\d+)\/(\d+)/",$dansguardian['children'],$matches)){ + $minchildren=$matches[1]; + $maxchildren=$matches[2]; + } + else{ + $minchildren=8; + $maxchildren=120; + } + if (preg_match("/(\d+)\/(\d+)/",$dansguardian['sparechildren'],$matches)){ + $minsparechildren=$matches[1]; + $maxsparechildren=$matches[2]; + } + else{ + $minsparechildren=8; + $maxsparechildren=64; + } $maxagechildren=($dansguardian['maxagechildren']?$dansguardian['maxagechildren']:"500"); $maxips=($dansguardian['maxips']?$dansguardian['maxips']:"0"); $preforkchildren=($dansguardian['preforkchildren']?$dansguardian['preforkchildren']:"10"); |