Code

Updated macro checks
[gosa.git] / plugins / gofon / macro / class_gofonMacro.inc
old mode 100755 (executable)
new mode 100644 (file)
index b3ac8d4..6043a63
@@ -286,21 +286,23 @@ class macro extends plugin
 #      if(substr_count($s_linestr,",") !=2){
 #        return(sprintf(_("More than two ',' given in line : '%s'. Remember that parameters are seperated by '|'."),$i_linenum));
 #      }
-      /* Multiple () are not supproted currently ... */  
-      if(substr_count($s_linestr,"(") >1 ){
-        return(sprintf(_("More than one '(' is currently not supported. Line : '%s'."),$i_linenum));
-      }
-      if(substr_count($s_linestr,")") >1 ){
-        return(sprintf(_("More than one ')' is currently not supported. Line : '%s'."),$i_linenum));
-      }
+
+#     /* Multiple () are not supproted currently ... */  
+#     if(substr_count($s_linestr,"(") >1 ){
+#       return(sprintf(_("More than one '(' is currently not supported. Line : '%s'."),$i_linenum));
+#     }
+#     if(substr_count($s_linestr,")") >1 ){
+#       return(sprintf(_("More than one ')' is currently not supported. Line : '%s'."),$i_linenum));
+#     }
+
       /* Check if there is an application given */
       if(empty($tmp[1])){
         return(sprintf(_("There is no application given in line : '%s'."),$i_linenum));
-      } 
+      }
       /* Check if there is an extension given */
       if(empty($tmp[0])){
         return(sprintf(_("There is no extension type given in line : '%s'."),$i_linenum));
-      } 
+      }
 
       /* Create extension entry for current line 
        *  and add this line to an array that will be inserted 
@@ -309,8 +311,7 @@ class macro extends plugin
       $exten  = addslashes($tmp[0]);
       $prio   = addslashes($tmp[1]);
       $app    = addslashes(preg_replace("/\(.*\).*$/","",$tmp[2]));
-      $para   = addslashes(preg_replace("/^.*\(/","",$tmp[2]));
-      $para   = preg_replace("/\).*$/","",$para);
+      $para   = addslashes(preg_replace("/^[^(]*\((.*)\)[^)]*$/", "$1", $tmp[2]));
       $sql.= " ('".$context."','".$exten."','".$prio."','".$app."','".$para."'),";
     }
     
@@ -410,12 +411,6 @@ class macro extends plugin
         }
       }
     }
-
-    /* Macro content must be smaller than 100 lines */
-    if(count(split("\n",$this->goFonMacroContent))>100){
-      $message[] = _("Makro length must be lower than 100 lines");
-    }
-
     return $message;
   }
 
@@ -454,7 +449,7 @@ class macro extends plugin
 
     /* Delete references to object groups */
     $ldap->cd ($this->config->current['BASE']);
-    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".$this->dn."))", array("cn"));
+    $ldap->search ("(&(objectClass=gosaGroupOfNames)(member=".@LDAP::prepare4filter($this->dn)."))", array("cn"));
     while ($ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
       unset($og->member[$this->dn]);