|
@@ -17,20 +17,15 @@ $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') {
|
|
|
- preg_match("/^((?!.*Mac).)*(Outlook|Office).+1[5-9].*/i", $_SERVER['HTTP_USER_AGENT'], $supported_outlook);
|
|
|
- if (empty($supported_outlook)) {
|
|
|
- $autodiscover_config['autodiscoverType'] = 'imap';
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- $autodiscover_config['autodiscoverType'] = 'imap';
|
|
|
- }
|
|
|
- }
|
|
|
- if (preg_match("/eM Client/i", $_SERVER['HTTP_USER_AGENT']) || !isset($_SERVER['HTTP_USER_AGENT'])) {
|
|
|
- $autodiscover_config['autodiscoverType'] = 'imap';
|
|
|
+if (strpos($data, 'autodiscover/outlook/responseschema') !== false) {
|
|
|
+ $autodiscover_config['autodiscoverType'] = 'imap';
|
|
|
+ if ($autodiscover_config['useEASforOutlook'] == 'yes' &&
|
|
|
+ // Office for macOS does not support EAS
|
|
|
+ strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') === false &&
|
|
|
+ // Outlook 2013 (version 15) or higher
|
|
|
+ preg_match('/(Outlook|Office).+15\./', $_SERVER['HTTP_USER_AGENT'])
|
|
|
+ ) {
|
|
|
+ $autodiscover_config['autodiscoverType'] = 'activesync';
|
|
|
}
|
|
|
}
|
|
|
|