Update of /cvsroot/serverfilters/server_side_filters_procmail In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv29349 Modified Files: config_default.php config_example.php functions.php index.php make_release.sh setup.php Log Message: Add more negative test types (matching methods) and update copyright dates Index: make_release.sh =================================================================== RCS file: /cvsroot/serverfilters/server_side_filters_procmail/make_release.sh,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** make_release.sh 1 Oct 2010 02:54:30 -0000 1.1.1.1 --- make_release.sh 11 Jan 2011 02:00:29 -0000 1.2 *************** *** 4,8 **** # Generic shell script for building SquirrelMail plugin release # ! # Copyright (c) 2004-2010 Paul Lesniewski <pa...@sq...> # Licensed under the GNU GPL. For full terms see the file COPYING. # --- 4,8 ---- # Generic shell script for building SquirrelMail plugin release # ! # Copyright (c) 2004-2011 Paul Lesniewski <pa...@sq...> # Licensed under the GNU GPL. For full terms see the file COPYING. # Index: functions.php =================================================================== RCS file: /cvsroot/serverfilters/server_side_filters_procmail/functions.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** functions.php 1 Oct 2010 02:54:30 -0000 1.1.1.1 --- functions.php 11 Jan 2011 02:00:29 -0000 1.2 *************** *** 4,8 **** * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. --- 4,8 ---- * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010-2011 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. *************** *** 18,30 **** * Initialize this plugin (load config values) * * @return boolean FALSE if no configuration file could be loaded, TRUE otherwise * */ ! function server_side_filters_procmail_init() { ! if (!@include_once(SM_PATH . 'config/config_server_side_filters_procmail.php')) ! if (!@include_once(SM_PATH . 'plugins/server_side_filters_procmail/config.php')) ! if (!@include_once(SM_PATH . 'plugins/server_side_filters_procmail/config_default.php')) ! return FALSE; } --- 18,44 ---- * Initialize this plugin (load config values) * + * @param boolean $debug When TRUE, do not suppress errors when including + * configuration files (OPTIONAL; default FALSE) + * * @return boolean FALSE if no configuration file could be loaded, TRUE otherwise * */ ! function server_side_filters_procmail_init($debug=FALSE) { ! if ($debug) ! { ! if (!include_once(SM_PATH . 'config/config_server_side_filters_procmail.php')) ! if (!include_once(SM_PATH . 'plugins/server_side_filters_procmail/config.php')) ! if (!include_once(SM_PATH . 'plugins/server_side_filters_procmail/config_default.php')) ! return FALSE; ! } ! else ! { ! if (!@include_once(SM_PATH . 'config/config_server_side_filters_procmail.php')) ! if (!@include_once(SM_PATH . 'plugins/server_side_filters_procmail/config.php')) ! if (!@include_once(SM_PATH . 'plugins/server_side_filters_procmail/config_default.php')) ! return FALSE; ! } ! return TRUE; } *************** *** 47,52 **** * filterable messages * MATCHING_METHOD -- "CONTAINS", "NOT_CONTAINS", ! * "BEGINS_WITH", "ENDS_WITH", ! * "EXACT_MATCH", or "REGEX", * indicating how the MATCH_STRING * should be compared with the --- 61,68 ---- * filterable messages * MATCHING_METHOD -- "CONTAINS", "NOT_CONTAINS", ! * "BEGINS_WITH", "DOESNT_BEGIN_WITH", ! * "ENDS_WITH", "DOESNT_END_WITH", ! * "IS_EXACTLY", "ISNT_EXACTLY", ! * "MATCHES_REGEX" or "DOESNT_MATCH_REGEX" * indicating how the MATCH_STRING * should be compared with the *************** *** 290,297 **** break; case 'BODY': ! if ($rule['MATCHING_METHOD'] == 'BEGINS_WITH') $rule['HEADER_FIELD'] = '^^'; else if ($rule['MATCHING_METHOD'] == 'ENDS_WITH' || $rule['MATCHING_METHOD'] == 'IS_EXACTLY' || $rule['MATCHING_METHOD'] == 'MATCHES_REGEX') // the double-dollars is converted to an ending ^^ below --- 306,318 ---- break; case 'BODY': ! $location = 'B'; ! if ($rule['MATCHING_METHOD'] == 'BEGINS_WITH' ! || $rule['MATCHING_METHOD'] == 'DOESNT_BEGIN_WITH') $rule['HEADER_FIELD'] = '^^'; else if ($rule['MATCHING_METHOD'] == 'ENDS_WITH' + || $rule['MATCHING_METHOD'] == 'DOESNT_END_WITH' || $rule['MATCHING_METHOD'] == 'IS_EXACTLY' + || $rule['MATCHING_METHOD'] == 'ISNT_EXACTLY' + || $rule['MATCHING_METHOD'] == 'DOESNT_MATCH_REGEX' || $rule['MATCHING_METHOD'] == 'MATCHES_REGEX') // the double-dollars is converted to an ending ^^ below *************** *** 299,303 **** else $rule['HEADER_FIELD'] = ''; - $location = 'B'; break; case 'ANY_HEADER': --- 320,323 ---- *************** *** 379,404 **** { case 'CONTAINS': - $expression_prefix = ''; - $prefix = '.*'; - $suffix = ''; - $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); - break; case 'NOT_CONTAINS': - // if using TO_OR_CC with NOT_CONTAINS, technically, it behaves - // as TO_AND_CC, which makes more sense, but is not portrayed in - // the interface by "AND"... just so you know in case a user asks - // - $expression_prefix = '! '; $prefix = '.*'; $suffix = ''; $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); break; case 'BEGINS_WITH': ! $expression_prefix = ''; $prefix = ''; $suffix = ''; $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); break; case 'ENDS_WITH': // double-dollar in the header field is just a flag // to tell us to use ^^ at the end of the pattern --- 399,429 ---- { case 'CONTAINS': case 'NOT_CONTAINS': $prefix = '.*'; $suffix = ''; $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'NOT_CONTAINS') + $expression_prefix = '! '; + else + $expression_prefix = ''; + break; + case 'BEGINS_WITH': ! case 'DOESNT_BEGIN_WITH': $prefix = ''; $suffix = ''; $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'DOESNT_BEGIN_WITH') + $expression_prefix = '! '; + else + $expression_prefix = ''; + break; + case 'ENDS_WITH': + case 'DOESNT_END_WITH': // double-dollar in the header field is just a flag // to tell us to use ^^ at the end of the pattern *************** *** 421,428 **** $suffix = '$'; } - $expression_prefix = ''; $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); break; case 'IS_EXACTLY': // double-dollar in the header field is just a flag // to tell us to use ^^ at the beginning AND end of --- 446,460 ---- $suffix = '$'; } $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'DOESNT_END_WITH') + $expression_prefix = '! '; + else + $expression_prefix = ''; + break; + case 'IS_EXACTLY': + case 'ISNT_EXACTLY': // double-dollar in the header field is just a flag // to tell us to use ^^ at the beginning AND end of *************** *** 441,450 **** else $suffix = '$'; - $expression_prefix = ''; $prefix = ''; $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); break; case 'MATCHES_REGEX': ! $expression_prefix = ''; $prefix = ''; $suffix = ''; --- 473,488 ---- else $suffix = '$'; $prefix = ''; $rule['MATCH_STRING'] = preg_quote($rule['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'ISNT_EXACTLY') + $expression_prefix = '! '; + else + $expression_prefix = ''; + break; + case 'MATCHES_REGEX': ! case 'DOESNT_MATCH_REGEX': $prefix = ''; $suffix = ''; *************** *** 471,475 **** --- 509,519 ---- } + if ($rule['MATCHING_METHOD'] == 'DOESNT_MATCH_REGEX') + $expression_prefix = '! '; + else + $expression_prefix = ''; + break; + default : // same as CONTAINS $expression_prefix = ''; *************** *** 507,514 **** break; case 'BODY': ! if ($criteria['MATCHING_METHOD'] == 'BEGINS_WITH') $criteria['HEADER_FIELD'] = '^^'; else if ($criteria['MATCHING_METHOD'] == 'ENDS_WITH' || $criteria['MATCHING_METHOD'] == 'IS_EXACTLY' || $criteria['MATCHING_METHOD'] == 'MATCHES_REGEX') // the double-dollars is converted to an ending ^^ below --- 551,563 ---- break; case 'BODY': ! $criteria_location = 'B'; ! if ($criteria['MATCHING_METHOD'] == 'BEGINS_WITH' ! || $criteria['MATCHING_METHOD'] == 'DOESNT_BEGIN_WITH') $criteria['HEADER_FIELD'] = '^^'; else if ($criteria['MATCHING_METHOD'] == 'ENDS_WITH' + || $criteria['MATCHING_METHOD'] == 'DOESNT_END_WITH' || $criteria['MATCHING_METHOD'] == 'IS_EXACTLY' + || $criteria['MATCHING_METHOD'] == 'ISNT_EXACTLY' + || $criteria['MATCHING_METHOD'] == 'DOESNT_MATCH_REGEX' || $criteria['MATCHING_METHOD'] == 'MATCHES_REGEX') // the double-dollars is converted to an ending ^^ below *************** *** 516,520 **** else $criteria['HEADER_FIELD'] = ''; - $criteria_location = 'B'; break; case 'ANY_HEADER': --- 565,568 ---- *************** *** 546,571 **** { case 'CONTAINS': - $criteria_expression_prefix = ''; - $criteria_prefix = '.*'; - $criteria_suffix = ''; - $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); - break; case 'NOT_CONTAINS': - // if using TO_OR_CC with NOT_CONTAINS, technically, it behaves - // as TO_AND_CC, which makes more sense, but is not portrayed in - // the interface by "AND"... just so you know in case a user asks - // - $criteria_expression_prefix = '! '; $criteria_prefix = '.*'; $criteria_suffix = ''; $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); break; case 'BEGINS_WITH': ! $criteria_expression_prefix = ''; $criteria_prefix = ''; $criteria_suffix = ''; $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); break; case 'ENDS_WITH': // double-dollar in the header field is just a flag // to tell us to use ^^ at the end of the pattern --- 594,624 ---- { case 'CONTAINS': case 'NOT_CONTAINS': $criteria_prefix = '.*'; $criteria_suffix = ''; $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'NOT_CONTAINS') + $criteria_expression_prefix = '! '; + else + $criteria_expression_prefix = ''; + break; + case 'BEGINS_WITH': ! case 'DOESNT_BEGIN_WITH': $criteria_prefix = ''; $criteria_suffix = ''; $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'DOESNT_BEGIN_WITH') + $criteria_expression_prefix = '! '; + else + $criteria_expression_prefix = ''; + break; + case 'ENDS_WITH': + case 'DOESNT_END_WITH': // double-dollar in the header field is just a flag // to tell us to use ^^ at the end of the pattern *************** *** 582,589 **** $criteria_prefix = '.*'; } - $criteria_expression_prefix = ''; $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); break; case 'IS_EXACTLY': // double-dollar in the header field is just a flag // to tell us to use ^^ at the beginning AND end of --- 635,649 ---- $criteria_prefix = '.*'; } $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'DOESNT_END_WITH') + $criteria_expression_prefix = '! '; + else + $criteria_expression_prefix = ''; + break; + case 'IS_EXACTLY': + case 'ISNT_EXACTLY': // double-dollar in the header field is just a flag // to tell us to use ^^ at the beginning AND end of *************** *** 597,606 **** else $criteria_suffix = '$'; - $criteria_expression_prefix = ''; $criteria_prefix = ''; $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); break; case 'MATCHES_REGEX': ! $criteria_expression_prefix = ''; $criteria_prefix = ''; $criteria_suffix = ''; --- 657,672 ---- else $criteria_suffix = '$'; $criteria_prefix = ''; $criteria['MATCH_STRING'] = preg_quote($criteria['MATCH_STRING']); + + if ($rule['MATCHING_METHOD'] == 'ISNT_EXACTLY') + $criteria_expression_prefix = '! '; + else + $criteria_expression_prefix = ''; + break; + case 'MATCHES_REGEX': ! case 'DOESNT_MATCH_REGEX': $criteria_prefix = ''; $criteria_suffix = ''; *************** *** 627,631 **** --- 693,703 ---- } + if ($rule['MATCHING_METHOD'] == 'ISNT_EXACTLY') + $criteria_expression_prefix = '! '; + else + $criteria_expression_prefix = ''; + break; + default : // same as CONTAINS $criteria_expression_prefix = ''; Index: config_default.php =================================================================== RCS file: /cvsroot/serverfilters/server_side_filters_procmail/config_default.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** config_default.php 1 Oct 2010 02:54:30 -0000 1.1.1.1 --- config_default.php 11 Jan 2011 02:00:29 -0000 1.2 *************** *** 4,8 **** * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. --- 4,8 ---- * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010-2011 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. Index: index.php =================================================================== RCS file: /cvsroot/serverfilters/server_side_filters_procmail/index.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** index.php 1 Oct 2010 02:54:30 -0000 1.1.1.1 --- index.php 11 Jan 2011 02:00:29 -0000 1.2 *************** *** 8,12 **** * person is logged in or not. * ! * @copyright 1999-2010 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ --- 8,12 ---- * person is logged in or not. * ! * @copyright 1999-2011 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ Index: setup.php =================================================================== RCS file: /cvsroot/serverfilters/server_side_filters_procmail/setup.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** setup.php 1 Oct 2010 02:54:30 -0000 1.1.1.1 --- setup.php 11 Jan 2011 02:00:29 -0000 1.2 *************** *** 4,8 **** * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. --- 4,8 ---- * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010-2011 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. Index: config_example.php =================================================================== RCS file: /cvsroot/serverfilters/server_side_filters_procmail/config_example.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** config_example.php 1 Oct 2010 02:54:30 -0000 1.1.1.1 --- config_example.php 11 Jan 2011 02:00:29 -0000 1.2 *************** *** 4,8 **** * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. --- 4,8 ---- * SquirrelMail Server Side Filters Procmail Plugin * ! * Copyright (c) 2010-2011 Paul Lesniewski <pa...@sq...> * * Licensed under the GNU GPL. For full terms see the file COPYING. |