From 8d35c4632952e42ea88a207d60ce753413693620 Mon Sep 17 00:00:00 2001 From: cajus Date: Sun, 25 Jun 2006 09:23:08 +0000 Subject: [PATCH] Applied copy/move patches from trunk git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@3877 594d385d-05f5-0310-b6e9-bd551577e9d8 --- Changelog | 1 + include/class_plugin.inc | 14 +++++++------- .../admin/departments/class_departmentGeneric.inc | 11 ++++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Changelog b/Changelog index 7d147481a..4cdc9eb42 100644 --- a/Changelog +++ b/Changelog @@ -11,6 +11,7 @@ GOsa2 changelog - Fixed display of FAI partitions - Removed Quota warnings for existing accounts without quota limits - Worked around PHP4 session problems when creating new departments + - Fixed problems when moving around departments including a comma * gosa 2.5.1 - Fixed problems with NFS shares and terminals diff --git a/include/class_plugin.inc b/include/class_plugin.inc index 6b7eb8277..819fd85e2 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -666,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()); @@ -678,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); } @@ -686,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); } @@ -700,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(); @@ -728,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 */ diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 64d631deb..7433afbe4 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -373,6 +373,7 @@ class department extends plugin } else { $ldap->search('objectClass=gosaAdministrativeUnitTag', array('dn')); } + while ($attrs= $ldap->fetch()){ /* Skip self */ @@ -437,7 +438,7 @@ class department extends plugin echo "".$smarty->fetch(get_template_path('headers.tpl')); echo ""; - echo "

".sprintf(_("Moving '%s' to '%s'"),"".$src_dn."","".$dst_dn."")."

"; + echo "

".sprintf(_("Moving '%s' to '%s'"),"".@LDAP::fix($src_dn)."","".@LDAP::fix($dst_dn)."")."

"; /* Check if the destination entry exists */ @@ -446,9 +447,9 @@ class department extends plugin /* Check if destination exists - abort */ $ldap->cat($dst_dn, array('dn')); if ($ldap->fetch()){ - trigger_error("Recursive_move $dst_dn already exists.", + trigger_error("Recursive_move ".@LDAP::fix($dst_dn)." already exists.", E_USER_WARNING); - echo sprintf("Recursive_move: '%s' already exists", $dst_dn)."
"; + echo sprintf("Recursive_move: '%s' already exists", @LDAP::fix($dst_dn))."
"; return (FALSE); } @@ -473,10 +474,10 @@ class department extends plugin $dst= preg_replace("/".str_replace("\\","\\\\",$src_dn)."$/", "$dst_dn", $object); $dst= str_replace($src_dn,$dst_dn,$object); - echo ""._("Object").": $src
"; + echo ""._("Object").": ".@LDAP::fix($src)."
"; if (!$this->copy($src, $dst)){ - echo "
".sprintf(_("FAILED to copy %s, aborting operation"),$src)."
"; + echo "
".sprintf(_("FAILED to copy %s, aborting operation"),@LDAP::fix($src))."
"; return (FALSE); } -- 2.30.2