Bug #23121 » 15034_v4.diff
t3lib/class.t3lib_div.php (Arbeitskopie) | ||
---|---|---|
$retVal = $DR;
|
||
break;
|
||
case 'TYPO3_HOST_ONLY':
|
||
$p = explode(':',self::getIndpEnv('HTTP_HOST'));
|
||
$retVal = $p[0];
|
||
break;
|
||
case 'TYPO3_PORT':
|
||
$p = explode(':',self::getIndpEnv('HTTP_HOST'));
|
||
$retVal = $p[1];
|
||
break;
|
||
// check for an IPv6 Address with specification of a port like http://[::1]:81/
|
||
if (strpos(self::getIndpEnv('HTTP_HOST'), ']:') !== FALSE) {
|
||
// extract IPv6 Address without port but keep brackets - substring starting at pos 0 and ending at first occurence of strpos() + 1
|
||
// strpos() returns the position of the closing bracket, since we want to keep that bracket we add (int) 1 to the length
|
||
$retVal = substr(self::getIndpEnv('HTTP_HOST'), 0, (strpos(self::getIndpEnv('HTTP_HOST'), ']:') + 1));
|
||
}
|
||
// in case no different port is used
|
||
elseif (strpos(self::getIndpEnv('HTTP_HOST'), ']') !== FALSE) {
|
||
$retVal = self::getIndpEnv('HTTP_HOST');
|
||
}
|
||
// everything else can use the old method
|
||
else {
|
||
list($retVal) = explode(':', self::getIndpEnv('HTTP_HOST'));
|
||
}
|
||
break;
|
||
case 'TYPO3_PORT':
|
||
// the whole shebang again for the port (see abobe TYPO3_HOST_ONLY)
|
||
if (strpos(self::getIndpEnv('HTTP_HOST'), ']:') !== FALSE) {
|
||
// extracting the port by substr()ing and adding (int) 2 to the starting position to omit ']:'
|
||
$retVal = substr(self::getIndpEnv('HTTP_HOST'), (strpos(self::getIndpEnv('HTTP_HOST'), ']:') + 2));
|
||
}
|
||
// in case no different port is used
|
||
elseif (strpos(self::getIndpEnv('HTTP_HOST'), ']') !== FALSE) {
|
||
// returning an emptry string defaults to port 80
|
||
$retVal = '';
|
||
}
|
||
// everything else can use the old method
|
||
else {
|
||
list(, $retVal) = explode(':', self::getIndpEnv('HTTP_HOST'));
|
||
}
|
||
break;
|
||
case 'TYPO3_REQUEST_HOST':
|
||
$retVal = (self::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://').
|
||
self::getIndpEnv('HTTP_HOST');
|