diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-08-02 16:42:29 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-08-02 16:42:29 +0000 |
| commit | 69e8243419f782b2e6fe2ed05b10120f96fb60fd (patch) | |
| tree | ff733934146ef63248600845b22a51eaf63f06ae /roundcubemail/program/include/rcmail.php | |
| parent | f0569035a705c2c09664242eb2f16ed60c0b0998 (diff) | |
- Fix get_address_book() to call get_address_sources() internally when looking for default source
git-svn-id: https://svn.roundcube.net/trunk@5008 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcmail.php')
| -rw-r--r-- | roundcubemail/program/include/rcmail.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/roundcubemail/program/include/rcmail.php b/roundcubemail/program/include/rcmail.php index 33956c3eb..d38f771ef 100644 --- a/roundcubemail/program/include/rcmail.php +++ b/roundcubemail/program/include/rcmail.php @@ -378,6 +378,7 @@ class rcmail * * @param string Address book identifier * @param boolean True if the address book needs to be writeable + * * @return rcube_contacts Address book object */ public function get_address_book($id, $writeable = false) @@ -407,18 +408,13 @@ class rcmail if ($plugin['instance'] instanceof rcube_addressbook) { $contacts = $plugin['instance']; } + // get first source from the list else if (!$id) { - if ($abook_type == 'ldap') { - // Use the first writable LDAP address book. - foreach ($ldap_config as $id => $prop) { - if (!$writeable || $prop['writable']) { - $contacts = new rcube_ldap($prop, $this->config->get('ldap_debug'), $this->config->mail_domain($_SESSION['imap_host'])); - break; - } - } - } - else { // $id == 'sql' - $contacts = new rcube_contacts($this->db, $this->user->ID); + $source = reset($this->get_address_sources($writeable)); + if (!empty($source)) { + $contacts = $this->get_address_book($source['id']); + if ($contacts) + $id = $source['id']; } } } |
