Code

Replace stream_get_contents() which is not php4 compatible
[gosa.git] / plugins / admin / systems / class_servRepositorySetup.inc
index 8fec23baad07671634fe52e988f494a63209d1a5..6bbfb43483c57af16ed7b8474d89d583fb634d95 100644 (file)
@@ -61,7 +61,24 @@ class servRepositorySetup  extends plugin
     $smarty= get_smarty();
 
     if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
-      $this->Sections[$_POST['SectionName']]=$_POST['SectionName'];
+     
+      /* Replace multiple spaces with a single, and cut of white spaces (trim)*/ 
+      $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName']));
+    
+      /* check if there are more than one entry given ( "section1 section2 )*/
+      if(preg_match("/ /",$val)){
+
+        /* Generate list of new section names */
+        $vals = split(" ",$val);
+        /* Add new entries */ 
+        foreach($vals as $entry){
+          $entry = trim($entry);
+          $this->Sections[$entry]=$entry;
+        }
+      }else{
+        $this->Sections[$val]=$val;
+      }
     }
     
     foreach($_POST as $name => $value){