[dev] Ingo: [patch] sieve.php

Marc Jauvin marc at register4less.com
Wed Jul 16 11:35:25 PDT 2003


Fix for the "," as a seperator in strings or addresses.

--
Marc Jauvin
http://register4less.com
450-441-5458
-------------- next part --------------
Index: sieve.php
===================================================================
RCS file: /repository/ingo/lib/Script/sieve.php,v
retrieving revision 1.41
diff -u -r1.41 sieve.php
--- sieve.php	15 Jul 2003 07:15:22 -0000	1.41
+++ sieve.php	16 Jul 2003 18:31:52 -0000
@@ -488,16 +488,17 @@
                 case 'matches':
                 case 'not matches':
                     $comparator = (isset($condition['case']) && $condition['case']) ? 'i;octet' : 'i;ascii-casemap';
-                    $vals = array('headers' => $condition['field'],
+                    $vals = array('headers' => preg_replace('/(?<!\\\)\,/', "\n", $condition['field']),
                                   'comparator' => $comparator);
                     $use_address_test = false;
 
                     /* Do 'smarter' searching for fields where we know we
                        have e-mail addresses. */
                     if (preg_match('/(From|To|Cc|Bcc)/', $condition['field'])) {
-                        $vals['addresses'] = preg_replace('/(?<!\\\)\,/', '\n', $condition['value']);
+                        $vals['addresses'] = preg_replace('/(?<!\\\)\,/', "\n", $condition['value']);
+                        $use_address_test = true;
                     } else {
-                        $vals['strings'] = $condition['value'];
+                        $vals['strings'] = preg_replace('/(?<!\\\)\,/', "\n", $condition['value']);
                     }
 
                     switch ($condition['match']) {
@@ -1371,7 +1372,7 @@
 
         $code .= $this->_vars['match-type'] . ' ';
 
-        $headers = preg_split('(\r\n|\n|\r)', $this->_vars['headers']);
+        $headers = preg_split('(\r\n|\n|\r|,)', $this->_vars['headers']);
         if (count($headers) > 1) {
             $code .= "[";
             $headerstr = '';
@@ -1456,7 +1457,7 @@
 
         $code .= $this->_vars['match-type'] . ' ';
 
-        $headers = preg_split('(\r\n|\n|\r|,)', $this->_vars['headers']);
+        $headers = preg_split('(\r\n|\n|\r)', $this->_vars['headers']);
         if (count($headers) > 1) {
             $code .= "[";
             $headerstr = '';
@@ -1471,7 +1472,7 @@
             return _("No Headers Specified");
         }
 
-        $strings = preg_split('(\r\n|\n|\r|,)', $this->_vars['strings']);
+        $strings = preg_split('(\r\n|\n|\r)', $this->_vars['strings']);
         if (count($strings) > 1) {
             $code .= "[";
             $stringlist = '';


More information about the dev mailing list