summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-07-27 11:52:46 +0000
committeralecpl <alec@alec.pl>2011-07-27 11:52:46 +0000
commit5ed119e5341a9c1225bbb40c6e3d6ea787ca17ed (patch)
tree3a439852d867ff019f9e64a96659118dca436022 /program
parent64ebc94eec88a9d55d2725d10a7f5b9bb763652d (diff)
- Don't use default source if source id is specified in get_address_source()
Diffstat (limited to 'program')
-rw-r--r--program/include/rcmail.php28
1 files changed, 19 insertions, 9 deletions
diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 72f0efa92..f37186c0e 100644
--- a/program/include/rcmail.php
+++ b/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