gunnar: server/kolab-webadmin/kolab-webadmin/lib/KolabAdmin Sieve.php, 1.2, 1.3

cvs at kolab.org cvs at kolab.org
Thu Apr 1 15:38:21 CEST 2010


Author: gunnar

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/lib/KolabAdmin
In directory doto:/tmp/cvs-serv16540/kolab-webadmin/lib/KolabAdmin

Modified Files:
	Sieve.php 
Log Message:
Complete the handling of the folder delivery segment.

Index: Sieve.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/lib/KolabAdmin/Sieve.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Sieve.php	1 Apr 2010 09:12:30 -0000	1.2
+++ Sieve.php	1 Apr 2010 13:38:19 -0000	1.3
@@ -83,19 +83,22 @@
 
     private function _splitSegments($script)
     {
-        preg_match('/^\\(### SEGMENT START [^#]*.*?### SEGMENT END [^#]*\\)/', $script, $matches);
+        $segments = array();
+        preg_match_all('/^### SEGMENT START [^#]*.*?### SEGMENT END [^#]*/s', $script, $matches);
         foreach ($matches as $match) {
-            preg_match('/^### SEGMENT START \\([^#]*\\)/', $match, $id);
-            if (!empty($id[0])) {
-                $class = 'KolabAdmin_Sieve_Segment_' . ucfirst($id[0]);
-                $this->_segments[$id[0]] = new $class($match);
-                if (preg_match('/^### SEGMENT START \\([^ ]* ENABLED\\)/', $match)) {
-                    $this->_segments[$id[0]]->setActive();
+            preg_match('/^### SEGMENT START ([^# ]*) ?(ENABLED)?/s', $match[0], $id);
+            if (!empty($id[1])) {
+                $type = strtolower($id[1]);
+                $class = 'KolabAdmin_Sieve_Segment_' . ucfirst($type);
+                $segments[$type] = new $class($match[0]);
+                if ($id[2] == 'ENABLED') {
+                    $segments[$type]->setActive();
                 }
             } else {
                 throw new Exception('Unknown segment type.');
             }
         }
+        return $segments;
     }
 
     public function fetchDeliverySegment()





More information about the commits mailing list