Code

Fixed parameter expansion
[gosa.git] / include / class_plugin.inc
index c02a3b86c263d8b8af8c73faf535006763063b0b..f4dd40ef631f5e72cb636d244188d57ab06f5fd6 100644 (file)
@@ -88,6 +88,7 @@ class plugin
 
   /* Save unit tags */
   var $gosaUnitTag= "";
+  var $skipTagging= FALSE;
 
   /*!
     \brief Used standard values
@@ -546,16 +547,16 @@ class plugin
 
       /* Additional attributes */
       foreach ($add_attrs as $name => $value){
-        $command= preg_replace("/%$name/", $value, $command);
+        $command= preg_replace("/%$name( |$)/", "$value ", $command);
       }
 
       /* Walk through attribute list */
       foreach ($this->attributes as $attr){
         if (!is_array($this->$attr)){
-          $command= preg_replace("/%$attr/", $this->$attr, $command);
+          $command= preg_replace("/%$attr( |$)/", $this->$attr." ", $command);
         }
       }
-      $command= preg_replace("/%dn/", $this->dn, $command);
+      $command= preg_replace("/%dn( |$)/", $this->dn." ", $command);
 
       if (check_command($command)){
         @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
@@ -581,16 +582,16 @@ class plugin
 
       /* Additional attributes */
       foreach ($add_attrs as $name => $value){
-        $command= preg_replace("/%$name/", $value, $command);
+        $command= preg_replace("/%$name( |$)/", "$value ", $command);
       }
 
       /* Walk through attribute list */
       foreach ($this->attributes as $attr){
         if (!is_array($this->$attr)){
-          $command= preg_replace("/%$attr/", $this->$attr, $command);
+          $command= preg_replace("/%$attr( |$)/", $this->$attr." ", $command);
         }
       }
-      $command= preg_replace("/%dn/", $this->dn, $command);
+      $command= preg_replace("/%dn( |$)/", $this->dn." ", $command);
 
       if (check_command($command)){
         @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
@@ -616,21 +617,16 @@ class plugin
 
       /* Additional attributes */
       foreach ($add_attrs as $name => $value){
-        $command= preg_replace("/%$name/", $value, $command);
+        $command= preg_replace("/%$name( |$)/", "$value ", $command);
       }
 
       /* Walk through attribute list */
       foreach ($this->attributes as $attr){
         if (!is_array($this->$attr)){
-          $command= preg_replace("/%$attr/", $this->$attr, $command);
+          $command= preg_replace("/%$attr( |$)/", $this->$attr." ", $command);
         }
       }
-      $command= preg_replace("/%dn/", $this->dn, $command);
-
-      /* Additional attributes */
-      foreach ($add_attrs as $name => $value){
-        $command= preg_replace("/%$name/", $value, $command);
-      }
+      $command= preg_replace("/%dn( |$)/", $this->dn." ", $command);
 
       if (check_command($command)){
         @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,
@@ -902,6 +898,14 @@ class plugin
 
   function tag_attrs($at, $dn= "", $tag= "", $show= false)
   {
+    /* Skip tagging? 
+       If this is called from departmentGeneric, we have to skip this
+        tagging procedure. 
+     */
+    if($this->skipTagging){
+      return;
+    }
+
     /* No dn? Self-operation... */
     if ($dn == ""){
       $dn= $this->dn;