From: hickert Date: Wed, 4 Oct 2006 10:35:35 +0000 (+0000) Subject: Fixed selfmade ldap_explode_dn function X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=848bee2a127055dff84d46aa6d9975d707fed3af;p=gosa.git Fixed selfmade ldap_explode_dn function git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4849 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/functions.inc b/include/functions.inc index e3254ed35..6eda98aa4 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -2194,6 +2194,7 @@ function gosa_ldap_explode_dn($dn,$config = NULL,$verify_in_ldap=false) $Diff = ldap_explode_dn($dn,0); /* Lets start */ + $called = false; while(preg_match("/,/",$dn) && $next && $cnt < $max){ $cnt ++; @@ -2203,6 +2204,8 @@ function gosa_ldap_explode_dn($dn,$config = NULL,$verify_in_ldap=false) $object = preg_replace("/[,].*$/","",$dn); $dn = preg_replace("/^[^,]+,/","",$dn); + $called = true; + /* Check if current dn is valid */ if($ldap!=NULL){ $ldap->cd($dn); @@ -2220,7 +2223,10 @@ function gosa_ldap_explode_dn($dn,$config = NULL,$verify_in_ldap=false) } /* Append the rest */ - $ret[] = $keep.$dn; + $test = $keep.$dn; + if($called && !empty($test)){ + $ret[] = $keep.$dn; + } $ret['count'] = count($ret) - 1; $diff = array_diff($ret,$Diff);