diff options
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcube_imap_generic.php | 14 | ||||
-rw-r--r-- | program/include/rcube_ldap.php | 33 | ||||
-rwxr-xr-x | program/include/rcube_template.php | 2 |
3 files changed, 33 insertions, 16 deletions
diff --git a/program/include/rcube_imap_generic.php b/program/include/rcube_imap_generic.php index e3c987cd3..102845ed0 100644 --- a/program/include/rcube_imap_generic.php +++ b/program/include/rcube_imap_generic.php @@ -105,6 +105,7 @@ class rcube_imap_generic private $prefs; private $cmd_tag; private $cmd_num = 0; + private $resourceid; private $_debug = false; private $_debug_handler = false; @@ -734,8 +735,13 @@ class rcube_imap_generic $line = trim(fgets($this->fp, 8192)); - if ($this->_debug && $line) { - $this->debug('S: '. $line); + if ($this->_debug) { + // set connection identifier for debug output + preg_match('/#([0-9]+)/', (string)$this->fp, $m); + $this->resourceid = strtoupper(substr(md5($m[1].$this->user.microtime()), 0, 4)); + + if ($line) + $this->debug('S: '. $line); } // Connected to wrong port or connection error? @@ -3361,6 +3367,10 @@ class rcube_imap_generic */ private function debug($message) { + if ($this->resourceid) { + $message = sprintf('[%s] %s', $this->resourceid, $message); + } + if ($this->_debug_handler) { call_user_func_array($this->_debug_handler, array(&$this, $message)); } else { diff --git a/program/include/rcube_ldap.php b/program/include/rcube_ldap.php index c363dc572..bf978a7ff 100644 --- a/program/include/rcube_ldap.php +++ b/program/include/rcube_ldap.php @@ -431,34 +431,41 @@ class rcube_ldap extends rcube_addressbook // we have a search result resource if ($this->ldap_result && $this->result->count > 0) { + // sorting still on the ldap server if ($this->sort_col && $this->prop['scope'] !== 'base' && !$this->vlv_active) ldap_sort($this->conn, $this->ldap_result, $this->sort_col); + // start and end of the page $start_row = $this->vlv_active ? 0 : $this->result->first; $start_row = $subset < 0 ? $start_row + $this->page_size + $subset : $start_row; $last_row = $this->result->first + $this->page_size; $last_row = $subset != 0 ? $start_row + abs($subset) : $last_row; + // get all entries from the ldap server $entries = ldap_get_entries($this->conn, $this->ldap_result); - for ($i = $start_row; $i < min($entries['count'], $last_row); $i++) - $this->result->add($this->_ldap2result($entries[$i])); - } - // temp hack for filtering group members - if ($this->groups and $this->group_id) - { - $result = new rcube_result_set(); - while ($record = $this->result->iterate()) + // filtering for group members + if ($this->groups and $this->group_id) { - if ($this->group_members[$record['ID']]) + $count = 0; + $members = array(); + foreach ($entries as $entry) { - $result->add($record); - $result->count++; + if ($this->group_members[base64_encode($entry['dn'])]) + { + $members[] = $entry; + $count++; + } } + $entries = $members; + $entries['count'] = $count; + $this->result->count = $count; } - $this->result = $result; - } + // filter entries for this page + for ($i = $start_row; $i < min($entries['count'], $last_row); $i++) + $this->result->add($this->_ldap2result($entries[$i])); + } return $this->result; } diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php index f5c741fc5..c4dd73b23 100755 --- a/program/include/rcube_template.php +++ b/program/include/rcube_template.php @@ -434,7 +434,7 @@ class rcube_template extends rcube_html_page if ($write) { // add debug console - if ($this->config['debug_level'] & 8) { + if ($realname != 'error' && ($this->config['debug_level'] & 8)) { $this->add_footer('<div id="console" style="position:absolute;top:5px;left:5px;width:405px;padding:2px;background:white;z-index:9000;display:none"> <a href="#toggle" onclick="con=$(\'#dbgconsole\');con[con.is(\':visible\')?\'hide\':\'show\']();return false">console</a> <textarea name="console" id="dbgconsole" rows="20" cols="40" wrap="off" style="display:none;width:400px;border:none;font-size:10px" spellcheck="false"></textarea></div>' |