From 471742f7ecd4b3adc979ec61e0982a127702aae2 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 14 Jun 2019 17:25:18 +0200 Subject: [PATCH] fix esync addressbooks to sync preferenence can be an array to --- addressbook/inc/class.addressbook_zpush.inc.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/addressbook/inc/class.addressbook_zpush.inc.php b/addressbook/inc/class.addressbook_zpush.inc.php index 4e2f105843..307133cb91 100644 --- a/addressbook/inc/class.addressbook_zpush.inc.php +++ b/addressbook/inc/class.addressbook_zpush.inc.php @@ -141,10 +141,11 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se if (!isset($this->addressbook)) $this->addressbook = new Api\Contacts(); - // error_log(print_r($this->addressbook->get_addressbooks(Acl::READ),true)); - $pref = $GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-abs']; - $pref_abs = (string)$pref !== '' ? explode(',',$pref) : array(); - + $pref_abs = $GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-abs']; + if (!is_array($pref_abs)) + { + $pref_abs = $pref_abs ? explode(',',$pref_abs) : []; + } foreach ($this->addressbook->get_addressbooks() as $account_id => $label) { if ((string)$account_id == $GLOBALS['egw_info']['user']['account_id'].'p') @@ -739,7 +740,12 @@ class addressbook_zpush implements activesync_plugin_write, activesync_plugin_se if ($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-all-in-one'] && $owner == $GLOBALS['egw_info']['user']['account_id']) { - if (strpos($GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-abs'],'A') !== false) + $prefs_abs = $GLOBALS['egw_info']['user']['preferences']['activesync']['addressbook-abs']; + if (!is_array($prefs_abs)) + { + $prefs_abs = $prefs_abs ? explode(',', $prefs_abs) : []; + } + if (in_array('A', $prefs_abs)) { $owner = null; // all AB's }