fixed bug introduced by Connys performance stuff: function returned limited resultset with unset or empty start parameter

This commit is contained in:
Ralf Becker 2008-03-06 16:11:49 +00:00
parent 4f941b5a61
commit 108cb59d3c

View File

@ -697,9 +697,9 @@ class accounts_ldap
$order = $propertyMap[$param['order']] ? $propertyMap[$param['order']] : 'uid'; $order = $propertyMap[$param['order']] ? $propertyMap[$param['order']] : 'uid';
$sri = ldap_search($this->ds, $this->user_context, $filter,array('uid', $order)); $sri = ldap_search($this->ds, $this->user_context, $filter,array('uid', $order));
$fullSet = array(); $fullSet = array();
foreach (ldap_get_entries($this->ds, $sri) as $entry) foreach (ldap_get_entries($this->ds, $sri) as $key => $entry)
{ {
$fullSet[$entry['uid'][0]] = $entry[$order][0]; if ($key != 'count') $fullSet[$entry['uid'][0]] = $entry[$order][0];
} }
if (is_numeric($param['type'])) // return only group-members if (is_numeric($param['type'])) // return only group-members
@ -717,7 +717,7 @@ class accounts_ldap
$sortFn = $param['sort'] == 'DESC' ? 'arsort' : 'asort'; $sortFn = $param['sort'] == 'DESC' ? 'arsort' : 'asort';
$sortFn($fullSet); $sortFn($fullSet);
$relevantAccounts = array_slice(array_keys($fullSet), $start, $offset); $relevantAccounts = is_numeric($start) ? array_slice(array_keys($fullSet), $start, $offset) : array_keys($fullSet);
$filter = "(" . "&(objectclass=posixaccount)" . '(|(uid='.implode(')(uid=',$relevantAccounts).'))' . $this->account_filter . ")"; $filter = "(" . "&(objectclass=posixaccount)" . '(|(uid='.implode(')(uid=',$relevantAccounts).'))' . $this->account_filter . ")";
$filter = str_replace(array('%user','%domain'),array('*',$GLOBALS['egw_info']['user']['domain']),$filter); $filter = str_replace(array('%user','%domain'),array('*',$GLOBALS['egw_info']['user']['domain']),$filter);