Code

Updated several config function to use get_sub_list.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 08:40:20 +0000 (08:40 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 22 Feb 2008 08:40:20 +0000 (08:40 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9047 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/include/class_config.inc
gosa-core/include/functions.inc

index a1c386f8293c15a91ac8c13c16f90e63f4caeeea..3fc3650832165115ee4a83e6192e2c4538166521 100644 (file)
@@ -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)
   {
index 1da4e832c9b95fead61c302f443836260335dc7a..29ae1b1e74a656a4ad12d2356e089c7892b19b61 100644 (file)
@@ -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);