| | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2006-2011, The Roundcube Dev Team | |
| | | | Copyright (C) 2011, Kolab Systems AG | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | Licensed under the GNU General Public License version 3 or | |
| | | | any later version with exceptions for skins & plugins. | |
| | | | See the README file for a full license statement. | |
| | | | | |
| | | | PURPOSE: | |
| | | | Interface to an LDAP address directory | |
| | |
| | | $host = idn_to_ascii(rcube_parse_host($host)); |
| | | $hostname = $host.($this->prop['port'] ? ':'.$this->prop['port'] : ''); |
| | | |
| | | $this->_debug("C: Connect [$hostname]"); |
| | | $this->_debug("C: Connect [$hostname] [{$this->prop['name']}]"); |
| | | |
| | | if ($lc = @ldap_connect($host, $this->prop['port'])) |
| | | { |
| | |
| | | // The filter is not set, set it. |
| | | $this->filter = $this->prop['filter']; |
| | | } |
| | | $this->_exec_search(true); |
| | | if ($this->ldap_result) { |
| | | $count = ldap_count_entries($this->conn, $this->ldap_result); |
| | | } |
| | | |
| | | $count = (int) $this->_exec_search(true); |
| | | } |
| | | |
| | | return new rcube_result_set($count, ($this->list_page-1) * $this->page_size); |
| | |
| | | if (!($value = $rec[$lf][$i])) |
| | | continue; |
| | | |
| | | list($col, $subtype) = explode(':', $rf); |
| | | $out['_raw_attrib'][$lf][$i] = $value; |
| | | |
| | | if ($rf == 'email' && $this->mail_domain && !strpos($value, '@')) |
| | | $out[$rf][] = sprintf('%s@%s', $value, $this->mail_domain); |
| | | else if (in_array($rf, array('street','zipcode','locality','country','region'))) |
| | | $out['address'][$i][$rf] = $value; |
| | | else if (in_array($col, array('street','zipcode','locality','country','region'))) |
| | | $out['address'.($subtype?':':'').$subtype][$i][$col] = $value; |
| | | else if ($rec[$lf]['count'] > 1) |
| | | $out[$rf][] = $value; |
| | | else |