Project

General

Profile

Feature #23491 » addHTTPSEnforcement_v3.diff

Administrator Admin, 2010-09-08 08:48

View differences:

t3lib/utility/class.t3lib_utility_http.php (Arbeitskopie)
const HTTP_STATUS_504 = 'HTTP/1.1 504 Gateway Timeout';
const HTTP_STATUS_505 = 'HTTP/1.1 505 Version Not Supported';
// URL Schemes
const SCHEME_HTTP = 1;
const SCHEME_HTTPS = 2;
/**
* Sends a redirect header response and exits. Additionaly the URL is
* checked and if needed corrected to match the format required for a
typo3/sysext/cms/ext_tables.php (Arbeitskopie)
'default' => '0'
)
),
'url_scheme' => array (
'exclude' => 1,
'label' => 'LLL:EXT:cms/locallang_tca.xml:pages.url_scheme',
'config' => array (
'type' => 'select',
'items' => array (
array('LLL:EXT:cms/locallang_tca.xml:pages.url_scheme.I.0', '0'),
array('LLL:EXT:cms/locallang_tca.xml:pages.url_scheme.I.1', '1'),
array('LLL:EXT:cms/locallang_tca.xml:pages.url_scheme.I.2', '2')
),
'default' => '0'
)
),
'fe_group' => array (
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xml:LGL.fe_group',
......
$TCA['pages']['palettes'] = t3lib_div::array_merge($TCA['pages']['palettes'],array(
'1' => array('showitem' => 'starttime, endtime, extendToSubpages'),
'2' => array('showitem' => 'layout, lastUpdated, newUntil, no_search'),
'3' => array('showitem' => 'alias, target, no_cache, cache_timeout'),
'3' => array('showitem' => 'alias, target, no_cache, cache_timeout, url_scheme'),
'5' => array('showitem' => 'author, author_email', 'canNotCollapse' => 1)
));
typo3/sysext/cms/locallang_tca.xml (Arbeitskopie)
<label index="pages.layout.I.1">Layout 1</label>
<label index="pages.layout.I.2">Layout 2</label>
<label index="pages.layout.I.3">Layout 3</label>
<label index="pages.url_scheme">URL-Scheme</label>
<label index="pages.url_scheme.I.0">Stay in context</label>
<label index="pages.url_scheme.I.1">Force HTTP</label>
<label index="pages.url_scheme.I.2">Force HTTPS</label>
<label index="pages.extendToSubpages">Include subpages:</label>
<label index="pages.nav_title">Navigation title:</label>
<label index="pages.nav_hide">Hide in menu:</label>
typo3/sysext/cms/ext_tables.sql (Arbeitskopie)
fe_group varchar(100) DEFAULT '0' NOT NULL,
subtitle varchar(255) DEFAULT '' NOT NULL,
layout tinyint(3) unsigned DEFAULT '0' NOT NULL,
url_scheme tinyint(3) unsigned DEFAULT '0' NOT NULL,
target varchar(80) DEFAULT '' NOT NULL,
media text,
lastUpdated int(10) unsigned DEFAULT '0' NOT NULL,
typo3/sysext/cms/tslib/class.tslib_fe.php (Arbeitskopie)
$this->pageNotFoundAndExit($pNotFoundMsg[$this->pageNotFound]);
}
if ($this->page['url_scheme'] > 0) {
$newUrl = '';
if ((int)$this->page['url_scheme'] === t3lib_utility_http::SCHEME_HTTP
&& substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), 0, 5) == 'https'
) {
$newUrl = 'http' . substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), 5);
} elseif ((int)$this->page['url_scheme'] === t3lib_utility_http::SCHEME_HTTPS
&& substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), 0, 4) == 'http'
) {
$newUrl = 'https' . substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), 4);
}
if ($newUrl !== '') {
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$headerCode = t3lib_utility_Http::HTTP_STATUS_303;
} else {
$headerCode = t3lib_utility_Http::HTTP_STATUS_301;
}
t3lib_utility_http::redirect($newUrl, $headerCode);
}
}
// set no_cache if set
if ($this->page['no_cache']) {
$this->set_no_cache();
typo3/sysext/cms/tslib/class.tslib_content.php (Arbeitskopie)
}
$absoluteUrlScheme = 'http';
// URL shall be absolute:
if (isset($conf['forceAbsoluteUrl']) && $conf['forceAbsoluteUrl']) {
// If no domain records are defined, use current domain:
if ($targetDomain === '') {
$targetDomain = $currentDomain;
}
// Override scheme:
// URL shall be absolute:
if (isset($conf['forceAbsoluteUrl']) && $conf['forceAbsoluteUrl'] || $page['url_scheme'] > 0) {
// Override scheme:
if (isset($conf['forceAbsoluteUrl.']['scheme']) && $conf['forceAbsoluteUrl.']['scheme']) {
$absoluteUrlScheme = $conf['forceAbsoluteUrl.']['scheme'];
} elseif ($page['url_scheme'] > 0) {
$absoluteUrlScheme = $page['url_scheme'] == t3lib_utility_http::SCHEME_HTTP ? 'http' : 'https';
}
// If no domain records are defined, use current domain:
if ($targetDomain === '' && $conf['forceAbsoluteUrl'] ||
$absoluteUrlScheme !== substr(t3lib_div::getIndpEnv('TYPO3_REQUEST_URL'), 0, strlen($absoluteUrlScheme))
) {
$targetDomain = $currentDomain;
}
}
// If target page has a different domain and the current domain's linking scheme (e.g. simulateStaticDocuments/RealURL/...) should not be used
(2-2/3)