summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 316bc19)
raw | patch | inline | side by side (parent: 316bc19)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jun 2008 08:01:11 +0000 (08:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 25 Jun 2008 08:01:11 +0000 (08:01 +0000) |
-Support l,dc,o,ou aso.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11432 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11432 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_config.inc | patch | blob | history | |
gosa-core/include/functions.inc | patch | blob | history |
index db862c0f887929ba03f86b9105f767b07d44d86f..e800b61a90e1cb219d30e79d66d781566a7b33a5 100644 (file)
}
}
- /* remove base from dn */
- $val2 = str_replace($base,"",$val);
-
- /* Get every single ou */
- $str = preg_replace("/ou=/","|ou=",$val2);
- $elements = array_reverse(split("\|",$str));
-
- /* Save last array position */
- $last = &$arr;
-
- /* Get array depth */
- $cnt = count($elements);
+ /* Split dn into single department pieces.
+ */
+ $elements = array_reverse(split(",",preg_replace("/".normalizePreg($base)."$/","",$val)));
/* Add last ou element of current dn to our array */
+ $last = &$arr;
foreach($elements as $key => $ele){
- /* skip enpty */
+ /* skip empty */
if(empty($ele)) continue;
/* Extract department name */
- $elestr = preg_replace("/^ou=/","", $ele);
- $elestr = preg_replace("/,$/","",$elestr);
+ $elestr = trim(preg_replace("/^[^=]*+=/","", $ele),",");
/* Add to array */
- if($key == ($cnt-2)){
+ if($key == (count($elements)-1)){
$last[$elestr]['ENTRY'] = $val;
}
/* Add base entry */
$ret["/"]["ENTRY"] = $base;
$ret["/"]["SUB"] = $arr;
-
$this->idepartments= $this->generateDepartmentArray($ret,-1,$max_size);
}
/* Creates display friendly output from make_idepartments */
- function generateDepartmentArray($arr,$depth = -1,$max_size){
+ function generateDepartmentArray($arr,$depth = -1,$max_size)
+ {
$ret = array();
$depth ++;
index 102bc4f651deb945f68bd2f95413c7eff3f36599..e9444fbf396d664e89ea15d44cd3ee65a04ed68c 100644 (file)
function convert_department_dn($dn, $base = NULL)
{
global $config;
- $dep= "";
if($base == NULL){
$base = $config->current['BASE'];
$dn = preg_replace("/".normalizePreg($base)."$/i","",$dn);
if(empty($dn)) return("/");
- foreach (split(',', $dn) as $rdn){
-
- /* We're only interested in organizational units... */
- if (substr($rdn,0,3) == 'ou='){
- $dep= substr($rdn,3)."/$dep";
- }
- /* ... and location objects */
- if (substr($rdn,0,2) == 'l='){
- $dep= substr($rdn,2)."/$dep";
- }
+ $dep= "";
+ foreach (split(',', $dn) as $rdn){
+ $dep = preg_replace("/^[^=]+=/","",$rdn)."/".$dep;
}
/* Return and remove accidently trailing slashes */
- return rtrim($dep, "/");
+ return(trim($dep, "/"));
}