diff options
author | Aleksander Machniak <alec@alec.pl> | 2013-02-17 16:23:30 +0100 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2013-02-17 16:26:29 +0100 |
commit | 60dabb35aed6689dd6b50cb885b3dbbf5504ef1f (patch) | |
tree | 8911faf8a0429da5cbaa4da86999b2109c7ee96a /program | |
parent | a7e1b9310924c04b2e41359b9aaef42f2a99820c (diff) |
- Fix regression in handling LDAP contact identifiers (#1488959)
Diffstat (limited to 'program')
-rw-r--r-- | program/js/app.js | 4 | ||||
-rw-r--r-- | program/steps/addressbook/func.inc | 23 |
2 files changed, 17 insertions, 10 deletions
diff --git a/program/js/app.js b/program/js/app.js index 13f1378f4..ab8eb2369 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -4290,7 +4290,7 @@ function rcube_webmail() this.group_member_change('add', cid, dest, to.id); else { var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), - post_data = {_cid: cid, _source: source, _to: dest, _togid: to.id, _gid: group}; + post_data = {_cid: cid, _source: this.env.source, _to: dest, _togid: to.id, _gid: group}; this.http_post('copy', post_data, lock); } @@ -4298,7 +4298,7 @@ function rcube_webmail() // target is an addressbook else if (to.id != source) { var lock = this.display_message(this.get_label('copyingcontact'), 'loading'), - post_data = {_cid: cid, _source: source, _to: to.id, _gid: group}; + post_data = {_cid: cid, _source: this.env.source, _to: to.id, _gid: group}; this.http_post('copy', post_data, lock); } diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 7fb862d5e..aad849f1c 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -755,20 +755,27 @@ function rcmail_get_cids($filter = null) return array(); } - $cid = explode(',', $cid); - $result = array(); + $cid = explode(',', $cid); + $got_source = strlen($source); + $result = array(); // create per-source contact IDs array foreach ($cid as $id) { - // get source from decoded ID - if ($sep = strrpos($id, '-')) { - $contact_id = substr($id, 0, $sep); - $source_id = substr($id, $sep+1); - if (strlen($source_id)) { - $result[(string)$source_id][] = $contact_id; + // extract source ID from contact ID (it's there in search mode) + // see #1488959 and #1488862 for reference + if (!$got_source) { + if ($sep = strrpos($id, '-')) { + $contact_id = substr($id, 0, $sep); + $source_id = (string) substr($id, $sep+1); + if (strlen($source_id)) { + $result[$source_id][] = $contact_id; + } } } else { + if (substr($id, -($got_source+1)) == "-$source") { + $id = substr($id, 0, -($got_source+1)); + } $result[$source][] = $id; } } |