From 8fd2e645f3d40c7886dde7d5206d27c050fa4098 Mon Sep 17 00:00:00 2001 From: Aaron Spettl Date: Thu, 15 Feb 2018 18:38:56 +0100 Subject: [PATCH 1/4] Use "Encryption" tag for SMTP instead of "SSL" for autodiscover.xml --- autodiscover.xml.php | 3 ++- mail/autodiscover.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/autodiscover.xml.php b/autodiscover.xml.php index aedf5e3..509b58c 100644 --- a/autodiscover.xml.php +++ b/autodiscover.xml.php @@ -16,7 +16,8 @@ $xml = str_replace("%TTL%", $config['ttl'], $xml); -$xml = str_replace("%SERVER/SMTP/SSL_ON%", isOnOrOff($config['server']['smtp']['socket'] == "SSL"), $xml); +$xml = str_replace("%SERVER/SMTP/ENCRYPTION%", str_replace("STARTTLS", "TLS", $config['server']['smtp']['socket']), $xml); + $xml = str_replace("%SERVER/IMAP/SSL_ON%", isOnOrOff($config['server']['imap']['socket'] == "SSL"), $xml); $xml = str_replace("%SERVER/IMAP/DOMAIN_REQUIRED%", isOnOrOff($config['server']['domain_required']), $xml); diff --git a/mail/autodiscover.xml b/mail/autodiscover.xml index 2d8aa65..15a96b2 100644 --- a/mail/autodiscover.xml +++ b/mail/autodiscover.xml @@ -150,7 +150,7 @@ If this value is true, then the SMTP server requires that email be downloaded be %SERVER/SMTP/PORT% %SERVER/SMTP/DOMAIN_REQUIRED% off - %SERVER/SMTP/SSL_ON% + %SERVER/SMTP/ENCRYPTION% on on off From 0ae1a9fdc5e9d0eac31a02b17484572ce7d5e1e1 Mon Sep 17 00:00:00 2001 From: Aaron Spettl Date: Sun, 25 Aug 2019 15:01:54 +0200 Subject: [PATCH 2/4] Exceptions instead of warnings on reading file problems --- autodiscover.xml.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/autodiscover.xml.php b/autodiscover.xml.php index 509b58c..d30db9e 100644 --- a/autodiscover.xml.php +++ b/autodiscover.xml.php @@ -56,11 +56,19 @@ function isOnOrOff ($value) { } function loadConfig () { - return json_decode(implode('', file('settings.json')), true); + $content = file_get_contents('settings.json'); + if ($content === FALSE) { + throw new Exception('Error reading settings.json.'); + } + return json_decode($content, true, 512, JSON_THROW_ON_ERROR); } function loadTemplate ($file) { - return implode("",file($file)); + $content = file_get_contents($file); + if ($content === FALSE) { + throw new Exception('Error reading template file.'); + } + return $content; } function determineTemplateFile () { From 0744b93c61e93dd4f95c09d4550ac42aec1e5262 Mon Sep 17 00:00:00 2001 From: Aaron Spettl Date: Sun, 25 Aug 2019 15:13:38 +0200 Subject: [PATCH 3/4] Require PHP 7.3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 575aacf..e348521 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Installation ### Apache Webserver -You need an Apache webserver with PHP5 preconfigures. You can then configure your Virtual Host like this +You need an Apache webserver with (at least) PHP 7.3 preconfigured. You can then configure your Virtual Host like this ``` From be8a74205164ab5c76c9c35260c3a6902a4b4790 Mon Sep 17 00:00:00 2001 From: Aaron Spettl Date: Sun, 25 Aug 2019 15:16:34 +0200 Subject: [PATCH 4/4] Make use of PHP 7 null coalesce operator --- autodiscover.xml.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autodiscover.xml.php b/autodiscover.xml.php index d30db9e..4bf2487 100644 --- a/autodiscover.xml.php +++ b/autodiscover.xml.php @@ -73,7 +73,7 @@ function loadTemplate ($file) { function determineTemplateFile () { - $template = array_key_exists('template', $_GET) ? $_GET['template'] : null; + $template = $_GET['template'] ?? null; switch($template) { @@ -93,7 +93,7 @@ function determineTemplateFile () { function getRequestEmail () { - $email = array_key_exists('email', $_GET) ? $_GET['email'] : null; + $email = $_GET['email'] ?? null; return filter_var($email, FILTER_VALIDATE_EMAIL); }