Code

Added additional ip/domain checks
[gosa.git] / include / class_plugin.inc
index 15180d73cbd1719b2805435b63ce8ae03a597d83..3ebd529b95ce2d1bbddeb48fe9fdb8ae579d3335 100644 (file)
@@ -83,6 +83,9 @@ class plugin
    */
   var $attrs= array();
 
+  /* Keep set of conflicting plugins */
+  var $conflicts= array();
+
   /* Save unit tags */
   var $gosaUnitTag= "";
 
@@ -663,7 +666,7 @@ class plugin
   {
     /* Rename dn in possible object groups */
     $ldap= $this->config->get_ldap_link();
-    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.$src_dn.'))',
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($src_dn).'))',
         array('cn'));
     while ($attrs= $ldap->fetch()){
       $og= new ogroup($this->config, $ldap->getDN());
@@ -675,7 +678,7 @@ class plugin
     $ldap->cat($dst_dn);
     $attrs= $ldap->fetch();
     if (count($attrs)){
-      trigger_error("Trying to overwrite $dst_dn, which already exists.",
+      trigger_error("Trying to overwrite ".@LDAP::fix($dst_dn).", which already exists.",
           E_USER_WARNING);
       return (FALSE);
     }
@@ -683,7 +686,7 @@ class plugin
     $ldap->cat($src_dn);
     $attrs= $ldap->fetch();
     if (!count($attrs)){
-      trigger_error("Trying to move $src_dn, which does not seem to exist.",
+      trigger_error("Trying to move ".@LDAP::fix($src_dn).", which does not seem to exist.",
           E_USER_WARNING);
       return (FALSE);
     }
@@ -697,7 +700,7 @@ class plugin
 
     $r=ldap_bind($ds,$this->config->current['ADMIN'], $this->config->current['PASSWORD']);
     error_reporting (0);
-    $sr=ldap_read($ds, $ldap->fix($src_dn), "objectClass=*");
+    $sr=ldap_read($ds, @LDAP::fix($src_dn), "objectClass=*");
 
     /* Fill data from LDAP */
     $new= array();
@@ -725,14 +728,14 @@ class plugin
     /* Adapt naming attribute */
     $dst_name= preg_replace("/^([^=]+)=.*$/", "\\1", $dst_dn);
     $dst_val = preg_replace("/^[^=]+=([^,+]+).*,.*$/", "\\1", $dst_dn);
-    $new[$dst_name]= $dst_val;
+    $new[$dst_name]= @LDAP::fix($dst_val);
 
     /* Check if this is a department.
      * If it is a dep. && there is a , override in his ou 
      *  change \2C to , again, else this entry can't be saved ...
      */
-    if((isset($new['ou'])) &&( preg_match("/\\\\2C/",$new['ou']))){
-      $new['ou'] = preg_replace("/\\\\2C/",",",$new['ou']);
+    if((isset($new['ou'])) &&( preg_match("/\\,/",$new['ou']))){
+      $new['ou'] = preg_replace("/\\\\,/",",",$new['ou']);
     }
 
     /* Save copy */
@@ -924,7 +927,7 @@ class plugin
           echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."<br>";
           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];
@@ -972,6 +975,14 @@ class plugin
     
   }
 
+
+  /* Add possibility to stop remove process */
+  function allow_remove()
+  {
+    $reason= "";
+    return $reason;
+  }
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>