From 1d2828d3cbc71f268a02db64384e28b27ce42874 Mon Sep 17 00:00:00 2001 From: Robert Lyon Date: Fri, 24 Apr 2015 15:42:19 +1200 Subject: [PATCH] Stripping the port number from noreplyaddress (Bug #1447892) In case the site has port specified in its server['HOST']. Change-Id: Ia033270487a14a537dada5697b8c2d3848d490fa Signed-off-by: Robert Lyon --- htdocs/init.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/htdocs/init.php b/htdocs/init.php index f4079e8b36..1d27e7356a 100644 --- a/htdocs/init.php +++ b/htdocs/init.php @@ -317,14 +317,8 @@ if ($CFG->sslproxy === false && isset($_SERVER['REMOTE_ADDR']) && (!isset($_SERV parse_url($CFG->wwwroot, PHP_URL_SCHEME) === 'https'){ redirect(get_relative_script_path()); } -if (!isset($CFG->noreplyaddress) && isset($_SERVER['HTTP_HOST'])) { - $noreplyaddress = 'noreply@'; - $host = (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST']; - if (false !== strpos($host, ',')) { - list($host) = explode(',', $host); - $host = trim($host); - } - $noreplyaddress .= $host; +if (!isset($CFG->noreplyaddress) && isset($CFG->wwwroot)) { + $noreplyaddress = 'noreply@' . parse_url($CFG->wwwroot, PHP_URL_HOST); try { set_config('noreplyaddress', $noreplyaddress); } -- GitLab