Revert "[Web] Fix broken autoconfig ports, fixes #4221 (#4223)" (#4226)

This reverts commit 9afea99189.
This commit is contained in:
André Peters 2021-08-10 09:05:01 +02:00 committed by GitHub
parent f5b709c776
commit 639e751678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 20 deletions

View File

@ -2219,14 +2219,4 @@ function cleanupCSS($ignore = '', $folder = '/tmp/*.css') {
} }
} }
function get_remote_ip() { ?>
$remote = $_SERVER['REMOTE_ADDR'];
if (filter_var($remote, FILTER_VALIDATE_IP) === false) {
return '0.0.0.0';
}
return $remote;
}
function getEnvPort(string $name): int {
return (int)filter_var(substr(getenv($name), strrpos(getenv($name), ':')), FILTER_SANITIZE_NUMBER_INT);
}

View File

@ -5,8 +5,6 @@
header('Location: /SOGo', true, 307); header('Location: /SOGo', true, 307);
exit; exit;
}*/ }*/
// Load core functions first
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.inc.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/vars.inc.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/vars.inc.php';
$default_autodiscover_config = $autodiscover_config; $default_autodiscover_config = $autodiscover_config;
@ -173,7 +171,17 @@ function exception_handler($e) {
} }
set_exception_handler('exception_handler'); set_exception_handler('exception_handler');
// Load session // TODO: Move function
function get_remote_ip() {
$remote = $_SERVER['REMOTE_ADDR'];
if (filter_var($remote, FILTER_VALIDATE_IP) === false) {
return '0.0.0.0';
}
return $remote;
}
// Load core functions first
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/functions.inc.php';
require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php'; require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/sessions.inc.php';
// IMAP lib // IMAP lib

View File

@ -45,18 +45,18 @@ $autodiscover_config = array(
// The autoconfig service will additionally announce the STARTTLS-enabled ports, specified in the "tlsport" variable. // The autoconfig service will additionally announce the STARTTLS-enabled ports, specified in the "tlsport" variable.
'imap' => array( 'imap' => array(
'server' => $mailcow_hostname, 'server' => $mailcow_hostname,
'port' => getEnvPort('IMAPS_PORT'), 'port' => (int)filter_var(substr(getenv('IMAPS_PORT'), strrpos(getenv('IMAPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT),
'tlsport' => getEnvPort('IMAP_PORT') 'tlsport' => (int)filter_var(substr(getenv('POP_PORT'), strrpos(getenv('IMAP_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT)
), ),
'pop3' => array( 'pop3' => array(
'server' => $mailcow_hostname, 'server' => $mailcow_hostname,
'port' => getEnvPort('POPS_PORT'), 'port' => (int)filter_var(substr(getenv('POPS_PORT'), strrpos(getenv('POPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT),
'tlsport' => getEnvPort('POP_PORT') 'tlsport' => (int)filter_var(substr(getenv('POP_PORT'), strrpos(getenv('POP_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT)
), ),
'smtp' => array( 'smtp' => array(
'server' => $mailcow_hostname, 'server' => $mailcow_hostname,
'port' => getEnvPort('SMTPS_PORT'), 'port' => (int)filter_var(substr(getenv('SMTPS_PORT'), strrpos(getenv('SMTPS_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT),
'tlsport' => getEnvPort('SUBMISSION_PORT') 'tlsport' => (int)filter_var(substr(getenv('SUBMISSION_PORT'), strrpos(getenv('SUBMISSION_PORT'), ':')), FILTER_SANITIZE_NUMBER_INT)
), ),
'activesync' => array( 'activesync' => array(
'url' => 'https://' . $mailcow_hostname . ($https_port == 443 ? '' : ':' . $https_port) . '/Microsoft-Server-ActiveSync', 'url' => 'https://' . $mailcow_hostname . ($https_port == 443 ? '' : ':' . $https_port) . '/Microsoft-Server-ActiveSync',