Project

General

Profile

Bug #17215 » TYPO3-lockSSLPort.patch

Administrator Admin, 2008-02-17 23:18

View differences:

t3lib/class.t3lib_userauth.php (Arbeitskopie)
$backendScript = t3lib_BEfunc::getBackendScript();
if($requestStr == $backendScript && t3lib_div::getIndpEnv('TYPO3_SSL')) {
list(,$url) = explode('://',t3lib_div::getIndpEnv('TYPO3_SITE_URL'),2);
$sslPortSuffix = (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSLPort']) ?
':'.intval($GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSLPort']) : '');
$url = str_replace($sslPortSuffix, '', $url); // strip port from url
header('Location: http://'.$url.TYPO3_mainDir.$backendScript);
exit;
}
typo3/init.php (Arbeitskopie)
// Check SSL (https)
// **********************
if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && !(defined('TYPO3_cliMode') && TYPO3_cliMode)) {
$sslPortSuffix = intval($TYPO3_CONF_VARS['BE']['lockSSLPort']) ?
':'.intval($TYPO3_CONF_VARS['BE']['lockSSLPort']) : '';
if ($TYPO3_CONF_VARS['BE']['lockSSL'] == 3) {
$requestStr = substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT'), strlen(t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir));
if($requestStr == 'index.php' && !t3lib_div::getIndpEnv('TYPO3_SSL')) {
list(,$url) = explode('://',t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'),2);
header('Location: https://'.$url);
$address = substr($url, 0, strpos($url, '/'));
header('Location: https://'.$address.$sslPortSuffix.substr($url, strlen($address)));
exit;
}
} elseif (!t3lib_div::getIndpEnv('TYPO3_SSL') ) {
if ($TYPO3_CONF_VARS['BE']['lockSSL'] == 2) {
list(,$url) = explode('://',t3lib_div::getIndpEnv('TYPO3_SITE_URL').TYPO3_mainDir,2);
header('Location: https://'.$url); // Just point us away from here...
$address = substr($url, 0, strpos($url, '/'));
header('Location: https://'.$address.$sslPortSuffix.substr($url, strlen($address)));
} else {
header('Status: 404 Not Found'); // Send Not Found header - if the webserver can make use of it...
header('Location: http://'); // Just point us away from here...
(1-1/2)