summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-08-02 17:17:59 +0000
committeralecpl <alec@alec.pl>2011-08-02 17:17:59 +0000
commit34854b63ee18d7b1a8b95d138460504e5d1c3f67 (patch)
treea10f890e5fab8bbea6a629725c6c5acc7a5d18f3
parent7f7ed2d9df1dc531e8500c1c8706c068920adb0a (diff)
- Fix setting default addressbook as selected in source selector
-rw-r--r--program/steps/addressbook/edit.inc7
-rw-r--r--program/steps/addressbook/func.inc4
2 files changed, 8 insertions, 3 deletions
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index 69fcba93c..0ad977d1a 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -43,7 +43,12 @@ if ($RCMAIL->action == 'edit') {
else {
$source = get_input_value('_source', RCUBE_INPUT_GPC);
- $CONTACTS = $RCMAIL->get_address_book($source);
+ if (!strlen($source)) {
+ // Give priority to configured default
+ $source = $RCMAIL->config->get('default_addressbook');
+ }
+
+ $CONTACTS = $RCMAIL->get_address_book($source, true);
// find writable addressbook
if (!$CONTACTS || $CONTACTS->readonly)
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 932d34935..7fb1e2c29 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -150,10 +150,10 @@ function rcmail_default_source($writable=false)
global $RCMAIL;
// get list of address sources
- $list = $RCMAIL->get_address_sources($writable);
+ $first = reset($RCMAIL->get_address_sources($writable));
// use first directory by default
- return $list[key($list)]['id'];
+ return $first['id'];
}
function rcmail_set_sourcename($abook)