From 179b39d22a68db1f31947aca4d31eb1e53d193a7 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 04 Nov 2011 05:08:54 -0400
Subject: [PATCH] - Fix error on opening searched LDAP contact (#1488144)

---
 CHANGELOG                          |    1 +
 program/steps/addressbook/func.inc |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 6bc7233..5e3b017 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fix error on opening searched LDAP contact (#1488144)
 - Fix redundant line break in flowed format (#1488146)
 - TinyMCE:
   - updated to 3.4.6
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 2b06e62..79a0bab 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -763,9 +763,12 @@
     foreach ($cid as $id) {
         // if _source is not specified we'll find it from decoded ID
         if (!$got_source) {
-            list ($c, $s) = explode('-', $id, 2);
-            if (strlen($s)) {
-                $result[(string)$s][] = $c;
+            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;
+                }
             }
         }
         else {

--
Gitblit v1.9.1