Project

General

Profile

Bug #17215 » TYPO3-lockSSLPort-2.patch

Administrator Admin, 2008-02-18 09:40

View differences:

t3lib/class.t3lib_userauth.php (working copy)
$backendScript = t3lib_BEfunc::getBackendScript();
if($requestStr == $backendScript && t3lib_div::getIndpEnv('TYPO3_SSL')) {
list(,$url) = explode('://',t3lib_div::getIndpEnv('TYPO3_SITE_URL'),2);
if(intval($TYPO3_CONF_VARS['BE']['lockSSLPort'])) {
$sslPortSuffix = ':'.intval($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 (working copy)
// Check SSL (https)
// **********************
if (intval($TYPO3_CONF_VARS['BE']['lockSSL']) && !(defined('TYPO3_cliMode') && TYPO3_cliMode)) {
if(intval($TYPO3_CONF_VARS['BE']['lockSSLPort'])) {
$sslPortSuffix = ':'.intval($TYPO3_CONF_VARS['BE']['lockSSLPort']);
} else {
$sslPortSuffix = '';
}
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...
(2-2/2)