From: cajus Date: Wed, 9 Apr 2008 10:21:35 +0000 (+0000) Subject: closes #411 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=438c90a4a3284b15c58a372429c181d086870ebd;p=gosa.git closes #411 -Postcreate/modify/remove fixed replacements git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10297 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 047b21898..8ae807992 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -608,18 +608,25 @@ class plugin if ($command != ""){ - /* Additional attributes */ - foreach ($add_attrs as $name => $value){ - $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); + $add_attrs[$attr] = $this->$attr; } } - $command= preg_replace("/%dn( |$)/", $this->dn." ", $command); + $add_attrs['dn']=$this->dn; + + $tmp = array(); + foreach($add_attrs as $name => $value){ + $tmp[$name] = strlen($name); + } + arsort($tmp); + + /* Additional attributes */ + foreach ($tmp as $name => $len){ + $value = $add_attrs[$name]; + $command= preg_replace("/%$name/", "$value ", $command); + } if (check_command($command)){ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, @@ -640,23 +647,28 @@ class plugin if ($command != ""){ - /* Additional attributes */ - foreach ($add_attrs as $name => $value){ - $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); + $add_attrs[$attr] = $this->$attr; } } - $command= preg_replace("/%dn( |$)/", $this->dn." ", $command); + $add_attrs['dn']=$this->dn; - if (check_command($command)){ - @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, - $command, "Execute"); + $tmp = array(); + foreach($add_attrs as $name => $value){ + $tmp[$name] = strlen($name); + } + arsort($tmp); + + /* Additional attributes */ + foreach ($tmp as $name => $len){ + $value = $add_attrs[$name]; + $command= preg_replace("/%$name/", "$value ", $command); + } + if (check_command($command)){ + @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,$command, "Execute"); exec($command); } else { $message[]= msgPool::cmdnotfound("POSTMODIFY", get_class($this)); @@ -671,18 +683,25 @@ class plugin $command= $this->config->search(get_class($this), "POSTREMOVE",array('menu','tabs')); if ($command != ""){ - /* Additional attributes */ - foreach ($add_attrs as $name => $value){ - $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); + $add_attrs[$attr] = $this->$attr; } } - $command= preg_replace("/%dn( |$)/", $this->dn." ", $command); + $add_attrs['dn']=$this->dn; + + $tmp = array(); + foreach($add_attrs as $name => $value){ + $tmp[$name] = strlen($name); + } + arsort($tmp); + + /* Additional attributes */ + foreach ($tmp as $name => $len){ + $value = $add_attrs[$name]; + $command= preg_replace("/%$name/", "$value ", $command); + } if (check_command($command)){ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__,