NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

[Web] Revert some autodiscover changes, fix json_api for Postfix logs

6287a395
andryyy <[email protected]> 9 years ago
data/web/autodiscover.php | 23 +++++++++--------------
 data/web/json_api.php     |  1 +
 2 files changed, 10 insertions(+), 14 deletions(-)

Diff

diff --git a/data/web/autodiscover.php b/data/web/autodiscover.php
index 1e52c4d7..14036433 100644
--- a/data/web/autodiscover.php
+++ b/data/web/autodiscover.php
@@ -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';
   }
 }
 
diff --git a/data/web/json_api.php b/data/web/json_api.php
index 167567b5..7673f294 100644
--- a/data/web/json_api.php
+++ b/data/web/json_api.php
@@ -768,6 +768,7 @@ if (isset($_SESSION['mailcow_cc_role']) || isset($_SESSION['pending_mailcow_cc_u
                 else {
                   echo '{}';
                 }
+              break;
               case "autodiscover":
                 if (isset($extra) && !empty($extra)) {
                   $extra = intval($extra);