From ccfd0599f6a83c82865fabd09791e59e3bda4476 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 9 Apr 2015 07:44:34 +0000 Subject: [PATCH] * LDAP/Filemanager: fix fatal error / white screen in sharing when opening a sharing url --- addressbook/inc/class.addressbook_ldap.inc.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.addressbook_ldap.inc.php b/addressbook/inc/class.addressbook_ldap.inc.php index 25795e2f7b..0a60106efb 100644 --- a/addressbook/inc/class.addressbook_ldap.inc.php +++ b/addressbook/inc/class.addressbook_ldap.inc.php @@ -316,20 +316,23 @@ class addressbook_ldap */ function connect($admin = false) { + // if egw object does not yet exists (eg. in sharing), we have to use our own ldap instance! + $ldap = isset($GLOBALS['egw']) ? $GLOBALS['egw']->ldap : new ldap(); + if ($admin) { - $this->ds = $GLOBALS['egw']->ldap->ldapConnect(); + $this->ds = $ldap->ldapConnect(); } // if ldap is NOT the contact repository, we only do accounts and need to use the account-data elseif (substr($GLOBALS['egw_info']['server']['contact_repository'],-4) != 'ldap') // not (ldap or sql-ldap) { $this->ldap_config['ldap_contact_host'] = $this->ldap_config['ldap_host']; $this->allContactsDN = $this->ldap_config['ldap_context']; - $this->ds = $GLOBALS['egw']->ldap->ldapConnect(); + $this->ds = $ldap->ldapConnect(); } else { - $this->ds = $GLOBALS['egw']->ldap->ldapConnect( + $this->ds = $ldap->ldapConnect( $this->ldap_config['ldap_contact_host'], $GLOBALS['egw_info']['user']['account_dn'], $GLOBALS['egw_info']['user']['passwd']