From a3accd7a77700eed35400fb4e74066bf442b102a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=BCegg?= Date: Thu, 12 Feb 2015 20:08:18 +0100 Subject: [PATCH 1/2] don't check for a photo unless any phone number given since the identification / matching between contact and sms is the sms_address (which is compared with TEL entries) it makes no sense to check for the photo, unless there is at least one address given (the sms_address can also be a text string, but this would still match only in TEL entries). --- appinfo/ocsmsapp.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/appinfo/ocsmsapp.php b/appinfo/ocsmsapp.php index 9932f00..5a5866b 100644 --- a/appinfo/ocsmsapp.php +++ b/appinfo/ocsmsapp.php @@ -145,12 +145,12 @@ class OcSmsApp extends App { else { $this->pushPhoneNumberToCache($phoneIds, $r["FN"], $configuredCountry); } - } - - if (isset ($r["PHOTO"])) { - // Remove useless prefix - $photoURL = preg_replace("#VALUE=uri:#","",$r["PHOTO"]); - self::$contactPhotos[$r["FN"]] = $photoURL; + + if (isset ($r["PHOTO"])) { + // Remove useless prefix + $photoURL = preg_replace("#VALUE=uri:#","",$r["PHOTO"]); + self::$contactPhotos[$r["FN"]] = $photoURL; + } } } } From 822f969afcf3ccf7932ceb02b48de94b6682a8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=BCegg?= Date: Thu, 12 Feb 2015 20:14:18 +0100 Subject: [PATCH 2/2] minor regex optimization probably not really neccessary but it was ment to improve speed since the replacment only takes place - at the beginning of the string - once --- appinfo/ocsmsapp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appinfo/ocsmsapp.php b/appinfo/ocsmsapp.php index 5a5866b..ad5a16e 100644 --- a/appinfo/ocsmsapp.php +++ b/appinfo/ocsmsapp.php @@ -148,7 +148,7 @@ class OcSmsApp extends App { if (isset ($r["PHOTO"])) { // Remove useless prefix - $photoURL = preg_replace("#VALUE=uri:#","",$r["PHOTO"]); + $photoURL = preg_replace("#^VALUE=uri:#","",$r["PHOTO"], 1); self::$contactPhotos[$r["FN"]] = $photoURL; } }