* LDAP/Filemanager: fix fatal error / white screen in sharing when opening a sharing url

This commit is contained in:
Ralf Becker 2015-04-09 07:44:15 +00:00
parent a0b6dc0ea1
commit 6c0df44d2d

View File

@ -316,20 +316,23 @@ class addressbook_ldap
*/ */
function connect($admin = false) 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) 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 // 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) 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->ldap_config['ldap_contact_host'] = $this->ldap_config['ldap_host'];
$this->allContactsDN = $this->ldap_config['ldap_context']; $this->allContactsDN = $this->ldap_config['ldap_context'];
$this->ds = $GLOBALS['egw']->ldap->ldapConnect(); $this->ds = $ldap->ldapConnect();
} }
else else
{ {
$this->ds = $GLOBALS['egw']->ldap->ldapConnect( $this->ds = $ldap->ldapConnect(
$this->ldap_config['ldap_contact_host'], $this->ldap_config['ldap_contact_host'],
$GLOBALS['egw_info']['user']['account_dn'], $GLOBALS['egw_info']['user']['account_dn'],
$GLOBALS['egw_info']['user']['passwd'] $GLOBALS['egw_info']['user']['passwd']