diff --git a/lib/Autodiscover.php b/lib/Autodiscover.php --- a/lib/Autodiscover.php +++ b/lib/Autodiscover.php @@ -156,17 +156,17 @@ if ($value = $this->conf->get('autodiscover', $type)) { $params = explode(';', $value); - $pass_secure = in_array($params[1], array('CRAM-MD5', 'DIGEST-MD5')); + $pass_secure = in_array($params[1] ?? null, array('CRAM-MD5', 'DIGEST-MD5')); - $host = $params[0]; + $host = $params[0] ?? null; $host = str_replace('%d', $this->config['domain'], $host); $url = parse_url($host); $this->config[$type] = array( 'hostname' => $url['host'], 'port' => $url['port'], - 'socketType' => $proto_map[$url['scheme']] ?: 'plain', - 'username' => $this->config['login'] ?: $this->config['email'], + 'socketType' => $proto_map[$url['scheme']] ?? 'plain', + 'username' => $this->config['login'] ?? $this->config['email'], 'authentication' => 'password-' . ($pass_secure ? 'encrypted' : 'cleartext'), ); } diff --git a/lib/AutodiscoverMicrosoft.php b/lib/AutodiscoverMicrosoft.php --- a/lib/AutodiscoverMicrosoft.php +++ b/lib/AutodiscoverMicrosoft.php @@ -159,11 +159,11 @@ $dispname = $xml->createElement('DisplayName'); $dispname = $user->appendChild($dispname); - $dispname->appendChild($xml->createTextNode($this->config['username'])); + $dispname->appendChild($xml->createTextNode($this->config['username'] ?? null)); $email = $xml->createElement('EMailAddress'); $email = $user->appendChild($email); - $email->appendChild($xml->createTextNode($this->config['login'] ?: $this->config['email'])); + $email->appendChild($xml->createTextNode($this->config['login'] ?? $this->config['email'])); $element = $xml->createElement('Type'); $element = $server->appendChild($element); @@ -212,11 +212,11 @@ $dispname = $xml->createElement('DisplayName'); $dispname = $user->appendChild($dispname); - $dispname->appendChild($xml->createTextNode($this->config['username'])); + $dispname->appendChild($xml->createTextNode($this->config['username'] ?? null)); $email = $xml->createElement('AutoDiscoverSMTPAddress'); $email = $user->appendChild($email); - $email->appendChild($xml->createTextNode($this->config['login'] ?: $this->config['email'])); + $email->appendChild($xml->createTextNode($this->config['login'] ?? $this->config['email'])); // @TODO: Microsoft supports also DAV protocol here foreach (array('imap', 'pop3', 'smtp') as $type) { diff --git a/lib/Conf.php b/lib/Conf.php --- a/lib/Conf.php +++ b/lib/Conf.php @@ -139,16 +139,18 @@ // Fall back to whatever is the equivalent of auth_mechanism as the // section (i.e. 'ldap', or 'sql') - $auth_mech = $this->_conf['kolab']['auth_mechanism']; - if (isset($this->_conf[$auth_mech])) { - if (isset($this->_conf[$auth_mech][$key1])) { - return $this->_conf[$auth_mech][$key1]; + if (isset($this->_conf['kolab'])) { + $auth_mech = $this->_conf['kolab']['auth_mechanism'] ?? null; + if ($auth_mech && isset($this->_conf[$auth_mech])) { + if (isset($this->_conf[$auth_mech][$key1])) { + return $this->_conf[$auth_mech][$key1]; + } } - } - // Fall back to global settings in the 'kolab' section. - if (isset($this->_conf['kolab'][$key1])) { - return $this->_conf['kolab'][$key1]; + // Fall back to global settings in the 'kolab' section. + if (isset($this->_conf['kolab'][$key1])) { + return $this->_conf['kolab'][$key1]; + } } return null;