[dev] Ingo: [patch]

Marc Jauvin marc at register4less.com
Sun Jul 20 07:39:29 PDT 2003


This patch fixes the following:

- a quoting problem in a preg_replace() call
- replaces comas prior to creating the rule object instead of adding a coma to
the characters used for exploding the array.


--
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.44
diff -u -r1.44 sieve.php
--- sieve.php   17 Jul 2003 23:06:37 -0000      1.44
+++ sieve.php   20 Jul 2003 14:34:51 -0000
@@ -493,17 +493,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']) {
@@ -1377,7 +1377,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 = '';
@@ -1462,7 +1462,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 = '';
@@ -1477,7 +1477,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