From: hickert Date: Thu, 3 Jan 2008 07:40:07 +0000 (+0000) Subject: Replaced hard coded department links with get_ou() calls X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c0d3a222f41c337ce2abdc0b45a1d0bac863dbee;p=gosa.git Replaced hard coded department links with get_ou() calls git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8187 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/html/getxls.php b/gosa-core/html/getxls.php index 5c2f13a07..a9427a3ca 100644 --- a/gosa-core/html/getxls.php +++ b/gosa-core/html/getxls.php @@ -80,7 +80,7 @@ function dump_ldap ($mode= 0) /* PEOPLE Get all peoples from this $dn and put them into the xls work sheet */ - case "ou=people," : + case get_people_ou() : $user = $ldap->gen_xls($dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage")); $intitul = array(_("Birthday").":", _("Sex").":", _("Surname")."/"._("Given name").":",_("Language").":"); @@ -114,7 +114,7 @@ function dump_ldap ($mode= 0) /* GROUPS Get all groups from th $dn and put them into the xls work sheet */ - case "ou=groups,": + case get_groups_ou(): /* Get group data */ $groups = $ldap->gen_xls($dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1); @@ -150,7 +150,7 @@ function dump_ldap ($mode= 0) /* SYSTEMS Get all systems from th $dn and put them into the xls work sheet */ - case "ou=systems,": + case get_ou('systemsou'): $name_section=_("Servers"); $computers= $ldap->gen_xls($dn,"(&(objectClass=*)(cn=*))",array("cn","description","uid")); @@ -277,10 +277,10 @@ function dump_ldap ($mode= 0) $dn = base64_decode($_GET['dn']); //data about users - $user= $ldap->gen_xls("ou=people,".$dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage")); + $user= $ldap->gen_xls( get_people_ou().$dn,"(objectClass=*)",array("uid","dateOfBirth","gender","givenName","preferredLanguage")); $user_intitul=array(_("Day of birth").":",_("Sex").":",_("Surname")."/"._("Given name").":",_("Language").":"); //data about groups - $groups= $ldap->gen_xls("ou=groups,".$dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1); + $groups= $ldap->gen_xls(get_groups_ou().$dn,"(objectClass=*)",array("cn","memberUid"),TRUE,1); $groups_intitul=array(_("Members").":"); //data about computers $computers= $ldap->gen_xls("ou=computers,".$dn,"(objectClass=*)",array("cn","description","uid")); diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 131c4a282..77ccf4d13 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -1034,14 +1034,28 @@ function get_ou($name) global $config; $map = array( "applicationou" => "ou=apps,", + "systemsou" => "ou=systems,", "serverou" => "ou=servers,ou=systems,", "terminalou" => "ou=terminals,ou=systems,", "workstationou" => "ou=workstations,ou=systems,", "printerou" => "ou=printers,ou=systems,", "phoneou" => "ou=phones,ou=systems,", "componentou" => "ou=netdevices,ou=systems,", + "blocklistou" => "ou=gofax,ou=systems,", + "incomingou" => "ou=incoming,", + "aclroleou" => "ou=aclroles,", "macroou" => "ou=macros,ou=asterisk,ou=configs,ou=systems,", "conferenceou" => "ou=conferences,ou=asterisk,ou=configs,ou=systems,", + + "faiou" => "ou=fai,ou=configs,ou=systems,", + "faiscriptou" => "ou=scripts,", + "faihookou" => "ou=hooks,", + "faitemplateou" => "ou=templates,", + "faivariableou" => "ou=variables,", + "faiprofileou" => "ou=profiles,", + "faipackageou" => "ou=packages,", + "faipartitionou"=> "ou=disk,", + "deviceou" => "ou=devices,", "mimetypeou" => "ou=mime,"); @@ -1052,6 +1066,7 @@ function get_ou($name) $ou = $map[$name]; return($ou); } else { + trigger_error("No department mapping found for type ".$name); return ""; } diff --git a/gosa-core/include/functions_FAI.inc b/gosa-core/include/functions_FAI.inc index 26c0a5726..d01cfbc7e 100644 --- a/gosa-core/include/functions_FAI.inc +++ b/gosa-core/include/functions_FAI.inc @@ -105,8 +105,8 @@ function get_all_releases_from_base($dn,$appendedName=false) { global $config; - if(!preg_match("/ou=fai,ou=configs,ou=systems,/",$dn)){ - $base = "ou=fai,ou=configs,ou=systems,".$dn; + if(!preg_match("/".normalizePreg(get_ou('faiou'))."/",$dn)){ + $base = get_ou('faiou').$dn; }else{ $base = $dn; } @@ -117,7 +117,7 @@ function get_all_releases_from_base($dn,$appendedName=false) $ldap->search("(objectClass=FAIbranch)",array("ou","dn")); while($attrs = $ldap->fetch()){ if($appendedName){ - $res[$attrs['dn']] = convert_department_dn(preg_replace("/,ou=fai,ou=configs,ou=system.*$/","",$attrs['dn'])); + $res[$attrs['dn']] = convert_department_dn(preg_replace("/,".normalizePreg(get_ou('faiou')).".*$/","",$attrs['dn'])); }else{ $res[$attrs['dn']] = $attrs['ou'][0]; } diff --git a/gosa-core/plugins/addons/ldapmanager/class_exportxls.inc b/gosa-core/plugins/addons/ldapmanager/class_exportxls.inc index 2f392faea..90bab709a 100644 --- a/gosa-core/plugins/addons/ldapmanager/class_exportxls.inc +++ b/gosa-core/plugins/addons/ldapmanager/class_exportxls.inc @@ -76,8 +76,8 @@ class xlsexport extends plugin } $smarty->assign("deplist", $bases); $smarty->assign("choicelist",array( get_people_ou() =>"users" , - "ou=groups," =>"groups" , - "ou=systems," =>"computers", + get_groups_ou() =>"groups" , + get_ou('systemsou') =>"computers", get_ou('serverou') =>"servers", "dc=addressbook," =>"addressbook")); diff --git a/gosa-core/plugins/admin/acl/class_aclManagement.inc b/gosa-core/plugins/admin/acl/class_aclManagement.inc index d88540206..7a1b2ab2b 100644 --- a/gosa-core/plugins/admin/acl/class_aclManagement.inc +++ b/gosa-core/plugins/admin/acl/class_aclManagement.inc @@ -468,7 +468,7 @@ class aclManagement extends plugin /* Fetch following structures, this will be used if !$SubSearch */ $fetch_this = array( "ME" => array("TYPE" => "cat" , "FLAGS" => GL_SIZELIMIT ,"BASE"=>""), - "SYSTEMS" => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>"ou=systems,"), + "SYSTEMS" => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_ou('systemsou')), "APPS" => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_ou('applicationou')), "PEOPLE" => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_people_ou()), "GROUPS" => array("TYPE" => "search" , "FLAGS" => GL_SIZELIMIT | GL_SUBSEARCH ,"BASE"=>get_groups_ou())); @@ -490,7 +490,7 @@ class aclManagement extends plugin }else{ - $tmp_roles = get_list($FilterRoles, "acl", "ou=aclroles,".$base, $Attrs,GL_SIZELIMIT); + $tmp_roles = get_list($FilterRoles, "acl", get_ou('aclroleou').$base, $Attrs,GL_SIZELIMIT); foreach($tmp_roles as $entry){ $res[] = $entry; diff --git a/gosa-core/plugins/admin/acl/tabs_acl_role.inc b/gosa-core/plugins/admin/acl/tabs_acl_role.inc index b1132357d..3c119d164 100644 --- a/gosa-core/plugins/admin/acl/tabs_acl_role.inc +++ b/gosa-core/plugins/admin/acl/tabs_acl_role.inc @@ -15,7 +15,7 @@ class aclroletab extends tabs /* Check for new 'dn', in order to propagate the 'dn' to all plugins */ - $new_dn= 'cn='.$baseobject->cn.",ou=aclroles,".$baseobject->base; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('aclroleou').$baseobject->base; if ($this->dn != $new_dn){ diff --git a/gosa-core/plugins/admin/fai/class_askClassName.inc b/gosa-core/plugins/admin/fai/class_askClassName.inc index 4225869cc..54ec897fb 100644 --- a/gosa-core/plugins/admin/fai/class_askClassName.inc +++ b/gosa-core/plugins/admin/fai/class_askClassName.inc @@ -45,7 +45,7 @@ class askClassName extends plugin * With a second search detect all object that belong to the different ous. */ - $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $base = get_ou('faiou').$_SESSION['CurrentMainBase']; if($faifilter['branch'] != "main"){ $base = $faifilter['branch']; } diff --git a/gosa-core/plugins/admin/fai/class_faiManagement.inc b/gosa-core/plugins/admin/fai/class_faiManagement.inc index 13873f954..3fea1c5c0 100644 --- a/gosa-core/plugins/admin/fai/class_faiManagement.inc +++ b/gosa-core/plugins/admin/fai/class_faiManagement.inc @@ -456,7 +456,7 @@ class faiManagement extends plugin $name = $br[$bb]; $ldap->cd($bb); $ldap->recursive_remove(); - $ldap->cd(preg_replace('/,ou=fai,ou=configs,ou=systems,/', ','.get_ou('applicationou'), $bb)); + $ldap->cd(preg_replace('/,'.get_ou('faiou').'/', ','.get_ou('applicationou'), $bb)); $ldap->recursive_remove(); $this->DivListFai->selectedBranch = "main"; @@ -488,7 +488,7 @@ class faiManagement extends plugin $name = $_POST['BranchName']; $is_ok = true; $smarty->assign("BranchName",$name); - $base= "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase; + $base= get_ou('faiou').$this->DivListFai->selectedBase; /* Check used characters */ if(preg_match("/[^0-9a-z \ö\ä\ü\.-_:,]/i",$name)){ @@ -555,11 +555,11 @@ class faiManagement extends plugin } } - $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/",get_ou('applicationou'),$baseToUse); - $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/",get_ou('applicationou'),"ou=".$name.",".$baseToUse) ; + $appsrc = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('applicationou'),$baseToUse); + $appdst = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('applicationou'),"ou=".$name.",".$baseToUse) ; - $mimesrc = preg_replace("/ou=fai,ou=configs,ou=systems,/",get_ou('mimetypeou'),$baseToUse); - $mimedst = preg_replace("/ou=fai,ou=configs,ou=systems,/",get_ou('mimetypeou'),"ou=".$name.",".$baseToUse) ; + $mimesrc = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('mimetypeou'),$baseToUse); + $mimedst = preg_replace("/".normalizePreg(get_ou('faiou'))."/",get_ou('mimetypeou'),"ou=".$name.",".$baseToUse) ; /* Check if source depeartments exist */ foreach(array($baseToUse,$appsrc,$mimesrc) as $dep){ @@ -861,12 +861,12 @@ class faiManagement extends plugin function get_used_snapshot_bases() { $tmp = array(); - $types = array("hooks","scripts","disk","packages","profiles","templates","variables"); + $types = array("faipartitionou","faiscriptou","faitemplateou","faihookou","faiprofileou","faivariableou","faipackageou"); foreach($types as $type){ if($this->DivListFai->selectedBranch == "main"){ - $tmp[] = "ou=".$type.",ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase; + $tmp[] = get_ou($type).get_ou('faiou').$this->DivListFai->selectedBase; }else{ - $tmp[] = "ou=".$type.",".$this->DivListFai->selectedBranch; + $tmp[] = get_ou($type).$this->DivListFai->selectedBranch; } } return($tmp); @@ -914,13 +914,13 @@ class faiManagement extends plugin $this->objects = array(); /* Get base */ - $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase; + $base = get_ou('faiou').$this->DivListFai->selectedBase; if($this->DivListFai->selectedBranch != "main"){ $br = $this->getBranches(); if(isset($br[$this->DivListFai->selectedBranch])){ $base = $this->DivListFai->selectedBranch; }else{ - $base = "ou=fai,ou=configs,ou=systems,".$this->DivListFai->selectedBase; + $base = get_ou('faiou').$this->DivListFai->selectedBase; } } $this->base = $base; @@ -932,13 +932,13 @@ class faiManagement extends plugin * Generate List of Partitions,Hooks,Scripts,Templates,Profiles ... */ $ObjectTypes = array( - "FAIpartitionTable" => array("OU"=>"ou=disk," , "CHKBOX"=>"ShowPartitions" ,"ACL" => "faiPartitionTable"), - "FAIpackageList" => array("OU"=>"ou=packages," , "CHKBOX"=>"ShowPackages" ,"ACL" => "faiPackage"), - "FAIscript" => array("OU"=>"ou=scripts," , "CHKBOX"=>"ShowScripts" ,"ACL" => "faiScript"), - "FAIvariable" => array("OU"=>"ou=variables," , "CHKBOX"=>"ShowVariables" ,"ACL" => "faiVariable"), - "FAIhook" => array("OU"=>"ou=hooks," , "CHKBOX"=>"ShowHooks" ,"ACL" => "faiHook"), - "FAIprofile" => array("OU"=>"ou=profiles," , "CHKBOX"=>"ShowProfiles" ,"ACL" => "faiProfile"), - "FAItemplate" => array("OU"=>"ou=templates," , "CHKBOX"=>"ShowTemplates" ,"ACL" => "faiTemplate")); + "FAIpartitionTable" => array("OU"=> get_ou('faipartitionou') , "CHKBOX"=>"ShowPartitions" ,"ACL" => "faiPartitionTable"), + "FAIpackageList" => array("OU"=> get_ou('faipackageou') , "CHKBOX"=>"ShowPackages" ,"ACL" => "faiPackage"), + "FAIscript" => array("OU"=> get_ou('faiscriptou') , "CHKBOX"=>"ShowScripts" ,"ACL" => "faiScript"), + "FAIvariable" => array("OU"=> get_ou('faivariableou') , "CHKBOX"=>"ShowVariables" ,"ACL" => "faiVariable"), + "FAIhook" => array("OU"=> get_ou('faihookou') , "CHKBOX"=>"ShowHooks" ,"ACL" => "faiHook"), + "FAIprofile" => array("OU"=> get_ou('faiprofileou') , "CHKBOX"=>"ShowProfiles" ,"ACL" => "faiProfile"), + "FAItemplate" => array("OU"=> get_ou('faitemplateou') , "CHKBOX"=>"ShowTemplates" ,"ACL" => "faiTemplate")); $filter = ""; foreach($ObjectTypes as $key => $data){ diff --git a/gosa-core/plugins/admin/fai/class_faiPackage.inc b/gosa-core/plugins/admin/fai/class_faiPackage.inc index bcd5eaaf6..c3a3fe971 100644 --- a/gosa-core/plugins/admin/fai/class_faiPackage.inc +++ b/gosa-core/plugins/admin/fai/class_faiPackage.inc @@ -185,7 +185,7 @@ class faiPackage extends plugin if(!$this->is_account){ /* Assemble release name */ - $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']); + $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $_SESSION['faifilter']['branch']); $tmp= preg_replace('/ou=/', '', $tmp); $rev= array_reverse(split(',', $tmp)); $this->FAIdebianRelease= ""; @@ -468,7 +468,7 @@ class faiPackage extends plugin /* Assemble release name */ if($this->FAIdebianRelease == "ClearFromCopyPaste"){ - $tmp= preg_replace('/,ou=fai,ou=configs,ou=systems,.*$/', '', $_SESSION['faifilter']['branch']); + $tmp= preg_replace('/,'.normalizePreg(get_ou('faiou')).'.*$/', '', $_SESSION['faifilter']['branch']); $tmp= preg_replace('/ou=/', '', $tmp); $rev= array_reverse(split(',', $tmp)); $this->FAIdebianRelease= ""; diff --git a/gosa-core/plugins/admin/fai/class_faiProfile.inc b/gosa-core/plugins/admin/fai/class_faiProfile.inc index 4b5daea9b..6c1fea191 100644 --- a/gosa-core/plugins/admin/fai/class_faiProfile.inc +++ b/gosa-core/plugins/admin/fai/class_faiProfile.inc @@ -409,7 +409,7 @@ class faiProfile extends plugin if($base == "main"){ $base =$_SESSION['CurrentMainBase']; } - $base = "ou=profiles,".$base; + $base = get_ou('faiprofileou').$base; $ldap->cd($base); if ($this->old_cn == ""){ diff --git a/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc b/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc index 2d9b09764..1dbcad7f0 100644 --- a/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc +++ b/gosa-core/plugins/admin/fai/class_faiProfileEntry.inc @@ -21,7 +21,7 @@ class faiProfileEntry extends plugin plugin::plugin ($config, $dn); /* Search only in fai tree */ - $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $base = get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ $base = $_SESSION['faifilter']['branch']; } @@ -85,7 +85,7 @@ class faiProfileEntry extends plugin /* If no search filter is set, create one */ if (!is_global("SUBfaifilter")){ - $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'], "Sregex" => "*"); + $SUBfaifilter= array("base" => get_ou('faiou').$_SESSION['CurrentMainBase'], "Sregex" => "*"); $SUBfaifilter['SShowTemplates'] = true; $SUBfaifilter['SShowScripts'] = true; $SUBfaifilter['SShowHooks'] = true; diff --git a/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc b/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc index a9bfbb840..1fde58e56 100644 --- a/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc +++ b/gosa-core/plugins/admin/fai/class_faiSummaryTab.inc @@ -41,13 +41,13 @@ class faiSummaryTab extends plugin{ /* Base object configuration */ $this->objs = array( - "FAIscript" => array( "Image" =>"images/fai_script.png", "Name"=>_("Scripts") ,"Tree" =>"ou=scripts,") , - "FAIhook" => array( "Image" =>"images/fai_hook.png" , "Name"=>_("Hooks") ,"Tree" =>"ou=hooks,"), - "FAIvariable" => array( "Image" =>"images/fai_variable.png", "Name"=>_("Variables") ,"Tree" =>"ou=variables,") , - "FAItemplate" => array( "Image" =>"images/fai_template.png", "Name"=>_("Templates") ,"Tree" =>"ou=templates,") , - "FAIpartitionTable" => array( "Image" =>"images/fai_partitionTable.png","Name"=>_("Partition table") ,"Tree" =>"ou=disk,") , - "FAIpackageList" => array( "Image" =>"images/fai_packages.png", "Name"=>_("Package list") ,"Tree" =>"ou=packages,") , - "FAIprofile" => array( "Image" =>"images/fai_profile.png", "Name"=>_("Profiles") ,"Tree" =>"ou=profiles,")); + "FAIscript" => array( "Image" =>"images/fai_script.png", "Name"=>_("Scripts") ,"Tree" =>get_ou('faiscriptou')) , + "FAIhook" => array( "Image" =>"images/fai_hook.png" , "Name"=>_("Hooks") ,"Tree" =>get_ou('faihookou')), + "FAIvariable" => array( "Image" =>"images/fai_variable.png", "Name"=>_("Variables") ,"Tree" =>get_ou('faivariableou')) , + "FAItemplate" => array( "Image" =>"images/fai_template.png", "Name"=>_("Templates") ,"Tree" =>get_ou('faitemplateou')) , + "FAIpartitionTable" => array( "Image" =>"images/fai_partitionTable.png","Name"=>_("Partition table") ,"Tree" =>get_ou('faipartitionou')) , + "FAIpackageList" => array( "Image" =>"images/fai_packages.png", "Name"=>_("Package list") ,"Tree" =>get_ou('faipackageou')) , + "FAIprofile" => array( "Image" =>"images/fai_profile.png", "Name"=>_("Profiles") ,"Tree" =>get_ou('faiprofileou'))); } @@ -70,7 +70,7 @@ class faiSummaryTab extends plugin{ /* Get Classes and release */ $this->Classes = $this->parent->by_object['faiProfile']->FAIclasses; $this->base = $this->parent->by_object['faiProfile']->base; - $str = preg_replace("/^.*ou=profiles,/","",$this->dn); + $str = preg_replace("/^.*".normalizePreg(get_ou('faiprofileou'))."/","",$this->dn); /* Check if parent tab is work tab */ }elseif(isset($this->parent->by_name['workstartup'])){ diff --git a/gosa-core/plugins/admin/fai/tabsHook.inc b/gosa-core/plugins/admin/fai/tabsHook.inc index 1857854b3..d431eea1e 100644 --- a/gosa-core/plugins/admin/fai/tabsHook.inc +++ b/gosa-core/plugins/admin/fai/tabsHook.inc @@ -21,10 +21,10 @@ class tabsHook extends tabs { $baseobject= $this->by_object['faiHook']; - $new_dn= 'cn='.$baseobject->cn.",ou=hooks,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('faihookou').get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",ou=hooks,".$_SESSION['faifilter']['branch']; + $new_dn ='cn='.$baseobject->cn.",".get_ou('faihookou').$_SESSION['faifilter']['branch']; } if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-core/plugins/admin/fai/tabsPackage.inc b/gosa-core/plugins/admin/fai/tabsPackage.inc index 8731835ef..6a3d58158 100644 --- a/gosa-core/plugins/admin/fai/tabsPackage.inc +++ b/gosa-core/plugins/admin/fai/tabsPackage.inc @@ -22,9 +22,9 @@ class tabsPackage extends tabs { $baseobject= $this->by_object['faiPackage']; - $new_dn= 'cn='.$baseobject->cn.",ou=packages,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('faipackageou').get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",ou=packages,".$_SESSION['faifilter']['branch']; + $new_dn ='cn='.$baseobject->cn.",".get_ou('faipackageou').$_SESSION['faifilter']['branch']; } if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-core/plugins/admin/fai/tabsPartition.inc b/gosa-core/plugins/admin/fai/tabsPartition.inc index 9d2312d57..56bd1d2f4 100644 --- a/gosa-core/plugins/admin/fai/tabsPartition.inc +++ b/gosa-core/plugins/admin/fai/tabsPartition.inc @@ -22,10 +22,10 @@ class tabsPartition extends tabs { $baseobject= $this->by_object['faiPartitionTable']; - $new_dn= 'cn='.$baseobject->cn.",ou=disk,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('faipartitionou').get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",ou=disk,".$_SESSION['faifilter']['branch']; + $new_dn ='cn='.$baseobject->cn.",".get_ou('faipartitionou').$_SESSION['faifilter']['branch']; } if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-core/plugins/admin/fai/tabsProfile.inc b/gosa-core/plugins/admin/fai/tabsProfile.inc index cbc3abd94..3480b46af 100644 --- a/gosa-core/plugins/admin/fai/tabsProfile.inc +++ b/gosa-core/plugins/admin/fai/tabsProfile.inc @@ -22,10 +22,10 @@ class tabsProfile extends tabs { $baseobject= $this->by_object['faiProfile']; - $new_dn= 'cn='.$baseobject->cn.",ou=profiles,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('faiprofileou').get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",ou=profiles,".$_SESSION['faifilter']['branch']; + $new_dn ='cn='.$baseobject->cn.",".get_ou('faiprofileou').$_SESSION['faifilter']['branch']; } if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-core/plugins/admin/fai/tabsScript.inc b/gosa-core/plugins/admin/fai/tabsScript.inc index 28ebd224a..1eac83c38 100644 --- a/gosa-core/plugins/admin/fai/tabsScript.inc +++ b/gosa-core/plugins/admin/fai/tabsScript.inc @@ -22,10 +22,10 @@ class tabsScript extends tabs { $baseobject= $this->by_object['faiScript']; - $new_dn= 'cn='.$baseobject->cn.",ou=scripts,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('faiscriptou').get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",ou=scripts,".$_SESSION['faifilter']['branch']; + $new_dn ='cn='.$baseobject->cn.",".get_ou('faiscriptou').$_SESSION['faifilter']['branch']; } if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-core/plugins/admin/fai/tabsTemplate.inc b/gosa-core/plugins/admin/fai/tabsTemplate.inc index 2ff58199b..eb674e894 100644 --- a/gosa-core/plugins/admin/fai/tabsTemplate.inc +++ b/gosa-core/plugins/admin/fai/tabsTemplate.inc @@ -22,10 +22,10 @@ class tabsTemplate extends tabs { $baseobject= $this->by_object['faiTemplate']; - $new_dn= 'cn='.$baseobject->cn.",ou=templates,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('faitemplateou').get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",ou=templates,".$_SESSION['faifilter']['branch']; + $new_dn ='cn='.$baseobject->cn.",".get_ou('faitemplateou').$_SESSION['faifilter']['branch']; } if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-core/plugins/admin/fai/tabsVariable.inc b/gosa-core/plugins/admin/fai/tabsVariable.inc index c872f2d9b..2958a11f5 100644 --- a/gosa-core/plugins/admin/fai/tabsVariable.inc +++ b/gosa-core/plugins/admin/fai/tabsVariable.inc @@ -22,10 +22,10 @@ class tabsVariable extends tabs { $baseobject= $this->by_object['faiVariable']; - $new_dn= 'cn='.$baseobject->cn.",ou=variables,ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; + $new_dn= 'cn='.$baseobject->cn.",".get_ou('faivariableou').get_ou('faiou').$_SESSION['CurrentMainBase']; if($_SESSION['faifilter']['branch']!="main"){ - $new_dn ='cn='.$baseobject->cn.",ou=variables,".$_SESSION['faifilter']['branch']; + $new_dn ='cn='.$baseobject->cn.",".get_ou('faivariableou').$_SESSION['faifilter']['branch']; } if ($this->dn != $new_dn && $this->dn != "new"){ diff --git a/gosa-core/plugins/admin/groups/class_groupGeneric.inc b/gosa-core/plugins/admin/groups/class_groupGeneric.inc index 095d3be27..133cf5650 100644 --- a/gosa-core/plugins/admin/groups/class_groupGeneric.inc +++ b/gosa-core/plugins/admin/groups/class_groupGeneric.inc @@ -823,7 +823,7 @@ class group extends plugin /* Check for used 'cn' */ $ldap= $this->config->get_ldap_link(); if(($this->cn != $this->orig_cn) || ($this->orig_dn == "new")){ - $ldap->cd("ou=groups,".$this->base); + $ldap->cd(get_groups_ou().$this->base); $ldap->ls("(&(|(objectClass=gosaGroupOfNames)(objectClass=posixGroup))(cn=$this->cn))",get_groups_ou().$this->base,array("cn")); if ($ldap->count() != 0){ $message[]= _("Value specified as 'Name' is already used."); diff --git a/gosa-core/plugins/admin/systems/class_printGeneric.inc b/gosa-core/plugins/admin/systems/class_printGeneric.inc index 585d5e16a..1a527e963 100644 --- a/gosa-core/plugins/admin/systems/class_printGeneric.inc +++ b/gosa-core/plugins/admin/systems/class_printGeneric.inc @@ -99,8 +99,8 @@ class printgeneric extends plugin } else { /* Set base and check if the extracted base exists */ - if(preg_match("/ou=incoming,/",$this->dn)){ - $this->base= preg_replace("/ou=incoming,/","",dn2base($this->dn)); + if(preg_match("/".normalizePreg('incomingou')."/",$this->dn)){ + $this->base= preg_replace("/".normalizePreg('incomingou')."/","",dn2base($this->dn)); }else{ $this->base= preg_replace("/".normalizePreg(get_ou('printerou')).",/","",dn2base($this->dn)); } @@ -825,7 +825,7 @@ class printgeneric extends plugin } /* Ensure to create a new object */ - if(preg_match("/ou=incoming,/",$this->orig_dn)){ + if(preg_match("/".normalizePreg('incomingou')."/",$this->orig_dn)){ $this->orig_dn = "new"; } diff --git a/gosa-core/plugins/admin/systems/class_servGeneric.inc b/gosa-core/plugins/admin/systems/class_servGeneric.inc index 8497ed865..4bc47245c 100644 --- a/gosa-core/plugins/admin/systems/class_servGeneric.inc +++ b/gosa-core/plugins/admin/systems/class_servGeneric.inc @@ -308,7 +308,7 @@ class servgeneric extends plugin if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ if ($attrs['dn'] != $this->orig_dn){ - if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,ou=incoming,/",$attrs['dn']) && preg_match("/,".get_ou('serverou')."/",$attrs['dn'])){ + if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,".get_ou('incomingou')."/",$attrs['dn']) && preg_match("/,".get_ou('serverou')."/",$attrs['dn'])){ $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); break; } diff --git a/gosa-core/plugins/admin/systems/class_systemManagement.inc b/gosa-core/plugins/admin/systems/class_systemManagement.inc index 5e9b28605..205e70316 100644 --- a/gosa-core/plugins/admin/systems/class_systemManagement.inc +++ b/gosa-core/plugins/admin/systems/class_systemManagement.inc @@ -898,7 +898,7 @@ class systems extends plugin $tabs = array( "terminal" => get_ou('terminalou'), "workstation" => get_ou('workstationou'), - "incoming" => "ou=incoming,", + "incoming" => get_ou('incomingou'), "server" => get_ou('serverou'), "printer" => get_ou('printerou'), "phone" => get_ou('phoneou'), @@ -1023,7 +1023,7 @@ class systems extends plugin /* Search for incoming objects */ $filter = "(|(&".$userregex."(objectClass=goHard)(cn=".$this->DivListSystem->Regex.")))"; - $res = array_merge($res,get_list($filter,$sys_categories,"ou=incoming","ou=incoming,".$base,$sys_attrs, GL_NONE | GL_SIZELIMIT)); + $res = array_merge($res,get_list($filter,$sys_categories, get_ou('incomingou'),get_ou('incomingou').$base,$sys_attrs, GL_NONE | GL_SIZELIMIT)); /* Get all gotoTerminal's */ foreach ($res as $value){ @@ -1045,7 +1045,7 @@ class systems extends plugin } /* check if current object is a new one */ - if (preg_match ("/,ou=incoming,/i", $tmp)){ + if (preg_match ("/,".get_ou('incomingou')."/i", $tmp)){ if (in_array_ics('gotoTerminal', $value['objectClass'])){ $add= "- "._("New terminal"); }elseif (in_array_ics('gotoWorkstation', $value['objectClass'])){ diff --git a/gosa-core/plugins/admin/systems/class_terminalGeneric.inc b/gosa-core/plugins/admin/systems/class_terminalGeneric.inc index ac43e3500..3f3f258fe 100644 --- a/gosa-core/plugins/admin/systems/class_terminalGeneric.inc +++ b/gosa-core/plugins/admin/systems/class_terminalGeneric.inc @@ -471,7 +471,7 @@ class termgeneric extends plugin } if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ - if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".normalizePreg(get_ou('incomingou'))."/", $ldap->getDN())){ continue; } else { if ($attrs['dn'] != $this->orig_dn){ diff --git a/gosa-core/plugins/admin/systems/class_workstationGeneric.inc b/gosa-core/plugins/admin/systems/class_workstationGeneric.inc index 73333c4d1..1c56e8841 100644 --- a/gosa-core/plugins/admin/systems/class_workstationGeneric.inc +++ b/gosa-core/plugins/admin/systems/class_workstationGeneric.inc @@ -451,7 +451,7 @@ class workgeneric extends plugin } if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ - if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,ou=incoming,/", $ldap->getDN())){ + if (preg_match("/cn=dhcp,/",$attrs['dn']) || preg_match ("/,".get_ou('incomingou')."/", $ldap->getDN())){ continue; } else { if ($attrs['dn'] != $this->orig_dn){ diff --git a/gosa-core/plugins/admin/systems/class_workstationStartup.inc b/gosa-core/plugins/admin/systems/class_workstationStartup.inc index 0e06a56f3..9e9a4732d 100644 --- a/gosa-core/plugins/admin/systems/class_workstationStartup.inc +++ b/gosa-core/plugins/admin/systems/class_workstationStartup.inc @@ -925,7 +925,7 @@ class workstartup extends plugin $str = ""; $tmp = split("\/",$release); $tmp = array_reverse($tmp); - $base = "ou=fai,ou=configs,ou=systems,"; + $base = get_ou('faiou'); foreach($tmp as $departmentname){ $str .= ",ou=".$departmentname; } diff --git a/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc b/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc index 19284661d..bbb194262 100644 --- a/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc +++ b/gosa-core/plugins/gofax/blocklists/class_blocklistGeneric.inc @@ -209,7 +209,7 @@ class blocklistGeneric extends plugin } if ($this->dn == 'new'){ $ldap= $this->config->get_ldap_link(); - $ldap->cd ("ou=gofax,ou=systems,".$this->config->current["BASE"]); + $ldap->cd (get_ou('blocklistou').$this->config->current["BASE"]); $ldap->search ("(&(|(objectClass=goFaxSBlock)(objectClass=goFaxRBlock))(cn=".$this->cn."))", array("cn")); if ($ldap->count() != 0){ $message[]= _("Specified name is already used."); diff --git a/gosa-core/plugins/gofax/blocklists/class_blocklistManagement.inc b/gosa-core/plugins/gofax/blocklists/class_blocklistManagement.inc index f9b19ea2a..c7e1175c6 100644 --- a/gosa-core/plugins/gofax/blocklists/class_blocklistManagement.inc +++ b/gosa-core/plugins/gofax/blocklists/class_blocklistManagement.inc @@ -346,7 +346,7 @@ class blocklist extends plugin /* Return departments, that will be included within snapshot detection */ function get_used_snapshot_bases() { - return(array("ou=gofax,ou=systems,". $this->DivListBlocklist->selectedBase)); + return(array(get_ou('blocklistou').$this->DivListBlocklist->selectedBase)); } @@ -367,7 +367,7 @@ class blocklist extends plugin if($SubSearch){ $Flags |= GL_SUBSEARCH; }else{ - $base = "ou=gofax,ou=systems,".$base; + $base = get_ou('blocklistou').$base; } /* Create filter */ diff --git a/gosa-core/plugins/gofax/blocklists/tabs_blocklist.inc b/gosa-core/plugins/gofax/blocklists/tabs_blocklist.inc index 9293903e1..32a674705 100644 --- a/gosa-core/plugins/gofax/blocklists/tabs_blocklist.inc +++ b/gosa-core/plugins/gofax/blocklists/tabs_blocklist.inc @@ -15,7 +15,7 @@ class faxblocktabs extends tabs $baseobject= $this->by_object['blocklistGeneric']; /* Check for new 'dn', in order to propagate the 'dn' to all plugins */ - $new_dn= "cn=".$baseobject->cn.",ou=gofax,ou=systems,".$baseobject->base; + $new_dn= "cn=".$baseobject->cn.",".get_ou('blocklistou').$baseobject->base; /* Move group? */ if ($this->dn != $new_dn){ diff --git a/gosa-core/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/gosa-core/plugins/gofon/conference/class_phoneConferenceGeneric.inc index e0364dc54..4f8d0d9d8 100644 --- a/gosa-core/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/gosa-core/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -119,9 +119,8 @@ class conference extends plugin } } else { - /* The base is something like this - "cn=Confis,ou=conferences,ou=asterisk,ou=configs,ou=systems," */ - $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,[^,]+,[^,]+,/", "", $this->dn); + /* Get base */ + $this->base = preg_replace ("/^[^,]+,".normalizePreg(get_ou('conferenceou'))."/i","",$this->dn);; } $this->goFonConferenceOwner=$this->ui->dn; @@ -407,7 +406,7 @@ class conference extends plugin if($this->old_cn != $this->cn || $this->base != $this->old_base){ $ldap = $this->config->get_ldap_link(); - $ldap->cd("ou=conferences,ou=asterisk,ou=configs,ou=systems,".$this->base); + $ldap->cd(get_ou('conferenceou').$this->base); $ldap->search("(&(objectClass=goFonConference)(cn=".$this->cn."))",array("cn")); if($ldap->count()){ $message[] =_("There is already a conference with this name in the current tree."); diff --git a/gosa-core/plugins/gofon/conference/tabs_conference.inc b/gosa-core/plugins/gofon/conference/tabs_conference.inc index 5b58065ee..6b0c545e0 100644 --- a/gosa-core/plugins/gofon/conference/tabs_conference.inc +++ b/gosa-core/plugins/gofon/conference/tabs_conference.inc @@ -22,7 +22,7 @@ class conferencetabs extends tabs function save($ignore_account= FALSE) { $baseobject= $this->by_object['conference']; - $new_dn= 'cn='.$baseobject->cn.',ou=conferences,ou=asterisk,ou=configs,ou=systems,'.$baseobject->base; + $new_dn= 'cn='.$baseobject->cn.','.get_ou('conferenceou').$baseobject->base; if(strtolower($this->dn)==strtolower($new_dn)){ $this->dn=$new_dn;