summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-02-17 16:23:30 +0100
committerAleksander Machniak <alec@alec.pl>2013-02-17 16:23:30 +0100
commiteafb68b32160c73646a6d067b9352d05ceaf5023 (patch)
tree77e70c08d1982e5775f482e6b107a51d5b64a3b5 /program/steps
parent33dc8249fd7c9add67c874cec8d517a315e41dac (diff)
- Fix regression in handling LDAP contact identifiers (#1488959)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/func.inc23
1 files changed, 15 insertions, 8 deletions
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index f6d2ae519..9b01ebaa3 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -769,20 +769,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;
}
}