Aleksander Machniak
2013-06-19 858af706560c7665c99e37a2b34c4c8c1c647f8e
CS fixes
1 files modified
18 ■■■■■ changed files
program/lib/Roundcube/rcube_ldap_generic.php 18 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_ldap_generic.php
@@ -359,9 +359,13 @@
     */
    public function search($base_dn, $filter = '', $scope = 'sub', $attrs = array('dn'), $prop = array(), $count_only = false)
    {
        if ($this->conn) {
            if (empty($filter))
                $filter = $filter = '(objectclass=*)';
        if (!$this->conn) {
            return false;
        }
        if (empty($filter)) {
            $filter = '(objectclass=*)';
        }
            $this->_debug("C: Search $base_dn for $filter");
@@ -371,7 +375,9 @@
            if (!$count_only && ($vlv_sort = $this->_find_vlv($base_dn, $filter, $scope, $prop['sort']))) {
                // when using VLV, we get the total count by...
                // ...either reading numSubOrdinates attribute
                if ($this->config['numsub_filter'] && ($result_count = @$ns_function($this->conn, $base_dn, $this->config['numsub_filter'], array('numSubOrdinates'), 0, 0, 0))) {
            if (($sub_filter = $this->config['numsub_filter']) &&
                ($result_count = @$ns_function($this->conn, $base_dn, $sub_filter, array('numSubOrdinates'), 0, 0, 0))
            ) {
                    $counts = ldap_get_entries($this->conn, $result_count);
                    for ($vlv_count = $j = 0; $j < $counts['count']; $j++)
                        $vlv_count += $counts[$j]['numsubordinates'][0];
@@ -392,7 +398,8 @@
            if ($ldap_result = @$function($this->conn, $base_dn, $filter,
                $attrs, 0, (int)$this->config['sizelimit'], (int)$this->config['timelimit'])
            ) {
                // when running on a patched PHP we can use the extended functions to retrieve the total count from the LDAP search result
            // when running on a patched PHP we can use the extended functions
            // to retrieve the total count from the LDAP search result
                if ($this->vlv_active && function_exists('ldap_parse_virtuallist_control')) {
                    if (ldap_parse_result($this->conn, $ldap_result, $errcode, $matcheddn, $errmsg, $referrals, $serverctrls)) {
                        ldap_parse_virtuallist_control($this->conn, $serverctrls, $last_offset, $vlv_count, $vresult);
@@ -412,7 +419,6 @@
            }
            else {
                $this->_debug("S: ".ldap_error($this->conn));
            }
        }
        return false;