X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_plugin.inc;h=8e992dccc33c03b894848d7fe53767a16b168040;hb=0abef43214a476951d60c468195b33f477a310c8;hp=819fd85e2e2b1f3d04688a407259bf3e85262ce7;hpb=8d35c4632952e42ea88a207d60ce753413693620;p=gosa.git diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 819fd85e2..8e992dccc 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -107,6 +107,9 @@ class plugin var $new= TRUE; var $saved_attributes= array(); + /* This can be set to render the tabulators in another stylesheet */ + var $pl_notify= FALSE; + /*! \brief plugin constructor If 'dn' is set, the node loads the given 'dn' from LDAP @@ -114,7 +117,7 @@ class plugin \param dn Distinguished name to initialize plugin from \sa plugin() */ - function plugin ($config, $dn= NULL) + function plugin ($config, $dn= NULL, $parent= NULL) { /* Configuration is fine, allways */ $this->config= $config; @@ -130,8 +133,12 @@ class plugin if ($dn != NULL){ /* Load data to 'attrs' and save 'dn' */ - $ldap->cat ($dn); - $this->attrs= $ldap->fetch(); + if ($parent != NULL){ + $this->attrs= $parent->attrs; + } else { + $ldap->cat ($dn); + $this->attrs= $ldap->fetch(); + } /* Copy needed attributes */ foreach ($this->attributes as $val){ @@ -264,7 +271,7 @@ class plugin foreach ($this->attributes as $val){ if (chkacl ($this->acl, "$val") == "" && isset ($_POST["$val"])){ /* Check for modifications */ - if (get_magic_quotes_gpc()) { + if ((get_magic_quotes_gpc()) && !is_array($_POST["$val"])) { $data= stripcslashes($_POST["$val"]); } else { $data= $this->$val = $_POST["$val"]; @@ -376,6 +383,11 @@ class plugin } } } + + /* Update saved attributes and ensure that next cleanups will be successful too */ + foreach($this->attrs as $name => $value){ + $this->saved_attributes[$name] = $value; + } } /* Check formular input */ @@ -502,15 +514,20 @@ class plugin /* Show header message for tab dialogs */ function show_header($button_text, $text, $disabled= FALSE) { + $state = "disabled"; + if($this->is_account && $this->acl == "#all#"){ + $state= ""; + }elseif(!$this->is_account && chkacl($this->acl,"create") == ""){ + $state= ""; + } + if ($disabled == TRUE){ $state= "disabled"; - } else { - $state= ""; } + $display= "\n

$text

\n"; - $display.= "acl, "all")." ".$state. - ">

 

"; + $display.= "". + "

 

"; return($display); } @@ -524,6 +541,12 @@ 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)){ @@ -532,11 +555,6 @@ class plugin } $command= preg_replace("/%dn/", $this->dn, $command); - /* Additional attributes */ - foreach ($add_attrs as $name => $value){ - $command= preg_replace("/%$name/", $value, $command); - } - if (check_command($command)){ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute"); @@ -558,6 +576,12 @@ 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)){ @@ -566,11 +590,6 @@ class plugin } $command= preg_replace("/%dn/", $this->dn, $command); - /* Additional attributes */ - foreach ($add_attrs as $name => $value){ - $command= preg_replace("/%$name/", $value, $command); - } - if (check_command($command)){ @DEBUG (DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Execute"); @@ -592,6 +611,12 @@ 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)){ @@ -860,7 +885,9 @@ class plugin } $todo[] = "is_account"; foreach($todo as $var){ - $this->$var = $source->$var; + if (isset($source->$var)){ + $this->$var= $source->$var; + } } } @@ -927,7 +954,7 @@ class plugin echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."
"; flush(); } - $nattrs= array("gosaUnitTag" => $this->gosaUnitTag); + $nattrs= array("gosaUnitTag" => $tag); $nattrs['objectClass']= array(); for ($i= 0; $i<$attrs['objectClass']['count']; $i++){ $oc= $attrs['objectClass'][$i];