Browse Source

Update autoconfig.php

André Peters 8 years ago
parent
commit
b295bedf53
1 changed files with 19 additions and 12 deletions
  1. 19 12
      data/web/autoconfig.php

+ 19 - 12
data/web/autoconfig.php

@@ -1,5 +1,12 @@
 <?php
 <?php
 require_once 'inc/vars.inc.php';
 require_once 'inc/vars.inc.php';
+$default_autodiscover_config = $autodiscover_config;
+if(file_exists('inc/vars.local.inc.php')) {
+  include_once 'inc/vars.local.inc.php';
+}
+$configuration = array_merge($default_autodiscover_config, $autodiscover_config);
+
+error_reporting(0);
 
 
 if (empty($mailcow_hostname)) {
 if (empty($mailcow_hostname)) {
   exit();
   exit();
@@ -25,15 +32,15 @@ header('Content-Type: application/xml');
       <displayShortName>mail server</displayShortName>
       <displayShortName>mail server</displayShortName>
 
 
       <incomingServer type="imap">
       <incomingServer type="imap">
-         <hostname><?= $autodiscover_config['imap']['server']; ?></hostname>
-         <port><?= $autodiscover_config['imap']['port']; ?></port>
+         <hostname><?= $configuration['imap']['server']; ?></hostname>
+         <port><?= $configuration['imap']['port']; ?></port>
          <socketType>SSL</socketType>
          <socketType>SSL</socketType>
          <username>%EMAILADDRESS%</username>
          <username>%EMAILADDRESS%</username>
          <authentication>password-cleartext</authentication>
          <authentication>password-cleartext</authentication>
       </incomingServer>
       </incomingServer>
       <incomingServer type="imap">
       <incomingServer type="imap">
-         <hostname><?= $autodiscover_config['imap']['server']; ?></hostname>
-         <port><?= $autodiscover_config['imap']['tlsport']; ?></port>
+         <hostname><?= $configuration['imap']['server']; ?></hostname>
+         <port><?= $configuration['imap']['tlsport']; ?></port>
          <socketType>STARTTLS</socketType>
          <socketType>STARTTLS</socketType>
          <username>%EMAILADDRESS%</username>
          <username>%EMAILADDRESS%</username>
          <authentication>password-cleartext</authentication>
          <authentication>password-cleartext</authentication>
@@ -43,8 +50,8 @@ header('Content-Type: application/xml');
 $records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
 $records = dns_get_record('_pop3s._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
 if (count($records) == 0 || $records[0]['target'] != '') { ?>
 if (count($records) == 0 || $records[0]['target'] != '') { ?>
       <incomingServer type="pop3">
       <incomingServer type="pop3">
-         <hostname><?= $autodiscover_config['pop3']['server']; ?></hostname>
-         <port><?= $autodiscover_config['pop3']['port']; ?></port>
+         <hostname><?= $configuration['pop3']['server']; ?></hostname>
+         <port><?= $configuration['pop3']['port']; ?></port>
          <socketType>SSL</socketType>
          <socketType>SSL</socketType>
          <username>%EMAILADDRESS%</username>
          <username>%EMAILADDRESS%</username>
          <authentication>password-cleartext</authentication>
          <authentication>password-cleartext</authentication>
@@ -54,8 +61,8 @@ if (count($records) == 0 || $records[0]['target'] != '') { ?>
 $records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
 $records = dns_get_record('_pop3._tcp.' . $domain, DNS_SRV); // check if POP3 is announced as "not provided" via SRV record
 if (count($records) == 0 || $records[0]['target'] != '') { ?>
 if (count($records) == 0 || $records[0]['target'] != '') { ?>
       <incomingServer type="pop3">
       <incomingServer type="pop3">
-         <hostname><?= $autodiscover_config['pop3']['server']; ?></hostname>
-         <port><?= $autodiscover_config['pop3']['tlsport']; ?></port>
+         <hostname><?= $configuration['pop3']['server']; ?></hostname>
+         <port><?= $configuration['pop3']['tlsport']; ?></port>
          <socketType>STARTTLS</socketType>
          <socketType>STARTTLS</socketType>
          <username>%EMAILADDRESS%</username>
          <username>%EMAILADDRESS%</username>
          <authentication>password-cleartext</authentication>
          <authentication>password-cleartext</authentication>
@@ -63,15 +70,15 @@ if (count($records) == 0 || $records[0]['target'] != '') { ?>
 <?php } ?>
 <?php } ?>
 
 
       <outgoingServer type="smtp">
       <outgoingServer type="smtp">
-         <hostname><?= $autodiscover_config['smtp']['server']; ?></hostname>
-         <port><?= $autodiscover_config['smtp']['port']; ?></port>
+         <hostname><?= $configuration['smtp']['server']; ?></hostname>
+         <port><?= $configuration['smtp']['port']; ?></port>
          <socketType>SSL</socketType>
          <socketType>SSL</socketType>
          <username>%EMAILADDRESS%</username>
          <username>%EMAILADDRESS%</username>
          <authentication>password-cleartext</authentication>
          <authentication>password-cleartext</authentication>
       </outgoingServer>
       </outgoingServer>
       <outgoingServer type="smtp">
       <outgoingServer type="smtp">
-         <hostname><?= $autodiscover_config['smtp']['server']; ?></hostname>
-         <port><?= $autodiscover_config['smtp']['tlsport']; ?></port>
+         <hostname><?= $configuration['smtp']['server']; ?></hostname>
+         <port><?= $configuration['smtp']['tlsport']; ?></port>
          <socketType>STARTTLS</socketType>
          <socketType>STARTTLS</socketType>
          <username>%EMAILADDRESS%</username>
          <username>%EMAILADDRESS%</username>
          <authentication>password-cleartext</authentication>
          <authentication>password-cleartext</authentication>