alecpl
2011-07-27 70c31118264e447699d4ed628f45b7853799423d
- Fix fallback to default source (#1488009)


2 files modified
19 ■■■■■ changed files
program/steps/addressbook/func.inc 8 ●●●● patch | view | raw | blame | history
program/steps/addressbook/save.inc 11 ●●●● patch | view | raw | blame | history
program/steps/addressbook/func.inc
@@ -100,7 +100,7 @@
}
// instantiate a contacts object according to the given source
function rcmail_contact_source($source=null, $init_env=false)
function rcmail_contact_source($source=null, $init_env=false, $writable=false)
{
    global $RCMAIL, $OUTPUT, $CONFIG, $CONTACT_COLTYPES;
@@ -108,12 +108,8 @@
        $source = get_input_value('_source', RCUBE_INPUT_GPC);
    }
    if (!strlen($source)) {
        return null;
    }
    // Get object
    $CONTACTS = $RCMAIL->get_address_book($source);
    $CONTACTS = $RCMAIL->get_address_book($source, $writable);
    $CONTACTS->set_pagesize($CONFIG['pagesize']);
    // set list properties and session vars
program/steps/addressbook/save.inc
@@ -19,10 +19,9 @@
*/
$CONTACTS = rcmail_contact_source(null, true);
$CONTACTS = rcmail_contact_source(null, true, true);
$cid      = get_input_value('_cid', RCUBE_INPUT_POST);
$return_action = empty($cid) ? 'add' : 'edit';
// Source changed, display the form again
if (!empty($_GET['_reload'])) {
@@ -220,6 +219,11 @@
// insert a new contact
else {
  $source = get_input_value('_source', RCUBE_INPUT_GPC);
  // Name of the addressbook already selected on the list
  $orig_source = get_input_value('_orig_source', RCUBE_INPUT_GPC);
  if (!strlen($source))
    $source = $orig_source;
  // show notice if existing contacts with same e-mail are found
  $existing = false;
@@ -253,9 +257,6 @@
        $CONTACTS->add_to_group($gid, $plugin['ids']);
      }
    }
    // Name of the addressbook already selected on the list
    $orig_source = get_input_value('_orig_source', RCUBE_INPUT_GPC);
    if ((string)$source === (string)$orig_source) {
      // add contact row or jump to the page where it should appear