Correct SERVER_NAME to HTTP_HOST to get a valid host url
This commit is contained in:
parent
e2a3536d7e
commit
6c1aa15879
@ -666,7 +666,7 @@ class User extends Base {
|
||||
// Enforce a page reload and point towards login with referrer included, if supplied
|
||||
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
|
||||
$pushto = $_SERVER['SCRIPT_NAME'].'?page=login';
|
||||
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['SERVER_NAME'] . $port . $pushto : 'http://' . $_SERVER['SERVER_NAME'] . $port . $pushto;
|
||||
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['HTTP_HOST'] . $port . $pushto : 'http://' . $_SERVER['HTTP_HOST'] . $port . $pushto;
|
||||
if (!headers_sent()) header('Location: ' . $location);
|
||||
exit('<meta http-equiv="refresh" content="0; url=' . $location . '"/>');
|
||||
}
|
||||
|
||||
@ -687,7 +687,7 @@ class Swift_Mime_SimpleMimeEntity implements Swift_Mime_MimeEntity
|
||||
protected function getRandomId()
|
||||
{
|
||||
$idLeft = md5(getmypid() . '.' . time() . '.' . uniqid(mt_rand(), true));
|
||||
$idRight = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'swift.generated';
|
||||
$idRight = !empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'swift.generated';
|
||||
$id = $idLeft . '@' . $idRight;
|
||||
|
||||
try {
|
||||
|
||||
@ -477,10 +477,10 @@ abstract class Swift_Transport_AbstractSmtpTransport implements Swift_Transport
|
||||
/** Try to determine the hostname of the server this is run on */
|
||||
private function _lookupHostname()
|
||||
{
|
||||
if (!empty($_SERVER['SERVER_NAME'])
|
||||
&& $this->_isFqdn($_SERVER['SERVER_NAME']))
|
||||
if (!empty($_SERVER['HTTP_HOST'])
|
||||
&& $this->_isFqdn($_SERVER['HTTP_HOST']))
|
||||
{
|
||||
$this->_domain = $_SERVER['SERVER_NAME'];
|
||||
$this->_domain = $_SERVER['HTTP_HOST'];
|
||||
} elseif (!empty($_SERVER['SERVER_ADDR'])) {
|
||||
$this->_domain = sprintf('[%s]', $_SERVER['SERVER_ADDR']);
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ if ($user->isAuthenticated()) {
|
||||
$user->setUserFailed($_SESSION['USERDATA']['id'], 0);
|
||||
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
|
||||
$pushto = $_SERVER['SCRIPT_NAME'].'?page=dashboard';
|
||||
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['SERVER_NAME'] . $port . $pushto : 'http://' . $_SERVER['SERVER_NAME'] . $port . $pushto;
|
||||
$location = (@$_SERVER['HTTPS'] == 'on') ? 'https://' . $_SERVER['HTTP_HOST'] . $port . $pushto : 'http://' . $_SERVER['HTTP_HOST'] . $port . $pushto;
|
||||
header("Location: " . $location);
|
||||
}
|
||||
// Somehow we still need to load this empty template
|
||||
|
||||
@ -29,7 +29,7 @@ if (!empty($_POST['username']) && !empty($_POST['password'])) {
|
||||
if ($user->checkLogin(@$_POST['username'], @$_POST['password']) ) {
|
||||
$port = ($_SERVER["SERVER_PORT"] == "80" || $_SERVER["SERVER_PORT"] == "443") ? "" : (":".$_SERVER["SERVER_PORT"]);
|
||||
$location = (@$_SERVER['HTTPS'] == "on") ? 'https://' : 'http://';
|
||||
$location .= $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME'];
|
||||
$location .= $_SERVER['HTTP_HOST'] . $port . $_SERVER['SCRIPT_NAME'];
|
||||
$location.= '?page=dashboard';
|
||||
if (!headers_sent()) header('Location: ' . $location);
|
||||
exit('<meta http-equiv="refresh" content="0; url=' . htmlspecialchars($location) . '"/>');
|
||||
|
||||
@ -40,7 +40,7 @@ define("BASEPATH", dirname(__FILE__) . "/");
|
||||
include_once(BASEPATH . '../include/bootstrap.php');
|
||||
|
||||
// switch to https if config option is enabled
|
||||
$hts = ($config['https_only'] && (!empty($_SERVER['QUERY_STRING']))) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'] : "https://".$_SERVER['SERVER_NAME'].$_SERVER['SCRIPT_NAME'];
|
||||
$hts = ($config['https_only'] && (!empty($_SERVER['QUERY_STRING']))) ? "https://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?".$_SERVER['QUERY_STRING'] : "https://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
|
||||
($config['https_only'] && @!$_SERVER['HTTPS']) ? exit(header("Location: ".$hts)):0;
|
||||
|
||||
// Rate limiting, we use our initilized memcache from bootstrap/autoloader
|
||||
|
||||
Loading…
Reference in New Issue
Block a user