Code

Added navigation gray out if option is not available
[gosa.git] / include / class_plugin.inc
index 3ebd529b95ce2d1bbddeb48fe9fdb8ae579d3335..c41ac56fa96d78e279ab205772067eec37dfd660 100644 (file)
@@ -114,7 +114,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 +130,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 +268,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"];
@@ -860,7 +864,9 @@ class plugin
     }
     $todo[] = "is_account";
     foreach($todo as $var){
-      $this->$var = $source->$var;
+      if (isset($source->$var)){
+        $this->$var= $source->$var;
+      }
     }
   }