summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7e65ad0)
raw | patch | inline | side by side (parent: 7e65ad0)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 13 Apr 2006 14:02:48 +0000 (14:02 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 13 Apr 2006 14:02:48 +0000 (14:02 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3044 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_config.inc | patch | blob | history | |
include/class_ldap.inc | patch | blob | history | |
include/functions.inc | patch | blob | history |
index 4b26e2607cf4838403bbfe4c9af436481e77fbf8..0a8e35a4223b361f24c04604796fbf788fdbc1fd 100644 (file)
--- a/include/class_config.inc
+++ b/include/class_config.inc
$this->idepartments= array();
- /* Create multidimensional array, with all departments.
- */
+ /* Create multidimensional array, with all departments. */
foreach ($this->departments as $key => $val){
/* remove base from dn */
$this->idepartments= $this->generateDepartmentArray($ret,-1,$max_size);
}
- /* Creates display friendly output from make_idepartments */
- function generateDepartmentArray($arr,$depth = -1,$max_size){
- $ret = array();
- $depth ++;
-
- /* Walk through array */
- foreach($arr as $name => $entries){
-
- /* If this department is the last in the current tree position
- * remove it, to avoid generating output for it */
- if(count($entries['SUB'])==0){
- unset($entries['SUB']);
- }
-
- /* Fix name, if it contains a replace tag */
- $name= @ldap::fix($name);
-
- /* Check if current name is too long, then cut it */
- if(strlen($name)> $max_size){
- $name = substr($name,0,($max_size-3))." ...";
- }
-
- /* Append the name to the list */
- if(isset($entries['ENTRY'])){
- $a = "";
- for($i = 0 ; $i < $depth ; $i ++){
- $a.=" ";
- }
- $ret[$entries['ENTRY']]=$a." ".$name;
- }
- /* For debugging
- if(isset($entries['ENTRY'])){
- $a = "";
- for($i = 0 ; $i < $depth ; $i ++){
- $a.=" |";
- }
-
- if(!isset($entries['SUB'])){
- $ret[$entries['ENTRY']]=$a."- ".$name;
- }else{
- $ret[$entries['ENTRY']]=$a."#"." ".$name;
- }
- }
- */
-
- /* recursive add of subdepartments */
- if(isset($entries['SUB'])){
- $ret = array_merge($ret,$this->generateDepartmentArray($entries['SUB'],$depth,$max_size));
- }
- }
-
- return($ret);
- }
+ /* Creates display friendly output from make_idepartments */
+ function generateDepartmentArray($arr,$depth = -1,$max_size){
+ $ret = array();
+ $depth ++;
+
+ /* Walk through array */
+ foreach($arr as $name => $entries){
+
+ /* If this department is the last in the current tree position
+ * remove it, to avoid generating output for it */
+ if(count($entries['SUB'])==0){
+ unset($entries['SUB']);
+ }
+
+ /* Fix name, if it contains a replace tag */
+ $name= @ldap::fix($name);
+
+ /* Check if current name is too long, then cut it */
+ if(mb_strlen($name, 'UTF-8')> $max_size){
+ $name = mb_substr($name,0,($max_size-3), 'UTF-8')." ...";
+ }
+
+ /* Append the name to the list */
+ if(isset($entries['ENTRY'])){
+ $a = "";
+ for($i = 0 ; $i < $depth ; $i ++){
+ $a.=" ";
+ }
+ $ret[$entries['ENTRY']]=$a." ".$name;
+ }
+ /* For debugging
+ if(isset($entries['ENTRY'])){
+ $a = "";
+ for($i = 0 ; $i < $depth ; $i ++){
+ $a.=" |";
+ }
+
+ if(!isset($entries['SUB'])){
+ $ret[$entries['ENTRY']]=$a."- ".$name;
+ }else{
+ $ret[$entries['ENTRY']]=$a."#"." ".$name;
+ }
+ }
+ */
+
+ /* recursive add of subdepartments */
+ if(isset($entries['SUB'])){
+ $ret = array_merge($ret,$this->generateDepartmentArray($entries['SUB'],$depth,$max_size));
+ }
+ }
+
+ return($ret);
+ }
/* This function returns all available Shares defined in this ldap
* There are two ways to call this function, if listboxEntry is true
diff --git a/include/class_ldap.inc b/include/class_ldap.inc
index ad98c710bc000e74412c8fdcf86dc01b83bbc6e3..8f64c9a8d0a5302e71d6d83fac044e82eb0623e7 100644 (file)
--- a/include/class_ldap.inc
+++ b/include/class_ldap.inc
if ($target == $this->basedn){
return;
}
-echo "FIXME";
- $l= array_reverse(explode(",", preg_replace("/,".$this->basedn."/", "", $target)));
+
+ $real_path= substr($target, 0, strlen($target) - strlen($this->basedn) -1 );
+ $l= array_reverse(ldap_explode_dn($real_path,0));
+ unset($l['count']);
$cdn= $this->basedn;
+
foreach ($l as $part){
$cdn= "$part,$cdn";
diff --git a/include/functions.inc b/include/functions.inc
index 807fbb63643b06dd9d7fea8fba6b3d5e11b9c10a..09f90acced0c579ef6888a8d1d886a979fe7db78 100644 (file)
--- a/include/functions.inc
+++ b/include/functions.inc
}
/* Return and remove accidently trailing slashes */
- return rtrim($dep, "/");
+ return @ldap::fix(rtrim($dep, "/"));
}
function convert_department_dn2($dn)