diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-07-27 11:52:46 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-07-27 11:52:46 +0000 |
| commit | 904e2dcf0a3ed226641d36656e411cd8aaeb9824 (patch) | |
| tree | 58196a64d815d0ca819008a319b4cff21a982cf7 /roundcubemail/program/include/rcmail.php | |
| parent | 7fc9b545d32c1fc6c299042f8bdd6efdb22842d2 (diff) | |
- Don't use default source if source id is specified in get_address_source()
git-svn-id: https://svn.roundcube.net/trunk@4975 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include/rcmail.php')
| -rw-r--r-- | roundcubemail/program/include/rcmail.php | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/roundcubemail/program/include/rcmail.php b/roundcubemail/program/include/rcmail.php index 72f0efa92..f37186c0e 100644 --- a/roundcubemail/program/include/rcmail.php +++ b/roundcubemail/program/include/rcmail.php @@ -403,18 +403,28 @@ class rcmail if ($plugin['instance'] instanceof rcube_addressbook) { $contacts = $plugin['instance']; } - else 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 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); + } } - else { // $id == 'sql' - $contacts = new rcube_contacts($this->db, $this->user->ID); - } + } + + if (!$contacts) { + raise_error(array( + 'code' => 600, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => "Addressbook source ($id) not found!"), + true, true); } // add to the 'books' array for shutdown function |
