From: hickert Date: Fri, 22 Feb 2008 08:40:20 +0000 (+0000) Subject: Updated several config function to use get_sub_list. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=845405600211f1b5fb7ad04d3bcbb4d98cfef319;p=gosa.git Updated several config function to use get_sub_list. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9047 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index a1c386f82..3fc365083 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -720,50 +720,45 @@ class config { */ function getShareList($listboxEntry = false) { - $ldap= $this->get_ldap_link(); - $base = $this->current['BASE']; - $res= get_list("(&(objectClass=goShareServer)(goExportEntry=*))","server",$base,array("goExportEntry","cn"),GL_SUBSEARCH); - $return = array(); - - foreach($res as $entry){ - if(obj_is_readable($entry['dn'], "server/goShareServer","goExportEntry")){ + $tmp = get_sub_list("(&(objectClass=goShareServer)(goExportEntry=*))","",get_ou("serverou"), + $this->current['BASE'],array("goExportEntry","cn"), GL_NONE); + $return =array(); + foreach($tmp as $entry){ - if(isset($entry['goExportEntry']['count'])){ - unset($entry['goExportEntry']['count']); - } - if(isset($entry['goExportEntry'])){ - foreach($entry['goExportEntry'] as $export){ - $shareAttrs = split("\|",$export); - if($listboxEntry) { - $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0]; - }else{ - $return[$shareAttrs[0]."|".$entry['cn'][0]]['server'] = $entry['cn'][0]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['name'] = $shareAttrs[0]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['description'] = $shareAttrs[1]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['type'] = $shareAttrs[2]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset'] = $shareAttrs[3]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['path'] = $shareAttrs[4]; - $return[$shareAttrs[0]."|".$entry['cn'][0]]['option'] = $shareAttrs[5]; - } + if(isset($entry['goExportEntry']['count'])){ + unset($entry['goExportEntry']['count']); + } + if(isset($entry['goExportEntry'])){ + foreach($entry['goExportEntry'] as $export){ + $shareAttrs = split("\|",$export); + if($listboxEntry) { + $return[$shareAttrs[0]."|".$entry['cn'][0]] = $shareAttrs[0]." - ".$entry['cn'][0]; + }else{ + $return[$shareAttrs[0]."|".$entry['cn'][0]]['server'] = $entry['cn'][0]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['name'] = $shareAttrs[0]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['description'] = $shareAttrs[1]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['type'] = $shareAttrs[2]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['charset'] = $shareAttrs[3]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['path'] = $shareAttrs[4]; + $return[$shareAttrs[0]."|".$entry['cn'][0]]['option'] = $shareAttrs[5]; } } - } + } } - return($return); } + /* This function returns all available ShareServer */ function getShareServerList() { global $config; $return = array(); - $ui = get_userinfo(); $base = $config->current['BASE']; + $res= get_sub_list("(&(objectClass=goShareServer)(goExportEntry=*))", "server", + get_ou("serverou"), $base,array("goExportEntry","cn"),GL_NONE); - $res= get_list("(&(objectClass=goShareServer)(goExportEntry=*))", "server", $base,array("goExportEntry","cn"),GL_SUBSEARCH); foreach($res as $entry){ - if(obj_is_readable($entry['dn'], "server/goShareServer","goExportEntry")){ if(isset($entry['goExportEntry']['count'])){ unset($entry['goExportEntry']['count']); } @@ -772,11 +767,11 @@ class config { $sharename = $a_share[0]; $return[$entry['cn'][0]."|".$sharename] = $entry['cn'][0]." [".$sharename."]"; } - } } return($return); } + /* Check if there's the specified bool value set in the configuration */ function boolValueIsTrue($section, $value) { diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 1da4e832c..29ae1b1e7 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -777,7 +777,9 @@ function get_sub_list($filter, $category,$sub_deps, $base= "", $attributes= arra /* Remove , ("ou=1,ou=2.." => "ou=1") */ $sub_bases = array(); foreach($sub_deps as $key => $sub_base){ - $sub_bases[$key] = preg_replace("/,.*$/","",$sub_base); + if(!empty($sub_base)){ + $sub_bases[$key] = preg_replace("/,.*$/","",$sub_base); + } } /* Check if we have enabled the sub_dir search support AND @@ -790,7 +792,7 @@ function get_sub_list($filter, $category,$sub_deps, $base= "", $attributes= arra /* Log this fall back, it may be an unpredicted behaviour. */ if(!count($sub_bases)){ - gosa_log("debug","get_sub_list","",$attributes,sprintf("get_sub_list(): Falling back to get_list(), due to empty sub_bases parameter. This may slow down GOsa.",$src,$attrs['dn'])); + gosa_log("debug","get_sub_list","",$attributes,"get_sub_list(): Falling back to get_list(), due to empty sub_bases parameter. This may slow down GOsa."); } $tmp = get_list($filter, $category,$base,$attributes,$flags | GL_SUBSEARCH); return($tmp);