Code

removed debug code.
[gosa.git] / gosa-core / include / class_plugin.inc
index 8eec579c440ece59c05ab39906138cf558687d76..3527494d88e01990e729d981e3ed15fb021018b2 100644 (file)
@@ -212,7 +212,7 @@ class plugin
           unset($this->saved_attributes[$index]);
           continue;
         }
-        if ($this->saved_attributes[$index]["count"] == 1){
+        if (isset($this->saved_attributes[$index][0]) || $this->saved_attributes[$index]["count"] == 1){
           $tmp= $this->saved_attributes[$index][0];
           unset($this->saved_attributes[$index]);
           $this->saved_attributes[$index]= $tmp;
@@ -314,9 +314,6 @@ class plugin
           $data = "";  
         }
         $this->$val= $data;
-        //echo "<font color='blue'>".$val."</font><br>";
-      }else{
-        //echo "<font color='red'>".$val."</font><br>";
       }
     }
   }
@@ -820,7 +817,7 @@ class plugin
   {
     /* Rename dn in possible object groups */
     $ldap= $this->config->get_ldap_link();
-    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::preapre4filter($src_dn).'))',
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::prepare4filter($src_dn).'))',
         array('cn'));
     while ($attrs= $ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
@@ -858,6 +855,11 @@ class plugin
 
   function move($src_dn, $dst_dn)
   {
+    /* Do not copy if only upper- lowercase has changed */
+    if(strtolower($src_dn) == strtolower($dst_dn)){
+      return(TRUE);
+    }
+
     /* Copy source to destination */
     if (!$this->copy($src_dn, $dst_dn)){
       return (FALSE);
@@ -890,31 +892,11 @@ class plugin
       return (FALSE);
     }
 
-    /* Perform a search for all objects to be moved */
-    $objects= array();
-    $ldap->cd($src_dn);
-    $ldap->search("(objectClass=*)", array("dn"));
-    while($attrs= $ldap->fetch()){
-      $dn= $attrs['dn'];
-      $objects[$dn]= strlen($dn);
-    }
-
-    /* Sort objects by indent level */
-    asort($objects);
-    reset($objects);
-
-    /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
-    foreach ($objects as $object => $len){
-      $src= $object;
-      $dst= preg_replace("/$src_dn$/", "$dst_dn", $object);
-      if (!$this->copy($src, $dst)){
-        return (FALSE);
-      }
-    }
+    $this->copy($src_dn, $dst_dn);
 
     /* Remove src_dn */
     $ldap->cd($src_dn);
-    $ldap->recursive_remove();
+    $ldap->recursive_remove($src_dn);
     return (TRUE);
   }
 
@@ -972,14 +954,11 @@ class plugin
               $tmp = $source[$var][$i];
             }
             $this->$var = $tmp;
-#            echo $var."=".$tmp."<br>";
           }else{
             $this->$var = $source[$var][0];
-#            echo $var."=".$source[$var][0]."<br>";
           }
         }else{
           $this->$var= $source[$var];
-#          echo $var."=".$source[$var]."<br>";
         }
       }
     }
@@ -1514,12 +1493,12 @@ class plugin
     if(isset($this->base) && isset($this->config->idepartments[$this->base])){
       $deps[$this->base] = $this->config->idepartments[$this->base];
     }else{
-      echo "No default base found. ".$this->base."<br> ";
+      trigger_error("No default base found in class ".get_class($this).". ".$this->base);
     }
-
     return($deps);
   }
 
+
   /* This function modifies object acls too, if an object is moved.
    *  $old_dn   specifies the actually used dn
    *  $new_dn   specifies the destiantion dn
@@ -1597,14 +1576,10 @@ class plugin
        /* Acls for this object must be adjusted */
        if($found){
 
-          if($output_changes){
-            echo "<font color='green'>".
-                  _("Changing ACL dn")."&nbsp;:&nbsp;<br>&nbsp;-"._("from")."&nbsp;<b>&nbsp;".
-                  $old_dn.
-                  "</b><br>&nbsp;-"._("to")."&nbsp;<b>".
-                  $new_dn.
-                  "</b></font><br>";
-          }
+          $debug_info=  _("Changing ACL dn")."&nbsp;:&nbsp;<br>&nbsp;-"._("from")."&nbsp;<b>&nbsp;".
+                  $old_dn."</b><br>&nbsp;-"._("to")."&nbsp;<b>".$new_dn."</b><br>";
+          @DEBUG (DEBUG_ACL, __LINE__, __FUNCTION__, __FILE__,$debug_info,"ACL");
+
           $update[$attrs['dn']] =array();
           foreach($acls as $acl){
             $update[$attrs['dn']]['gosaAclEntry'][] = $acl;