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

Refactored to use function, moved another function

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
This commit is contained in:
Kristian Feldsam
2021-08-10 02:08:04 +02:00
committed by GitHub
parent c13c521699
commit 9afea99189
3 changed files with 20 additions and 18 deletions

View File

@@ -2219,4 +2219,14 @@ 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);
}