From 12cf0d301455c8a4261f62f9c7c6c2383999d53e Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Wed, 6 May 2015 14:01:14 -0300 Subject: Simplify logic --- config/squid3/34/squid.inc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'config/squid3') diff --git a/config/squid3/34/squid.inc b/config/squid3/34/squid.inc index d81f36b5..f5cd1c31 100755 --- a/config/squid3/34/squid.inc +++ b/config/squid3/34/squid.inc @@ -425,19 +425,20 @@ function squid_before_form_general(&$pkg) { function squid_validate_antivirus($post, &$input_errors) { global $config; - if ($post['enable']=="on") { - if ($post['squidclamav'] && preg_match("/(\S+proxy.domain\S+)/",$post['squidclamav'],$a_match)) { - $input_errors[] ="Squidclamav warns redirect points to sample config domain ({$a_match[1]})"; - $input_errors[] ="Change redirect info on 'squidclamav.conf' field to pfsense gui or an external host. "; - } - if ($post['c-icap_conf']) { - if (!preg_match("/squid_clamav/",$post['c-icap_conf'])) { - $input_errors[] ="c-icap Squidclamav service definition is no present."; - $input_errors[] ="Add 'Service squid_clamav squidclamav.so'(without quotes) to 'c-icap.conf' field in order to get it working."; - } - if (preg_match("/(Manager:Apassword\S+)/",$post['c-icap_conf'],$c_match)) { - $input_errors[] ="Remove ldap configuration'{$c_match[1]}' from 'c-icap.conf' field."; - } + if ($post['enable'] != "on") + return; + + if ($post['squidclamav'] && preg_match("/(\S+proxy.domain\S+)/",$post['squidclamav'],$a_match)) { + $input_errors[] ="Squidclamav warns redirect points to sample config domain ({$a_match[1]})"; + $input_errors[] ="Change redirect info on 'squidclamav.conf' field to pfsense gui or an external host. "; + } + if ($post['c-icap_conf']) { + if (!preg_match("/squid_clamav/",$post['c-icap_conf'])) { + $input_errors[] ="c-icap Squidclamav service definition is no present."; + $input_errors[] ="Add 'Service squid_clamav squidclamav.so'(without quotes) to 'c-icap.conf' field in order to get it working."; + } + if (preg_match("/(Manager:Apassword\S+)/",$post['c-icap_conf'],$c_match)) { + $input_errors[] ="Remove ldap configuration'{$c_match[1]}' from 'c-icap.conf' field."; } } } -- cgit v1.2.3