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 ``` diff --git a/autodiscover.xml.php b/autodiscover.xml.php index aedf5e3..4bf2487 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); @@ -55,16 +56,24 @@ 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 () { - $template = array_key_exists('template', $_GET) ? $_GET['template'] : null; + $template = $_GET['template'] ?? null; switch($template) { @@ -84,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); } 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