[Web] Temp. workaround for em Client which sends an empty user-agent

master
andryyy 2017-10-02 22:19:20 +02:00
parent 9c37cd76e5
commit 5e69decd7b
1 changed files with 4 additions and 2 deletions

View File

@ -15,6 +15,8 @@ error_reporting(0);
$data = trim(file_get_contents("php://input"));
file_put_contents('/tmp/dsa', json_encode($_SERVER), FILE_APPEND);
if ($autodiscover_config['autodiscoverType'] == 'activesync') {
if (preg_match("/(Outlook|Office)/i", $_SERVER['HTTP_USER_AGENT'])) {
if ($autodiscover_config['useEASforOutlook'] == 'yes') {
@ -27,7 +29,7 @@ if ($autodiscover_config['autodiscoverType'] == 'activesync') {
$autodiscover_config['autodiscoverType'] = 'imap';
}
}
if (preg_match("/eM Client/i", $_SERVER['HTTP_USER_AGENT'])) {
if (preg_match("/eM Client/i", $_SERVER['HTTP_USER_AGENT']) || !isset($_SERVER['HTTP_USER_AGENT'])) {
$autodiscover_config['autodiscoverType'] = 'imap';
}
}
@ -62,7 +64,7 @@ if (!isset($_SERVER['PHP_AUTH_USER']) OR $login_role !== "user") {
);
return false;
}
header('WWW-Authenticate: Basic realm=""');
header('WWW-Authenticate: Basic realm="' . $_SERVER['HTTP_HOST'] . '"');
header('HTTP/1.0 401 Unauthorized');
exit(0);
}