summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include/rcube_ldap.php
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-06-18 19:45:26 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-06-18 19:45:26 +0000
commit7f4085a026bb1c2be4e7355e0d2dcb69ba3a0802 (patch)
tree2a15c05705b9b0dfa666b5dfee116ad6cdb0ad1e /roundcubemail/program/include/rcube_ldap.php
parentd83b9158748c1ff72d4bfd7b9c76b215a21d9c5b (diff)
Use numSubOrdindates inconjuction with VLV to count total
git-svn-id: https://svn.roundcube.net/trunk@4868 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcube_ldap.php')
-rw-r--r--roundcubemail/program/include/rcube_ldap.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/roundcubemail/program/include/rcube_ldap.php b/roundcubemail/program/include/rcube_ldap.php
index e377de7fd..4ea4f6046 100644
--- a/roundcubemail/program/include/rcube_ldap.php
+++ b/roundcubemail/program/include/rcube_ldap.php
@@ -884,10 +884,18 @@ class rcube_ldap extends rcube_addressbook
$this->_debug("C: Search [".$filter."]");
- // when using VLV, we need to issue listing command first in order to get the full count
+ // when using VLV, we get the total count by...
if (!$count && $function != 'ldap_read' && $this->prop['vlv']) {
- if ($this->_exec_search(true))
- $this->vlv_count = ldap_count_entries($this->conn, $this->ldap_result);
+ // ...either reading numSubOrdinates attribute
+ if ($this->prop['numsub_filter'] && ($result_count = @$function($this->conn, $this->base_dn, $this->prop['numsub_filter'], array('numSubOrdinates'), 0, 0, 0))) {
+ $counts = ldap_get_entries($this->conn, $result_count);
+ for ($this->vlv_count = $j = 0; $j < $counts['count']; $j++)
+ $this->vlv_count += $counts[$j]['numsubordinates'][0];
+ $this->_debug("D: total numsubordinates = " . $this->vlv_count);
+ }
+ else // ...or by fetching all records dn and count them
+ $this->vlv_count = $this->_exec_search(true);
+
$this->vlv_active = $this->_vlv_set_controls();
}