2 namespace TYPO3\CMS\Frontend\Controller;
25 use TYPO3\CMS\Core\Locking\Exception\LockAcquireWouldBlockException;
446 'onmousemove' => array(),
447 'onmouseup' => array(),
448 'onkeydown' => array(),
449 'onkeyup' => array(),
450 'onkeypress' => array(),
452 'onunload' => array()
909 if ($this->TYPO3_CONF_VARS[
'FE'][
'disableNoCacheParameter']) {
910 $warning =
'&no_cache=1 has been ignored because $TYPO3_CONF_VARS[\'FE\'][\'disableNoCacheParameter\'] is set!';
913 $warning =
'&no_cache=1 has been supplied, so caching is disabled! URL: "' .
GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_URL') .
'"';
920 $this->MP = $this->TYPO3_CONF_VARS[
'FE'][
'enable_mount_pids'] ? (string)
$MP :
'';
923 $this->uniqueString = md5(microtime());
927 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'tslib_fe-PostProc'])) {
928 $_params = array(
'pObj' => &$this);
929 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'tslib_fe-PostProc'] as $_funcRef) {
942 if ($this->pageRenderer !== null) {
946 $this->pageRenderer->setTemplateFile(
'EXT:frontend/Resources/Private/Templates/MainPage.html');
947 $this->pageRenderer->setBackPath(TYPO3_mainDir);
971 }
catch (\RuntimeException $exception) {
972 switch ($exception->getCode()) {
975 $message =
'Cannot connect to the configured database "' . TYPO3_db .
'"';
985 $message =
'The current username, password or host was not accepted when' .
' the connection to the database was attempted to be established!';
998 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'connectToDB'])) {
999 $_params = array(
'pObj' => &$this);
1000 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'connectToDB'] as $_funcRef) {
1018 $row = $db->exec_SELECTgetSingleRow(
'params',
'cache_md5params',
'md5hash=' . $db->fullQuoteStr($this->RDCT,
'cache_md5params'));
1021 header(
'Location: ' . $row[
'params']);
1064 $this->fe_user->lockIP = $this->TYPO3_CONF_VARS[
'FE'][
'lockIP'];
1065 $this->fe_user->checkPid = $this->TYPO3_CONF_VARS[
'FE'][
'checkFeUserPid'];
1066 $this->fe_user->lifetime = (int)$this->TYPO3_CONF_VARS[
'FE'][
'lifetime'];
1074 if (md5(($fe_sParts[0] .
'/' . $this->TYPO3_CONF_VARS[
'SYS'][
'encryptionKey'])) === (
string)$fe_sParts[1]) {
1076 $_COOKIE[$cookieName] = $fe_sParts[0];
1077 if (isset($_SERVER[
'HTTP_COOKIE'])) {
1079 $_SERVER[
'HTTP_COOKIE'] .=
';' . $cookieName .
'=' . $fe_sParts[0];
1081 $this->fe_user->forceSetCookie = 1;
1082 $this->fe_user->dontSetCookie =
false;
1086 $this->fe_user->start();
1087 $this->fe_user->unpack_uc(
'');
1089 $this->fe_user->fetchSessionData();
1092 if (is_array($recs)) {
1093 $this->fe_user->record_registration($recs, $this->TYPO3_CONF_VARS[
'FE'][
'maxSessionDataSize']);
1096 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'initFEuser'])) {
1097 $_params = array(
'pObj' => &$this);
1098 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'initFEuser'] as $_funcRef) {
1103 if (is_array($this->fe_user->user) && $this->fe_user->user[
'uid'] && $this->fe_user->user[
'is_online'] <
$GLOBALS[
'EXEC_TIME'] - 60) {
1104 $this->
getDatabaseConnection()->exec_UPDATEquery(
'fe_users',
'uid=' . (
int)$this->fe_user->user[
'uid'], array(
'is_online' =>
$GLOBALS[
'EXEC_TIME']));
1119 $this->fe_user->fetchGroupData();
1120 if (is_array($this->fe_user->user) && !empty($this->fe_user->groupData[
'uid'])) {
1122 $this->loginUser =
true;
1124 $this->gr_list =
'0,-2';
1125 $gr_array = $this->fe_user->groupData[
'uid'];
1127 $this->loginUser =
false;
1129 $this->gr_list =
'0,-1';
1130 if ($this->loginAllowedInBranch) {
1132 $gr_array = $this->fe_user->groupData[
'uid'];
1135 $gr_array = array();
1140 $gr_array = array_unique($gr_array);
1143 if (!empty($gr_array) && !$this->loginAllowedInBranch_mode) {
1144 $this->gr_list .=
',' . implode(
',', $gr_array);
1146 if ($this->fe_user->writeDevLog) {
1158 return is_array($this->fe_user->user) || $this->gr_list !==
'0,-1';
1174 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkAlternativeIdMethods-PostProc'])) {
1175 $_params = array(
'pObj' => &$this);
1176 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkAlternativeIdMethods-PostProc'] as $_funcRef) {
1191 $this->showHiddenPage =
false;
1192 $this->showHiddenRecords =
false;
1195 $this->fePreview = 0;
1213 public function initializeBackendUser()
1216 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/index_ts.php'][
'preBeUser'])) {
1217 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/index_ts.php'][
'preBeUser'] as $_funcRef) {
1227 $GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_start'] = microtime(
true);
1237 $BE_USER->lockIP = $this->TYPO3_CONF_VARS[
'BE'][
'lockIP'];
1240 $BE_USER->unpack_uc(
'');
1241 if (!empty($BE_USER->user[
'uid'])) {
1242 $BE_USER->fetchGroupData();
1243 $this->beUserLogin =
true;
1246 if (!$BE_USER->checkLockToIP() || !$BE_USER->checkBackendAccessSettingsFromInitPhp() || empty($BE_USER->user[
'uid'])) {
1248 $this->beUserLogin =
false;
1251 $GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_end'] = microtime(
true);
1254 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/index_ts.php'][
'postBeUser'])) {
1256 'BE_USER' => &$BE_USER
1258 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/index_ts.php'][
'postBeUser'] as $_funcRef) {
1276 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'determineId-PreProcessing'])) {
1277 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'determineId-PreProcessing'] as $functionReference) {
1278 $parameters = array(
'parentObject' => $this);
1286 $originalFrontendUser = null;
1290 if ($this->beUserLogin && $backendUser->adminPanel instanceof
AdminPanelView) {
1291 $this->fePreview = (bool)$backendUser->adminPanel->extGetFeAdminValue(
'preview');
1293 if ($this->fePreview) {
1294 if ($this->fe_user->user) {
1295 $originalFrontendUser = $this->fe_user->user;
1297 $this->showHiddenPage = (bool)$backendUser->adminPanel->extGetFeAdminValue(
'preview',
'showHiddenPages');
1298 $this->showHiddenRecords = (bool)$backendUser->adminPanel->extGetFeAdminValue(
'preview',
'showHiddenRecords');
1300 $simTime = $backendUser->adminPanel->extGetFeAdminValue(
'preview',
'simulateDate');
1302 $GLOBALS[
'SIM_EXEC_TIME'] = $simTime;
1303 $GLOBALS[
'SIM_ACCESS_TIME'] = $simTime - $simTime % 60;
1306 $simUserGroup = $backendUser->adminPanel->extGetFeAdminValue(
'preview',
'simulateUserGroup');
1309 if ($this->fe_user->user) {
1310 $this->fe_user->user[$this->fe_user->usergroup_column] =
$simUserGroup;
1312 $this->fe_user->user = array(
1317 if (!
$simUserGroup && !$simTime && !$this->showHiddenPage && !$this->showHiddenRecords) {
1318 $this->fePreview = 0;
1325 $this->fePreview = 1;
1326 $this->showHiddenPage =
true;
1332 $temp_sys_page->init($this->showHiddenPage);
1334 if (empty($temp_sys_page->getRootLine($this->id, $this->MP)) && $temp_sys_page->error_getRootLine_failPid == -1) {
1336 $temp_sys_page->versioningPreview =
true;
1337 if (!empty($temp_sys_page->getRootLine($this->id, $this->MP))) {
1339 $this->fePreview = 1;
1347 $backendUser->user[
'workspace_preview']
1358 $this->fePreview = 2;
1361 if ($this->fePreview) {
1369 if ($this->beUserLogin && $this->fePreview) {
1370 if (!$backendUser->doesUserHaveAccess($this->page, 1)) {
1373 $this->fe_user->user = $originalFrontendUser;
1381 if (!$this->loginAllowedInBranch) {
1384 if ($this->loginAllowedInBranch_mode ==
'all') {
1386 $this->fe_user->hideActiveLogin();
1387 $this->gr_list =
'0,-1';
1389 $this->gr_list =
'0,-2';
1397 $this->
id = ($this->contentPid = (int)$this->
id);
1399 $this->type = (int)$this->type;
1401 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'determineId-PostProc'])) {
1402 $_params = array(
'pObj' => &$this);
1403 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'determineId-PostProc'] as $_funcRef) {
1418 $pageSelectCondition = $field .
'=' . $this->
getDatabaseConnection()->fullQuoteStr($this->
id,
'pages');
1419 $page = $this->
getDatabaseConnection()->exec_SELECTgetSingleRow(
'uid,hidden,starttime,endtime',
'pages', $pageSelectCondition .
' AND pid>=0 AND deleted=0');
1421 if ($workspace !== 0 && $workspace !==
false) {
1424 $pageSelectObject->versioningPreview =
true;
1425 $pageSelectObject->init(
false);
1426 $targetPage = $pageSelectObject->getWorkspaceVersionOfRecord($this->
whichWorkspace(),
'pages',
$page[
'uid']);
1427 $result = $targetPage === -1 || $targetPage === -2;
1446 $timeTracker->push(
'fetch_the_id initialize/',
'');
1449 $this->sys_page->versioningPreview = $this->fePreview === 2 || (int)$this->workspacePreview || (
bool)
GeneralUtility::_GP(
'ADMCMD_view');
1450 $this->sys_page->versioningWorkspaceId = $this->
whichWorkspace();
1451 $this->sys_page->init($this->showHiddenPage);
1458 $idParts = explode(
'.', $this->
id, 2);
1459 $this->
id = $idParts[0];
1460 if (isset($idParts[1])) {
1461 $this->type = $idParts[1];
1467 $this->
id = (int)$this->
id;
1468 $this->type = (int)$this->type;
1469 $timeTracker->pull();
1471 $timeTracker->push(
'fetch_the_id domain/',
'');
1473 $this->domainStartPage = $this->
findDomainRecord($this->TYPO3_CONF_VARS[
'SYS'][
'recursiveDomainSearch']);
1475 if ($this->domainStartPage) {
1480 $theFirstPage = $this->sys_page->getFirstWebPage($this->
id);
1481 if ($theFirstPage) {
1482 $this->
id = $theFirstPage[
'uid'];
1484 $message =
'No pages are found on the rootlevel!';
1494 $timeTracker->pull();
1495 $timeTracker->push(
'fetch_the_id rootLine/',
'');
1499 $timeTracker->pull();
1500 if ($this->pageNotFound && $this->TYPO3_CONF_VARS[
'FE'][
'pageNotFound_handling']) {
1501 $pNotFoundMsg = array(
1502 1 =>
'ID was not an accessible page',
1503 2 =>
'Subsection was found and not accessible',
1504 3 =>
'ID was outside the domain',
1505 4 =>
'The requested page alias does not exist'
1509 if ($this->page[
'url_scheme'] > 0) {
1517 if ($newUrl !==
'') {
1518 if ($_SERVER[
'REQUEST_METHOD'] ===
'POST') {
1527 if ($this->page[
'no_cache']) {
1528 $this->
set_no_cache(
'no_cache is set in page properties');
1531 $this->
register[
'SYS_LASTCHANGED'] = (int)$this->page[
'tstamp'];
1532 if ($this->
register[
'SYS_LASTCHANGED'] < (
int)$this->page[
'SYS_LASTCHANGED']) {
1533 $this->
register[
'SYS_LASTCHANGED'] = (int)$this->page[
'SYS_LASTCHANGED'];
1535 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'fetchPageId-PostProcessing'])) {
1536 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'fetchPageId-PostProcessing'] as $functionReference) {
1537 $parameters = array(
'parentObject' => $this);
1560 $this->page = $this->sys_page->getPage($this->
id);
1561 if (empty($this->page)) {
1564 $this->pageNotFound = 1;
1565 $this->rootLine = $this->sys_page->getRootLine($this->
id, $this->MP);
1566 if (!empty($this->rootLine)) {
1567 $c = count($this->rootLine) - 1;
1570 $this->pageAccessFailureHistory[
'direct_access'][] = $this->rootLine[$c];
1573 $this->
id = $this->rootLine[$c][
'uid'];
1574 $this->page = $this->sys_page->getPage($this->
id);
1575 if (!empty($this->page)) {
1581 if (empty($this->page)) {
1582 $message =
'The requested page does not exist!';
1583 if ($this->TYPO3_CONF_VARS[
'FE'][
'pageNotFound_handling']) {
1593 $message =
'The requested page does not exist!';
1594 if ($this->TYPO3_CONF_VARS[
'FE'][
'pageNotFound_handling']) {
1610 $this->page = $this->
getPageShortcut($this->page[
'shortcut'], $this->page[
'shortcut_mode'], $this->page[
'uid']);
1611 $this->
id = $this->page[
'uid'];
1618 $this->page = $this->sys_page->getPage($this->page[
'mount_pid']);
1619 if (empty($this->page)) {
1620 $message =
'This page (ID ' . $this->originalMountPointPage[
'uid'] .
') is of type "Mount point" and '
1621 .
'mounts a page which is not accessible (ID ' . $this->originalMountPointPage[
'mount_pid'] .
').';
1624 $this->MP = $this->page[
'uid'] .
'-' . $this->originalMountPointPage[
'uid'];
1625 $this->
id = $this->page[
'uid'];
1628 $this->rootLine = $this->sys_page->getRootLine($this->
id, $this->MP);
1630 if (empty($this->rootLine)) {
1632 if ($this->sys_page->error_getRootLine_failPid == -1 && $ws) {
1633 $this->sys_page->versioningPreview =
true;
1634 $this->sys_page->versioningWorkspaceId = $ws;
1635 $this->rootLine = $this->sys_page->getRootLine($this->
id, $this->MP);
1637 if (empty($this->rootLine)) {
1638 $message =
'The requested page didn\'t have a proper connection to the tree-root!';
1642 $rootline =
'(' . $this->sys_page->error_getRootLine .
')';
1647 $this->fePreview = 1;
1651 if (empty($this->rootLine)) {
1652 $message =
'The requested page was not accessible!';
1660 $el = reset($this->rootLine);
1661 $this->
id = $el[
'uid'];
1662 $this->page = $this->sys_page->getPage($this->
id);
1663 $this->rootLine = $this->sys_page->getRootLine($this->
id, $this->MP);
1683 public function getPageShortcut($SC, $mode, $thisUid, $itera = 20, $pageLog = array(), $disableGroupCheck =
false)
1694 $randval = (int)rand(0, count($pageArray) - 1);
1699 foreach ($pageArray as $pV) {
1707 $message =
'This page (ID ' . $thisUid .
') is of type "Shortcut" and configured to redirect to a subpage. ' .
'However, this page has no accessible subpages.';
1712 $parent = $this->sys_page->getPage($idArray[0] ? $idArray[0] : $thisUid, $disableGroupCheck);
1713 $page = $this->sys_page->getPage($parent[
'pid'], $disableGroupCheck);
1715 $message =
'This page (ID ' . $thisUid .
') is of type "Shortcut" and configured to redirect to its parent page. ' .
'However, the parent page is not accessible.';
1720 $page = $this->sys_page->getPage($idArray[0], $disableGroupCheck);
1722 $message =
'This page (ID ' . $thisUid .
') is of type "Shortcut" and configured to redirect to a page, which is not accessible (ID ' . $idArray[0] .
').';
1728 if (!in_array(
$page[
'uid'], $pageLog) && $itera > 0) {
1729 $pageLog[] =
$page[
'uid'];
1732 $pageLog[] =
$page[
'uid'];
1733 $message =
'Page shortcuts were looping in uids ' . implode(
',', $pageLog) .
'...!';
1735 throw new \RuntimeException($message, 1294587212);
1750 $c = count($this->rootLine);
1751 $removeTheRestFlag = 0;
1752 for ($a = 0; $a < $c; $a++) {
1755 $this->pageAccessFailureHistory[
'sub_section'][] = $this->rootLine[$a];
1756 $removeTheRestFlag = 1;
1760 if ($this->beUserLogin) {
1765 $removeTheRestFlag = 1;
1769 $removeTheRestFlag = 1;
1772 if ($removeTheRestFlag) {
1774 $this->pageNotFound = 2;
1775 unset($this->rootLine[$a]);
1778 return $removeTheRestFlag;
1793 if (isset($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_checkEnableFields']) && is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_checkEnableFields'])) {
1794 $_params = array(
'pObj' => $this,
'row' => &$row,
'bypassGroupCheck' => &$bypassGroupCheck);
1795 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_checkEnableFields'] as $_funcRef) {
1798 if ($return ===
false) {
1803 if ((!$row[
'hidden'] || $this->showHiddenPage) && $row[
'starttime'] <=
$GLOBALS[
'SIM_ACCESS_TIME'] && ($row[
'endtime'] == 0 || $row[
'endtime'] >
$GLOBALS[
'SIM_ACCESS_TIME']) && ($bypassGroupCheck || $this->
checkPageGroupAccess($row))) {
1819 if (is_null($groupList)) {
1822 if (!is_array($groupList)) {
1823 $groupList = explode(
',', $groupList);
1825 $pageGroupList = explode(
',', $row[
'fe_group'] ?: 0);
1826 return count(array_intersect($groupList, $pageGroupList)) > 0;
1850 $c = count($this->rootLine);
1853 for ($a = 0; $a < $c; $a++) {
1855 if ($this->rootLine[$a][
'fe_login_mode'] > 0) {
1857 if ((
int)$this->rootLine[$a][
'fe_login_mode'] === 1) {
1859 $this->loginAllowedInBranch_mode =
'all';
1860 }
elseif ((
int)$this->rootLine[$a][
'fe_login_mode'] === 3) {
1862 $this->loginAllowedInBranch_mode =
'groups';
1879 $combinedRecords = array_merge(is_array($this->pageAccessFailureHistory[
'direct_access']) ? $this->pageAccessFailureHistory[
'direct_access'] : array(array(
'fe_group' => 0)), is_array($this->pageAccessFailureHistory[
'sub_section']) ? $this->pageAccessFailureHistory[
'sub_section'] : array());
1880 if (!empty($combinedRecords)) {
1881 foreach ($combinedRecords as $k => $pagerec) {
1884 if (!$k || $pagerec[
'extendToSubpages']) {
1885 if ($pagerec[
'hidden']) {
1886 $output[
'hidden'][$pagerec[
'uid']] =
true;
1888 if ($pagerec[
'starttime'] >
$GLOBALS[
'SIM_ACCESS_TIME']) {
1889 $output[
'starttime'][$pagerec[
'uid']] = $pagerec[
'starttime'];
1891 if ($pagerec[
'endtime'] != 0 && $pagerec[
'endtime'] <=
$GLOBALS[
'SIM_ACCESS_TIME']) {
1892 $output[
'endtime'][$pagerec[
'uid']] = $pagerec[
'endtime'];
1895 $output[
'fe_group'][$pagerec[
'uid']] = $pagerec[
'fe_group'];
1915 $theAlias = trim($theAlias);
1916 $this->
id = $theAlias !=
'' && strpos($theAlias,
'=') ===
false ? $theAlias : 0;
1934 foreach ($this->rootLine as $key => $val) {
1942 $this->pageNotFound = 3;
1958 $this->sys_page->where_hid_del .=
' AND pages.doktype<200';
1959 $this->sys_page->where_groupAccess = $this->sys_page->getMultipleGroupsWhereClause(
'pages.fe_group',
'pages');
1974 while (count($host)) {
1997 $header = $header ?: $this->TYPO3_CONF_VARS[
'FE'][
'pageUnavailable_handling_statheader'];
1998 $this->
pageUnavailableHandler($this->TYPO3_CONF_VARS[
'FE'][
'pageUnavailable_handling'], $header, $reason);
2011 $header = $header ?: $this->TYPO3_CONF_VARS[
'FE'][
'pageNotFound_handling_statheader'];
2012 $this->
pageNotFoundHandler($this->TYPO3_CONF_VARS[
'FE'][
'pageNotFound_handling'], $header, $reason);
2025 $this->TYPO3_CONF_VARS[
'FE'][
'pageUnavailable_handling']
2028 $this->TYPO3_CONF_VARS[
'SYS'][
'devIPmask']
2031 $checkPageUnavailableHandler =
true;
2033 $checkPageUnavailableHandler =
false;
2035 return $checkPageUnavailableHandler;
2078 $headerArr = preg_split(
'/\\r|\\n/', $header, -1, PREG_SPLIT_NO_EMPTY);
2079 foreach ($headerArr as $header) {
2085 if (gettype($code) ==
'boolean' || (
string)$code ===
'1') {
2086 $title =
'Page Not Found';
2087 $message =
'The page did not exist or was inaccessible.' . ($reason ?
' Reason: ' . htmlspecialchars($reason) :
'');
2089 $messagePage->output();
2092 $funcRef = trim(substr($code, 14));
2095 'reasonText' => $reason,
2101 if (@is_file($readFile)) {
2104 '###CURRENT_URL###',
2109 htmlspecialchars($reason)
2114 throw new \RuntimeException(
'Configuration Error: 404 page "' . $readFile .
'" could not be found.', 1294587214);
2118 }
elseif ($code !==
'') {
2120 $url_parts = parse_url($code);
2121 if ($url_parts[
'host'] ==
'') {
2123 if ($code[0] ===
'/') {
2128 $checkBaseTag =
false;
2130 $checkBaseTag =
true;
2134 if ($reason ==
'') {
2135 $reason =
'Page cannot be found.';
2137 $reason .= LF . LF .
'Additionally, ' . $code .
' was not found while trying to retrieve the error document.';
2138 throw new \RuntimeException(nl2br(htmlspecialchars($reason)), 1294587215);
2147 list($header,
$content) = explode(CRLF . CRLF, $res, 2);
2149 if (
false === $res) {
2154 $forwardHeaders = array(
2157 $headerArr = preg_split(
'/\\r|\\n/', $header, -1, PREG_SPLIT_NO_EMPTY);
2158 foreach ($headerArr as $header) {
2159 foreach ($forwardHeaders as $h) {
2160 if (preg_match(
'/^' . $h .
'/', $header)) {
2166 if ($checkBaseTag) {
2168 if (
false === stristr(
$content,
'<base ')) {
2170 $base = $url_parts[
'scheme'] .
'://';
2171 if ($url_parts[
'user'] !=
'') {
2172 $base .= $url_parts[
'user'];
2173 if ($url_parts[
'pass'] !=
'') {
2174 $base .=
':' . $url_parts[
'pass'];
2178 $base .= $url_parts[
'host'];
2180 $base .= preg_replace(
'/(.*\\/)[^\\/]*/',
'${1}', $url_parts[
'path']);
2182 $replacement = LF .
'<base href="' . htmlentities($base) .
'" />' . LF;
2186 $content = preg_replace(
'/(<html[^>]*>)/i',
'\\1<head>' . $replacement .
'</head>',
$content);
2194 $title =
'Page Not Found';
2195 $message = $reason ?
'Reason: ' . htmlspecialchars($reason) :
'Page cannot be found.';
2197 $messagePage->output();
2212 $aid = $this->sys_page->getPageIdFromAlias($this->
id);
2216 $this->pageNotFound = 4;
2229 if (is_array($GET_VARS)) {
2232 if (!is_array($realGet)) {
2240 if (isset($GET_VARS[
'type'])) {
2241 $this->type = (int)$GET_VARS[
'type'];
2243 if (isset($GET_VARS[
'cHash'])) {
2244 $this->cHash = $GET_VARS[
'cHash'];
2247 if (isset($GET_VARS[
'jumpurl'])) {
2248 $this->jumpurl = $GET_VARS[
'jumpurl'];
2250 if (isset($GET_VARS[
'MP'])) {
2251 $this->MP = $this->TYPO3_CONF_VARS[
'FE'][
'enable_mount_pids'] ? $GET_VARS[
'MP'] :
'';
2253 if (isset($GET_VARS[
'no_cache']) && $GET_VARS[
'no_cache']) {
2254 $this->
set_no_cache(
'no_cache is requested via GET parameter');
2276 if ($this->no_cache && !$this->TYPO3_CONF_VARS[
'FE'][
'pageNotFoundOnCHashError']) {
2280 if ($this->cHash && is_array($GET)) {
2282 $cHash_calc = $this->cacheHash->calculateCacheHash($this->cHash_array);
2283 if ($cHash_calc != $this->cHash) {
2284 if ($this->TYPO3_CONF_VARS[
'FE'][
'pageNotFoundOnCHashError']) {
2285 $this->
pageNotFoundAndExit(
'Request parameters could not be validated (&cHash comparison failed)');
2288 $this->
getTimeTracker()->setTSlogMessage(
'The incoming cHash "' . $this->cHash .
'" and calculated cHash "' . $cHash_calc .
'" did not match, so caching was disabled. The fieldlist used was "' . implode(
',', array_keys($this->cHash_array)) .
'"', 2);
2291 }
elseif (is_array($GET)) {
2308 if (!$this->cHash) {
2309 if ($this->TYPO3_CONF_VARS[
'FE'][
'pageNotFoundOnCHashError']) {
2310 if ($this->tempContent) {
2316 $this->
getTimeTracker()->setTSlogMessage(
'TSFE->reqCHash(): No &cHash parameter was sent for GET vars though required so caching is disabled', 2);
2329 $this->tmpl->setVerbose((
bool)$this->beUserLogin);
2330 $this->tmpl->init();
2331 $this->tmpl->tt_track = (bool)$this->beUserLogin;
2344 $this->content =
'';
2346 unset($this->config);
2347 $this->cacheContentFlag =
false;
2349 if ($this->no_cache) {
2353 $pageSectionCacheContent = $this->tmpl->getCurrentPageData();
2354 if (!is_array($pageSectionCacheContent)) {
2359 $this->
acquireLock(
'pagesection', $this->
id .
'::' . $this->MP);
2365 $pageSectionCacheContent = $this->tmpl->getCurrentPageData();
2366 if (is_array($pageSectionCacheContent)) {
2376 if (is_array($pageSectionCacheContent)) {
2380 $pageSectionCacheContent = $this->tmpl->matching($pageSectionCacheContent);
2381 ksort($pageSectionCacheContent);
2382 $this->all = $pageSectionCacheContent;
2384 unset($pageSectionCacheContent);
2391 $this->newHash = $this->
getHash();
2394 if (!is_array($row)) {
2404 if (is_array($row)) {
2413 if (is_array($row)) {
2417 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'pageLoadedFromCache'])) {
2418 $_params = array(
'pObj' => &$this,
'cache_pages_row' => &$row);
2419 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'pageLoadedFromCache'] as $_funcRef) {
2424 $this->config = $row[
'cache_data'];
2426 $this->content = $row[
'content'];
2428 $this->tempContent = $row[
'temp_content'];
2430 $this->cacheContentFlag =
true;
2431 $this->cacheExpires = $row[
'expires'];
2435 $this->page[
'title'] = $row[
'pageTitleInfo'][
'title'];
2436 $this->altPageTitle = $row[
'pageTitleInfo'][
'altPageTitle'];
2437 $this->indexedDocTitle = $row[
'pageTitleInfo'][
'indexedDocTitle'];
2439 if (isset($this->config[
'config'][
'debug'])) {
2440 $debugCacheTime = (bool)$this->config[
'config'][
'debug'];
2442 $debugCacheTime = !empty($this->TYPO3_CONF_VARS[
'FE'][
'debug']);
2444 if ($debugCacheTime) {
2445 $dateFormat =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'ddmmyy'];
2446 $timeFormat =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'hhmm'];
2447 $this->content .= LF .
'<!-- Cached page generated ' . date(($dateFormat .
' ' . $timeFormat), $row[
'tstamp']) .
'. Expires ' . Date(($dateFormat .
' ' . $timeFormat), $row[
'expires']) .
' -->';
2468 $row = $this->pageCache->get($this->newHash);
2482 $disableAcquireCacheData =
false;
2483 if ($this->beUserLogin) {
2484 if (strtolower($_SERVER[
'HTTP_CACHE_CONTROL']) ===
'no-cache' || strtolower($_SERVER[
'HTTP_PRAGMA']) ===
'no-cache') {
2485 $disableAcquireCacheData =
true;
2489 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'headerNoCache'])) {
2490 $_params = array(
'pObj' => &$this,
'disableAcquireCacheData' => &$disableAcquireCacheData);
2491 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'headerNoCache'] as $_funcRef) {
2495 return $disableAcquireCacheData;
2523 return md5($lockHash);
2538 $hashParameters = array(
2539 'id' => (
int)$this->
id,
2540 'type' => (
int)$this->type,
2541 'gr_list' => (
string)$this->gr_list,
2542 'MP' => (
string)$this->MP,
2543 'cHash' => $this->cHash_array,
2544 'domainStartPage' => $this->domainStartPage
2547 if (!$createLockHashBase) {
2551 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'createHashBase'])) {
2553 'hashParameters' => &$hashParameters,
2554 'createLockHashBase' => $createLockHashBase
2556 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'createHashBase'] as $_funcRef) {
2560 return serialize($hashParameters);
2572 if (!is_array($this->config) || is_array($this->config[
'INTincScript']) || $this->forceTemplateParsing) {
2574 $timeTracker->push(
'Parse template',
'');
2578 $this->tmpl->start($this->rootLine);
2579 $timeTracker->pull();
2580 if ($this->tmpl->loaded) {
2581 $timeTracker->push(
'Setting the config-array',
'');
2583 $this->sPre = $this->tmpl->setup[
'types.'][
$this->type];
2584 $this->pSetup = $this->tmpl->setup[$this->sPre .
'.'];
2585 if (!is_array($this->pSetup)) {
2586 $message =
'The page is not configured! [type=' . $this->type .
'][' . $this->sPre .
'].';
2590 $explanation =
'This means that there is no TypoScript object of type PAGE with typeNum=' . $this->type .
' configured.';
2595 if (!isset($this->config[
'config'])) {
2596 $this->config[
'config'] = array();
2599 if (is_array($this->tmpl->setup[
'config.'])) {
2601 $this->config[
'config'] = $this->tmpl->setup[
'config.'];
2604 if (is_array($this->pSetup[
'config.'])) {
2607 if ($this->config[
'config'][
'typolinkEnableLinksAcrossDomains']) {
2608 $this->config[
'config'][
'typolinkCheckRootline'] =
true;
2611 if (!isset($this->config[
'config'][
'removeDefaultJS'])) {
2612 $this->config[
'config'][
'removeDefaultJS'] =
'external';
2614 if (!isset($this->config[
'config'][
'inlineStyle2TempFile'])) {
2615 $this->config[
'config'][
'inlineStyle2TempFile'] = 1;
2618 if (!isset($this->config[
'config'][
'compressJs'])) {
2619 $this->config[
'config'][
'compressJs'] = 0;
2622 $this->config[
'rootLine'] = $this->tmpl->rootLine;
2623 $this->config[
'mainScript'] = trim($this->config[
'config'][
'mainScript']) ?:
'index.php';
2625 if ($this->pSetup[
'pageHeaderFooterTemplateFile']) {
2626 $file = $this->tmpl->getFileName($this->pSetup[
'pageHeaderFooterTemplateFile']);
2628 $this->pageRenderer->setTemplateFile($file);
2632 $timeTracker->pull();
2637 $message =
'No TypoScript template found!';
2646 if ($this->config[
'config'][
'no_cache']) {
2650 if (!empty($this->config[
'config'][
'defaultGetVars.'])) {
2656 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'configArrayPostProc'])) {
2657 $params = array(
'config' => &$this->config[
'config']);
2658 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'configArrayPostProc'] as $funcRef) {
2680 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'settingLanguage_preProcess'])) {
2682 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'settingLanguage_preProcess'] as $_funcRef) {
2688 $this->initLLvars();
2691 $this->sys_language_uid = ($this->sys_language_content = (int)$this->config[
'config'][
'sys_language_uid']);
2693 $this->sys_language_contentOL = $this->config[
'config'][
'sys_language_overlay'];
2695 if ($this->sys_language_uid > 0) {
2701 $olRec = $this->sys_page->getPageOverlay($this->
id, $this->sys_language_uid);
2702 if (empty($olRec)) {
2704 if ($this->sys_language_uid) {
2709 switch ((
string)$this->sys_language_mode) {
2713 case 'content_fallback':
2715 foreach ($fallBackOrder as $orderValue) {
2716 if ((
string)$orderValue ===
'0' || !empty($this->sys_page->getPageOverlay($this->id, $orderValue))) {
2717 $this->sys_language_content = $orderValue;
2728 $this->sys_language_uid = ($this->sys_language_content = 0);
2734 $this->page = $this->sys_page->getPageOverlay($this->page, $this->sys_language_uid);
2740 if ((!$this->sys_language_uid || !$this->sys_language_content) && $this->page[
'l18n_cfg'] & 1) {
2741 $message =
'Page is not available in default language.';
2749 if ($this->sys_language_content > 0) {
2753 $sys_language_row = $this->sys_page->getRawRecord(
'sys_language', $this->sys_language_content,
'language_isocode,static_lang_isocode',
true);
2754 if (is_array($sys_language_row)) {
2755 if (!empty($sys_language_row[
'language_isocode'])) {
2756 $this->sys_language_isocode = $sys_language_row[
'language_isocode'];
2758 GeneralUtility::deprecationLog(
'Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in language field "language_isocode" in your sys_language records.');
2759 $stLrow = $this->sys_page->getRawRecord(
'static_languages', $sys_language_row[
'static_lang_isocode'],
'lg_iso_2',
true);
2760 $this->sys_language_isocode = $stLrow[
'lg_iso_2'];
2764 if (!empty($this->config[
'config'][
'sys_language_isocode'])) {
2765 $this->sys_language_isocode = $this->config[
'config'][
'sys_language_isocode'];
2770 if (!empty($this->config[
'config'][
'sys_language_isocode_default'])) {
2771 $this->sys_language_isocode = $this->config[
'config'][
'sys_language_isocode_default'];
2773 $this->sys_language_isocode = $this->lang !=
'default' ? $this->lang :
'en';
2780 foreach ($table_fields as $TF) {
2781 list($tN, $fN) = explode(
':', $TF);
2782 $GLOBALS[
'TCA'][$tN][
'columns'][$fN][
'l10n_mode'] =
'mergeIfNotBlank';
2786 foreach ($table_fields as $TF) {
2787 list($tN, $fN) = explode(
':', $TF);
2788 $GLOBALS[
'TCA'][$tN][
'columns'][$fN][
'l10n_mode'] =
'exclude';
2790 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'settingLanguage_postProcess'])) {
2792 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'settingLanguage_postProcess'] as $_funcRef) {
2803 if ($this->sys_language_uid) {
2804 $this->rootLine = $this->sys_page->getRootLine($this->
id, $this->MP);
2805 $this->tmpl->updateRootlineData($this->rootLine);
2817 if ($this->config[
'config'][
'locale_all']) {
2821 $locale = setlocale(LC_COLLATE, $this->config[
'config'][
'locale_all']);
2823 setlocale(LC_CTYPE, $this->config[
'config'][
'locale_all']);
2824 setlocale(LC_MONETARY, $this->config[
'config'][
'locale_all']);
2825 setlocale(LC_TIME, $this->config[
'config'][
'locale_all']);
2826 $this->localeCharset = $this->csConvObj->get_locale_charset($this->config[
'config'][
'locale_all']);
2828 $this->
getTimeTracker()->setTSlogMessage(
'Locale "' . htmlspecialchars($this->config[
'config'][
'locale_all']) .
'" not found.', 3);
2843 if (!is_null($this->originalShortcutPage)) {
2844 $originalShortcutPageOverlay = $this->sys_page->getPageOverlay($this->originalShortcutPage[
'uid'], $this->sys_language_uid);
2845 if (!empty($originalShortcutPageOverlay[
'shortcut']) && $originalShortcutPageOverlay[
'shortcut'] != $this->
id) {
2848 $shortcut = $this->
getPageShortcut($originalShortcutPageOverlay[
'shortcut'], $originalShortcutPageOverlay[
'shortcut_mode'], $originalShortcutPageOverlay[
'uid']);
2849 $this->
id = ($this->contentPid = $shortcut[
'uid']);
2850 $this->page = $this->sys_page->getPage($this->
id);
2853 $this->tmpl->rootLine = array_reverse($this->rootLine);
2867 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkDataSubmission'])) {
2868 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkDataSubmission'] as $_classRef) {
2870 $_procObj->checkDataSubmission($this);
2880 public function initializeRedirectUrlHandlers()
2883 empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'urlProcessing'][
'urlHandlers'])
2884 || !is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'urlProcessing'][
'urlHandlers'])
2889 $urlHandlers =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'urlProcessing'][
'urlHandlers'];
2890 foreach ($urlHandlers as $identifier => $configuration) {
2891 if (empty($configuration) || !is_array($configuration)) {
2892 throw new \RuntimeException(
'Missing configuration for URL handler "' . $identifier .
'".', 1442052263);
2894 if (!is_string($configuration[
'handler']) || empty($configuration[
'handler']) || !class_exists($configuration[
'handler']) || !is_subclass_of($configuration[
'handler'], UrlHandlerInterface::class)) {
2895 throw new \RuntimeException(
'The URL handler "' . $identifier .
'" defines an invalid provider. Ensure the class exists and implements the "' . UrlHandlerInterface::class .
'".', 1442052249);
2901 foreach ($orderedHandlers as $configuration) {
2904 if ($urlHandler->canHandleCurrentUrl()) {
2905 $this->activeUrlHandlers[] = $urlHandler;
2920 $this->initializeRedirectUrlHandlers();
2949 foreach ($this->activeUrlHandlers as $redirectHandler) {
2950 $redirectHandler->handle();
2953 if (!empty($this->activeUrlHandlers)) {
2954 throw new \RuntimeException(
'A URL handler is active but did not process the URL.', 1442305505);
2967 if ($this->config[
'config'][
'ftu']) {
2968 $this->getMethodUrlIdToken = $this->TYPO3_CONF_VARS[
'FE'][
'get_url_id_token'];
2970 $this->getMethodUrlIdToken =
'';
2982 $this->linkVars =
'';
2989 $test = ($value =
'');
2990 if (preg_match(
'/^(.*)\\((.+)\\)$/', $linkVar, $match)) {
2991 $linkVar = trim($match[1]);
2992 $test = trim($match[2]);
2994 if ($linkVar ===
'' || !isset($getData[$linkVar])) {
2997 if (!is_array($getData[$linkVar])) {
2998 $temp = rawurlencode($getData[$linkVar]);
3003 $value =
'&' . $linkVar .
'=' . $temp;
3005 if ($test !==
'' && $test !==
'array') {
3011 $this->linkVars .= $value;
3026 $this->redirectToCurrentPage();
3041 $this->redirectToCurrentPage();
3051 protected function redirectToCurrentPage()
3057 $parameter = $this->page[
'uid'];
3060 $parameter .=
',' .
$type;
3062 $redirectUrl =
$cObj->typoLink_URL(array(
'parameter' => $parameter));
3065 if (!empty($redirectUrl)) {
3084 return !$this->cacheContentFlag && empty($this->activeUrlHandlers);
3095 $this->tempContent =
false;
3096 if (!$this->no_cache) {
3098 $title = htmlspecialchars($this->tmpl->printTitle($this->page[
'title']));
3101 <strong>Page is being generated.</strong><br />
3102 If this message does not disappear within ' . $seconds .
' seconds, please reload.';
3103 $message = $this->config[
'config'][
'message_page_is_being_generated'];
3104 if ((
string)$message !==
'') {
3106 $message = $this->csConvObj->utf8_encode($message, $this->renderCharset);
3107 $message = str_replace(
'###TITLE###', $title, $message);
3108 $message = str_replace(
'###REQUEST_URI###', $request_uri, $message);
3112 $temp_content =
'<?xml version="1.0" encoding="UTF-8"?>
3113 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3114 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3115 <html xmlns="http://www.w3.org/1999/xhtml">
3117 <title>' . $title .
'</title>
3118 <meta http-equiv="refresh" content="10" />
3120 <body style="background-color:white; font-family:Verdana,Arial,Helvetica,sans-serif; color:#cccccc; text-align:center;">' . $message .
'
3124 $padSuffix =
'<!--pad-->';
3126 $padSize = 768 - strlen($padSuffix) - strlen($temp_content);
3128 $temp_content = str_pad($temp_content, $padSize, LF) . $padSuffix;
3135 $this->
set_no_cache(
'Another process wrote into the cache since the beginning of the render process',
true);
3139 $this->tempContent =
true;
3154 $cacheTimeout = $this->get_cache_timeout();
3155 $timeOutTime =
$GLOBALS[
'EXEC_TIME'] + $cacheTimeout;
3156 $this->tempContent =
false;
3157 $usePageCache =
true;
3161 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'usePageCache'])) {
3162 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'usePageCache'] as $_classRef) {
3164 $usePageCache = $_procObj->usePageCache($this, $usePageCache);
3168 if ($usePageCache) {
3172 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'insertPageIncache'])) {
3173 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'insertPageIncache'] as $_classRef) {
3175 $_procObj->insertPageIncache($this, $timeOutTime);
3192 'identifier' => $this->newHash,
3193 'page_id' => $this->
id,
3195 'temp_content' => $this->tempContent,
3196 'cache_data' => $data,
3197 'expires' => $expirationTstamp,
3199 'pageTitleInfo' => array(
3200 'title' => $this->page[
'title'],
3201 'altPageTitle' => $this->altPageTitle,
3202 'indexedDocTitle' => $this->indexedDocTitle
3205 $this->cacheExpires = $expirationTstamp;
3206 $this->pageCacheTags[] =
'pageId_' . $cacheData[
'page_id'];
3207 if ($this->page_cache_reg1) {
3208 $reg1 = (int)$this->page_cache_reg1;
3209 $cacheData[
'reg1'] = $reg1;
3210 $this->pageCacheTags[] =
'reg1_' . $reg1;
3212 if (!empty($this->page[
'cache_tags'])) {
3214 $this->pageCacheTags = array_merge($this->pageCacheTags, $tags);
3216 $this->pageCache->set($this->newHash, $cacheData, $this->pageCacheTags, $expirationTstamp -
$GLOBALS[
'EXEC_TIME']);
3226 $this->pageCache->remove($this->newHash);
3238 foreach ($pageIds as $pageId) {
3239 $this->pageCache->flushByTag(
'pageId_' . (
int)$pageId);
3253 if ((
int)$this->
whichWorkspace() < 1 && $this->page[
'SYS_LASTCHANGED'] < (
int)$this->
register[
'SYS_LASTCHANGED']) {
3254 $this->
getDatabaseConnection()->exec_UPDATEquery(
'pages',
'uid=' . (
int)$this->
id, array(
'SYS_LASTCHANGED' => (
int)$this->
register[
'SYS_LASTCHANGED']));
3277 if (!is_object($lockObj)) {
3284 $success = $lockObj->acquire();
3285 if ($lockObj->getLockStatus()) {
3286 $lockObj->sysLog(
'Acquired lock');
3311 $success = $lockObj->release();
3312 $lockObj->sysLog(
'Released lock');
3341 $this->pageCacheTags = array_merge($this->pageCacheTags, $tags);
3358 $this->newHash = $this->
getHash();
3361 if (is_object($this->locks[
'pages'][
'accessLock'])) {
3372 $this->cacheTimeOutDefault = (int)$this->config[
'config'][
'cache_period'];
3385 if (!$this->TYPO3_CONF_VARS[
'FE'][
'noPHPscriptInclude'] && $this->config[
'config'][
'pageGenScript']) {
3386 return $this->tmpl->getFileName($this->config[
'config'][
'pageGenScript']);
3400 if ($this->no_cacheBeforePageGen) {
3401 $this->
set_no_cache(
'no_cache has been set before the page was generated - safety check',
true);
3404 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-all'])) {
3405 $_params = array(
'pObj' => &$this);
3406 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-all'] as $_funcRef) {
3411 if (!$this->no_cache) {
3413 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-cached'])) {
3414 $_params = array(
'pObj' => &$this);
3415 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-cached'] as $_funcRef) {
3427 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'pageIndexing'])) {
3428 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'pageIndexing'] as $_classRef) {
3430 $_procObj->hook_indexContent($this);
3434 if (!$this->no_cache) {
3436 }
elseif ($this->tempContent) {
3439 $this->tempContent =
false;
3452 PageGenerator::generatePageTitle();
3460 public function INTincScript()
3464 $this->additionalHeaderData = is_array($this->config[
'INTincScript_ext'][
'additionalHeaderData']) ? $this->config[
'INTincScript_ext'][
'additionalHeaderData'] : array();
3465 $this->additionalFooterData = is_array($this->config[
'INTincScript_ext'][
'additionalFooterData']) ? $this->config[
'INTincScript_ext'][
'additionalFooterData'] : array();
3466 $this->additionalJavaScript = $this->config[
'INTincScript_ext'][
'additionalJavaScript'];
3467 $this->additionalCSS = $this->config[
'INTincScript_ext'][
'additionalCSS'];
3468 $this->divSection =
'';
3469 if (empty($this->config[
'INTincScript_ext'][
'pageRenderer'])) {
3473 $pageRenderer = unserialize($this->config[
'INTincScript_ext'][
'pageRenderer']);
3483 $this->content = str_replace(
3485 '<!--HD_' . $this->config[
'INTincScript_ext'][
'divKey'] .
'-->',
3486 '<!--FD_' . $this->config[
'INTincScript_ext'][
'divKey'] .
'-->',
3487 '<!--TDS_' . $this->config[
'INTincScript_ext'][
'divKey'] .
'-->'
3494 $this->pageRenderer->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config[
'INTincScript_ext'][
'divKey'])
3498 $this->setAbsRefPrefix();
3510 $INTiS_config = $this->config[
'INTincScript'];
3514 $INTiS_config = array_diff_assoc($this->config[
'INTincScript'], $INTiS_config);
3515 $reprocess = count($INTiS_config) > 0;
3516 }
while ($reprocess);
3528 foreach ($INTiS_config as $INTiS_cPart) {
3529 if (isset($INTiS_cPart[
'conf'][
'includeLibs']) && $INTiS_cPart[
'conf'][
'includeLibs']) {
3546 $timeTracker->push(
'Split content');
3548 $INTiS_splitC = explode(
'<!--INT_SCRIPT.', $this->content);
3549 $this->content =
'';
3550 $timeTracker->setTSlogMessage(
'Parts: ' . count($INTiS_splitC));
3551 $timeTracker->pull();
3552 foreach ($INTiS_splitC as $INTiS_c => $INTiS_cPart) {
3554 if (substr($INTiS_cPart, 32, 3) ===
'-->') {
3555 $INTiS_key =
'INT_SCRIPT.' . substr($INTiS_cPart, 0, 32);
3556 if (is_array($INTiS_config[$INTiS_key])) {
3557 $timeTracker->push(
'Include ' . $INTiS_config[$INTiS_key][
'file'],
'');
3559 $INTiS_cObj = unserialize($INTiS_config[$INTiS_key][
'cObj']);
3561 $INTiS_cObj->INT_include = 1;
3562 switch ($INTiS_config[$INTiS_key][
'type']) {
3564 $incContent = $INTiS_cObj->cObjGetSingle(
'COA', $INTiS_config[$INTiS_key][
'conf']);
3567 $incContent = $INTiS_cObj->cObjGetSingle(
'USER', $INTiS_config[$INTiS_key][
'conf']);
3569 case 'POSTUSERFUNC':
3570 $incContent = $INTiS_cObj->callUserFunction($INTiS_config[$INTiS_key][
'postUserFunc'], $INTiS_config[$INTiS_key][
'conf'], $INTiS_config[$INTiS_key][
'content']);
3574 $this->content .= substr($INTiS_cPart, 35);
3575 $timeTracker->pull($incContent);
3577 $this->content .= substr($INTiS_cPart, 35);
3580 $this->content .= ($INTiS_c ?
'<!--INT_SCRIPT.' :
'') . $INTiS_cPart;
3593 $jsCode = trim($this->JSCode);
3595 ? implode(LF, $this->additionalJavaScript)
3599 $this->additionalHeaderData[
'JSCode'] =
'
3600 <script type="text/javascript">
3610 $additionalCss = is_array($this->additionalCSS) ? implode(LF, $this->additionalCSS) :
$this->additionalCSS;
3611 $additionalCss = trim($additionalCss);
3612 if ($additionalCss !==
'') {
3613 $this->additionalHeaderData[
'_CSS'] =
'
3614 <style type="text/css">
3615 ' . $additionalCss .
'
3627 return is_array($this->config[
'INTincScript']) && empty($this->activeUrlHandlers);
3639 return $this->config[
'config'][
'xhtml_cleaning'];
3651 return isset($this->config[
'config'][
'prefixLocalAnchors']) ? $this->config[
'config'][
'prefixLocalAnchors'] : null;
3668 $enableOutput = empty($this->activeUrlHandlers);
3670 if (isset($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'isOutputting']) && is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'isOutputting'])) {
3671 $_params = array(
'pObj' => &$this,
'enableOutput' => &$enableOutput);
3672 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'isOutputting'] as $_funcRef) {
3676 return $enableOutput;
3691 if (empty($this->config[
'config'][
'disableCharsetHeader'])) {
3692 $headLine =
'Content-Type: ' . $this->contentType .
'; charset=' . trim($this->metaCharset);
3696 if (empty($this->config[
'config'][
'disableLanguageHeader']) && !empty($this->sys_language_isocode)) {
3697 $headLine =
'Content-Language: ' . trim($this->sys_language_isocode);
3701 if (!empty($this->config[
'config'][
'sendCacheHeaders'])) {
3705 if (!empty($this->config[
'config'][
'additionalHeaders'])) {
3706 $headerArray = explode(
'|', $this->config[
'config'][
'additionalHeaders']);
3707 GeneralUtility::deprecationLog(
'The TypoScript option "config.additionalHeaders" has been deprecated with TYPO3 CMS 7, and will be removed with CMS 8, please use the more flexible syntax config.additionalHeaders.10... to separate each header value.');
3708 foreach ($headerArray as $headLine) {
3709 $headLine = trim($headLine);
3713 if (is_array($this->config[
'config'][
'additionalHeaders.'])) {
3714 ksort($this->config[
'config'][
'additionalHeaders.']);
3715 foreach ($this->config[
'config'][
'additionalHeaders.'] as $options) {
3717 trim($options[
'header']),
3719 ($options[
'replace'] !==
'0'),
3720 ((
int)$options[
'httpResponseCode'] ?: null)
3725 if ($this->tempContent) {
3729 if (!$this->isClientCachable) {
3733 if (isset($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-output']) && is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-output'])) {
3734 $_params = array(
'pObj' => &$this);
3735 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-output'] as $_funcRef) {
3744 (!isset($this->config[
'config'][
'enableContentLengthHeader']) || $this->config[
'config'][
'enableContentLengthHeader'])
3745 && !$this->beUserLogin && !$this->TYPO3_CONF_VARS[
'FE'][
'debug']
3748 header(
'Content-Length: ' . strlen($this->content));
3764 $loginsDeniedCfg = empty($this->config[
'config'][
'sendCacheHeaders_onlyWhenLoginDeniedInBranch']) || empty($this->loginAllowedInBranch);
3766 if ($doCache && !$this->beUserLogin && !$this->
doWorkspacePreview() && $loginsDeniedCfg) {
3769 'Expires: ' . gmdate(
'D, d M Y H:i:s T', $this->cacheExpires),
3770 'ETag: "' . md5($this->content) .
'"',
3771 'Cache-Control: max-age=' . ($this->cacheExpires -
$GLOBALS[
'EXEC_TIME']),
3775 $this->isClientCachable =
true;
3779 'Cache-Control: private'
3781 $this->isClientCachable =
false;
3783 if ($this->beUserLogin) {
3785 $this->
getTimeTracker()->setTSlogMessage(
'Cache-headers with max-age "' . ($this->cacheExpires -
$GLOBALS[
'EXEC_TIME']) .
'" would have been sent');
3788 $reasonMsg .= !$this->no_cache ?
'' :
'Caching disabled (no_cache). ';
3789 $reasonMsg .= !$this->
isINTincScript() ?
'' :
'*_INT object(s) on page. ';
3790 $reasonMsg .= !is_array($this->fe_user->user) ?
'' :
'Frontend user logged in. ';
3791 $this->
getTimeTracker()->setTSlogMessage(
'Cache-headers would disable proxy caching! Reason(s): "' . $reasonMsg .
'"', 1);
3796 foreach ($headers as $hL) {
3827 if (!empty($this->fe_user->user[
'uid'])) {
3829 $token = isset($this->config[
'config'][
'USERNAME_substToken']) ? trim($this->config[
'config'][
'USERNAME_substToken']) :
'';
3830 $search[] = $token ? $token :
'<!--###USERNAME###-->';
3831 $replace[] = $this->fe_user->user[
'username'];
3833 $token = isset($this->config[
'config'][
'USERUID_substToken']) ? trim($this->config[
'config'][
'USERUID_substToken']) :
'';
3836 $replace[] = $this->fe_user->user[
'uid'];
3840 if ($this->getMethodUrlIdToken) {
3842 $replace[] = $this->fe_user->get_URL_ID;
3845 if (isset($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'tslib_fe-contentStrReplace'])) {
3846 $contentStrReplaceHooks = &$this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'tslib_fe-contentStrReplace'];
3847 if (is_array($contentStrReplaceHooks)) {
3849 'search' => &$search,
3850 'replace' => &$replace
3852 foreach ($contentStrReplaceHooks as $_funcRef) {
3857 if (!empty($search)) {
3858 $this->content = str_replace($search, $replace, $this->content);
3869 $this->fe_user->storeSessionData();
3881 $microtime_start = isset(
$GLOBALS[
'TYPO3_MISC'][
'microtime_start']) ?
$GLOBALS[
'TYPO3_MISC'][
'microtime_start'] : null;
3882 $microtime_end = isset(
$GLOBALS[
'TYPO3_MISC'][
'microtime_end']) ?
$GLOBALS[
'TYPO3_MISC'][
'microtime_end'] : null;
3883 $microtime_BE_USER_start = isset(
$GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_start']) ?
$GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_start'] : null;
3884 $microtime_BE_USER_end = isset(
$GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_end']) ?
$GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_end'] : null;
3886 $this->scriptParseTime = $timeTracker->getMilliseconds($microtime_end) - $timeTracker->getMilliseconds($microtime_start) - ($timeTracker->getMilliseconds($microtime_BE_USER_end) - $timeTracker->getMilliseconds($microtime_BE_USER_start));
3896 if ($this->fePreview !== 0) {
3898 if (isset($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_previewInfo']) && is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_previewInfo'])) {
3899 $_params = array(
'pObj' => &$this);
3900 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_previewInfo'] as $_funcRef) {
3904 $this->content = str_ireplace(
'</body>', $previewInfo .
'</body>', $this->content);
3916 if (isset($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_eofe']) && is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_eofe'])) {
3917 $_params = array(
'pObj' => &$this);
3918 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_eofe'] as $_funcRef) {
3931 if (!empty($this->config[
'config'][
'beLoginLinkIPList'])) {
3933 $label = !$this->beUserLogin ? $this->config[
'config'][
'beLoginLinkIPList_login'] : $this->config[
'config'][
'beLoginLinkIPList_logout'];
3935 if (!$this->beUserLogin) {
3936 $link =
'<a href="' . htmlspecialchars((TYPO3_mainDir .
'index.php?redirect_url=' . rawurlencode(
GeneralUtility::getIndpEnv(
'REQUEST_URI')))) .
'">' . $label .
'</a>';
3938 $link =
'<a href="' . htmlspecialchars((TYPO3_mainDir .
'index.php?L=OUT&redirect_url=' . rawurlencode(
GeneralUtility::getIndpEnv(
'REQUEST_URI')))) .
'">' . $label .
'</a>';
3954 header(
'HTTP/1.0 503 Service unavailable');
3955 header(
'Retry-after: 3600');
3956 header(
'Pragma: no-cache');
3957 header(
'Cache-control: no-cache');
3958 header(
'Expire: 0');
3979 if ($offset > 0 && $n > $end) {
3980 $n = $start + ($n - $end - 1);
3981 }
elseif ($offset < 0 && $n < $start) {
3982 $n = $end - ($start - $n - 1);
3997 if ($this->spamProtectEmailAddresses ===
'ascii') {
3998 $stringLength = strlen($string);
3999 for ($a = 0; $a < $stringLength; $a++) {
4000 $out .=
'&#' . ord(substr($string, $a, 1)) .
';';
4004 $len = strlen($string);
4005 $offset = (int)$this->spamProtectEmailAddresses * ($back ? -1 : 1);
4006 for ($i = 0; $i < $len; $i++) {
4007 $charValue = ord($string[$i]);
4009 if ($charValue >= 43 && $charValue <= 58) {
4011 }
elseif ($charValue >= 64 && $charValue <= 90) {
4014 }
elseif ($charValue >= 97 && $charValue <= 122) {
4018 $out .= $string[$i];
4035 return !$this->TYPO3_CONF_VARS[
'FE'][
'noPHPscriptInclude'] || substr($incFile, 0, 4 + strlen(TYPO3_mainDir)) == TYPO3_mainDir .
'ext/' || substr($incFile, 0, 7 + strlen(TYPO3_mainDir)) == TYPO3_mainDir .
'sysext/' || substr($incFile, 0, 14) ==
'typo3conf/ext/';
4048 $this->cObj->start($this->page,
'pages');
4058 public function setAbsRefPrefix()
4060 if (!$this->absRefPrefix) {
4066 '"' . TYPO3_mainDir .
'ext/',
4067 '"' . TYPO3_mainDir .
'sysext/'
4070 '"' . $this->absRefPrefix .
'typo3temp/',
4071 '"' . $this->absRefPrefix .
'typo3conf/ext/',
4072 '"' . $this->absRefPrefix . TYPO3_mainDir .
'ext/',
4073 '"' . $this->absRefPrefix . TYPO3_mainDir .
'sysext/'
4077 $storages = $storageRepository->findAll();
4078 foreach ($storages as $storage) {
4079 if ($storage->getDriverType() ===
'Local' && $storage->isPublic() && $storage->isOnline()) {
4080 $folder = $storage->getPublicUrl($storage->getRootLevelFolder(),
true);
4081 $search[] =
'"' . $folder;
4082 $replace[] =
'"' . $this->absRefPrefix . $folder;
4087 foreach ($directories as $directory) {
4088 $search[] =
'"' . $directory;
4089 $replace[] =
'"' . $this->absRefPrefix . $directory;
4091 $this->content = str_replace(
4107 if ($this->baseUrl) {
4108 $urlParts = parse_url(
$url);
4109 if ($urlParts[
'scheme'] ===
'' &&
$url[0] !==
'/') {
4127 $explanationText = $explanation !==
'' ?
' - ' . $explanation :
'';
4128 $this->
getTimeTracker()->setTSlogMessage($typoScriptProperty .
' is deprecated.' . $explanationText, 2);
4153 if (!$this->beUserLogin) {
4154 if (!is_object($this->cObj)) {
4157 $scriptPath = $this->cObj->getUrlToCurrentLocation();
4165 $this->content = preg_replace(
'/(<(?:a|area).*?href=")(#[^"]*")/i',
'${1}' . htmlspecialchars($scriptPath) .
'${2}', $originalContent);
4167 if (preg_last_error() > 0) {
4168 GeneralUtility::sysLog(
'preg_replace returned error-code: ' . preg_last_error() .
' in function prefixLocalAnchorsWithScript. Replacement not done!',
'cms',
GeneralUtility::SYSLOG_SEVERITY_FATAL);
4169 $this->content = $originalContent;
4184 return $this->workspacePreview !== 0;
4197 $ws = (int)$this->workspacePreview;
4198 }
elseif ($this->beUserLogin) {
4201 if ($ws && $returnTitle) {
4203 $row = $this->
getDatabaseConnection()->exec_SELECTgetSingleRow(
'title',
'sys_workspace',
'uid=' . (
int)$ws);
4205 return $row[
'title'];
4222 $timeTracker->push(
'Include libraries');
4223 $timeTracker->setTSlogMessage(
'Files for inclusion: "' . implode(
', ', $libraries) .
'"');
4224 foreach ($libraries as $library) {
4225 $file = $this->tmpl->getFileName($library);
4227 include_once
'./' . $file;
4229 $timeTracker->setTSlogMessage(
'Include file "' . $file .
'" did not exist!', 2);
4232 $timeTracker->pull();
4250 if (!is_array($this->rootLine)) {
4253 foreach ($this->rootLine as $rC) {
4254 if (!$res[
'_STORAGE_PID']) {
4255 $res[
'_STORAGE_PID'] = (int)$rC[
'storage_pid'];
4257 if (!$res[
'_SITEROOT']) {
4258 $res[
'_SITEROOT'] = $rC[
'is_siteroot'] ? (int)$rC[
'uid'] : 0;
4271 if (!is_array($this->pagesTSconfig)) {
4272 $TSdataArray = array();
4273 foreach ($this->rootLine as $k => $v) {
4274 $TSdataArray[] = $v[
'TSconfig'];
4277 $TSdataArray[] = $this->TYPO3_CONF_VARS[
'BE'][
'defaultPageTSconfig'];
4279 $TSdataArray = array_reverse($TSdataArray);
4282 $userTS = implode(LF .
'[GLOBAL]' . LF, $TSdataArray);
4283 $hash = md5(
'pageTS:' . $userTS);
4284 $cachedContent = $this->sys_page->getHash($hash);
4285 if (is_array($cachedContent)) {
4286 $this->pagesTSconfig = $cachedContent;
4289 $parseObj->parse($userTS);
4290 $this->pagesTSconfig = $parseObj->setup;
4291 $this->sys_page->storeHash($hash, $this->pagesTSconfig,
'PAGES_TSconfig');
4310 $this->additionalJavaScript[$key] =
' // JS function for mouse-over
4311 function over(name, imgObj) { //
4312 if (version == "n3" && document[name]) {document[name].src = eval(name+"_h.src");}
4313 else if (document.getElementById && document.getElementById(name)) {document.getElementById(name).src = eval(name+"_h.src");}
4314 else if (imgObj) {imgObj.src = eval(name+"_h.src");}
4316 // JS function for mouse-out
4317 function out(name, imgObj) { //
4318 if (version == "n3" && document[name]) {document[name].src = eval(name+"_n.src");}
4319 else if (document.getElementById && document.getElementById(name)) {document.getElementById(name).src = eval(name+"_n.src");}
4320 else if (imgObj) {imgObj.src = eval(name+"_n.src");}
4324 $this->additionalJavaScript[$key] =
' function openPic(url, winName, winParams) { //
4325 var theWindow = window.open(url, winName, winParams);
4326 if (theWindow) {theWindow.focus();}
4330 $this->additionalJavaScript[$key] =
$content;
4346 $this->additionalCSS[$key] =
$content;
4359 return md5($this->uniqueString .
'_' . $str . $this->uniqueCounter++);
4371 if ($internal && isset(
$GLOBALS[
'BE_USER'])) {
4377 if ($reason !==
'') {
4378 $warning =
'$TSFE->set_no_cache() was triggered. Reason: ' . $reason .
'.';
4380 $trace = debug_backtrace();
4382 $PATH_site_real = dirname(realpath(PATH_site .
'typo3')) .
'/';
4383 $file = $trace[0][
'file'];
4385 $file = str_replace($PATH_site_real,
'', $file);
4387 $file = str_replace(PATH_site,
'', $file);
4389 $line = $trace[0][
'line'];
4390 $trigger = $file .
' on line ' . $line;
4391 $warning =
'$GLOBALS[\'TSFE\']->set_no_cache() was triggered by ' . $trigger .
'.';
4393 if ($this->TYPO3_CONF_VARS[
'FE'][
'disableNoCacheParameter']) {
4394 $warning .=
' However, $TYPO3_CONF_VARS[\'FE\'][\'disableNoCacheParameter\'] is set, so it will be ignored!';
4397 $warning .=
' Caching is disabled!';
4400 GeneralUtility::sysLog($warning,
'cms', $severity);
4411 $this->no_cache =
true;
4422 $this->cacheTimeOutDefault = (int)$seconds;
4430 public function get_cache_timeout()
4434 $cachedCacheLifetimeIdentifier =
'core-tslib_fe-get_cache_timeout';
4435 $cachedCacheLifetime = $runtimeCache->get($cachedCacheLifetimeIdentifier);
4436 if ($cachedCacheLifetime ===
false) {
4437 if ($this->page[
'cache_timeout']) {
4439 $cacheTimeout = $this->page[
'cache_timeout'];
4440 }
elseif ($this->cacheTimeOutDefault) {
4445 $cacheTimeout = 86400;
4447 if ($this->config[
'config'][
'cache_clearAtMidnight']) {
4448 $timeOutTime =
$GLOBALS[
'EXEC_TIME'] + $cacheTimeout;
4449 $midnightTime = mktime(0, 0, 0, date(
'm', $timeOutTime), date(
'd', $timeOutTime), date(
'Y', $timeOutTime));
4452 if ($midnightTime >
$GLOBALS[
'EXEC_TIME']) {
4453 $cacheTimeout = $midnightTime -
$GLOBALS[
'EXEC_TIME'];
4460 if (is_array($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'get_cache_timeout'])) {
4461 foreach ($this->TYPO3_CONF_VARS[
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'get_cache_timeout'] as $_funcRef) {
4462 $params = array(
'cacheTimeout' => $cacheTimeout);
4466 $runtimeCache->set($cachedCacheLifetimeIdentifier, $cacheTimeout);
4467 $cachedCacheLifetime = $cacheTimeout;
4469 return $cachedCacheLifetime;
4480 if ($desired ===
'') {
4484 $uniqueId = $desired;
4485 for ($i = 1; isset($this->usedUniqueIds[$uniqueId]); $i++) {
4486 $uniqueId = $desired .
'_' . $i;
4489 $this->usedUniqueIds[$uniqueId] =
true;
4504 public function sL($input)
4506 if (substr($input, 0, 4) !==
'LLL:') {
4511 if (!isset($this->LL_labels_cache[$this->lang][$input])) {
4512 $restStr = trim(substr($input, 4));
4514 if (substr($restStr, 0, 4) ===
'EXT:') {
4515 $restStr = trim(substr($restStr, 4));
4518 $parts = explode(
':', $restStr);
4519 $parts[0] = $extPrfx . $parts[0];
4521 if (!isset($this->LL_files_cache[$parts[0]])) {
4522 $this->LL_files_cache[$parts[0]] = $this->readLLfile($parts[0]);
4524 $this->LL_labels_cache[
$this->lang][$input] = $this->
getLLL($parts[1], $this->LL_files_cache[$parts[0]]);
4526 return $this->LL_labels_cache[
$this->lang][$input];
4535 public function readLLfile($fileRef)
4540 if ($this->lang !==
'default') {
4541 $languages = array_reverse($this->languageDependencies);
4543 if (empty($languages)) {
4544 $languages[] =
'default';
4547 $languages = array(
'default');
4550 $localLanguage = array();
4551 foreach ($languages as $language) {
4552 $tempLL = $languageFactory->getParsedData($fileRef, $language, $this->renderCharset);
4553 $localLanguage[
'default'] = $tempLL[
'default'];
4554 if (!isset($localLanguage[$this->lang])) {
4555 $localLanguage[
$this->lang] = $localLanguage[
'default'];
4557 if ($this->lang !==
'default' && isset($tempLL[$language])) {
4564 return $localLanguage;
4576 if (isset($LOCAL_LANG[$this->lang][$index][0][
'target'])) {
4577 return $LOCAL_LANG[
$this->lang][$index][0][
'target'];
4578 }
elseif (isset($LOCAL_LANG[
'default'][$index][0][
'target'])) {
4579 return $LOCAL_LANG[
'default'][$index][0][
'target'];
4589 public function initLLvars()
4592 $this->languageDependencies = array();
4594 $this->lang = $this->config[
'config'][
'language'] ?:
'default';
4595 $this->pageRenderer->setLanguage($this->lang);
4604 if (in_array($this->lang,
$locales->getLocales())) {
4606 foreach (
$locales->getLocaleDependencies($this->lang) as $language) {
4607 $this->languageDependencies[] = $language;
4612 $this->renderCharset = $this->csConvObj->parse_charset($this->config[
'config'][
'renderCharset'] ? $this->config[
'config'][
'renderCharset'] :
'utf-8');
4614 $this->metaCharset = $this->csConvObj->parse_charset($this->config[
'config'][
'metaCharset'] ? $this->config[
'config'][
'metaCharset'] : $this->renderCharset);
4631 $output = $this->csConvObj->conv($str, $this->csConvObj->parse_charset($from),
$this->renderCharset, 1);
4632 return $output ?: $str;
4646 if ($this->renderCharset != $this->metaCharset) {
4647 $content = $this->csConvObj->conv(
$content, $this->renderCharset, $this->metaCharset,
true);
4659 if ($this->renderCharset != $this->metaCharset && is_array($_POST) && !empty($_POST)) {
4660 $this->csConvObj->convArray($_POST, $this->metaCharset, $this->renderCharset);
4661 $GLOBALS[
'HTTP_POST_VARS'] = $_POST;
4672 $result = PHP_INT_MAX;
4681 foreach ($tablesToConsider as $tableDef) {
4685 return $result == PHP_INT_MAX ? PHP_INT_MAX : $result - $now + 1;
4704 $result = array(
'tt_content:' . $this->
id);
4705 if (isset($this->config[
'config'][
'cache.'][$this->
id])) {
4708 if (isset($this->config[
'config'][
'cache.'][
'all'])) {
4711 return array_unique($result);
4725 $result = PHP_INT_MAX;
4727 if (empty($tableName) || empty($pid)) {
4728 throw new \InvalidArgumentException(
'Unexpected value for parameter $tableDef. Expected <tablename>:<pid>, got \'' . htmlspecialchars($tableDef) .
'\'.
', 1307190365);
4730 // Additional fields
4731 $showHidden = $tableName === 'pages
' ? $this->showHiddenPage : $this->showHiddenRecords;
4732 $enableFields = $this->sys_page->enableFields(
4735 array('starttime
' => true, 'endtime
' => true)
4738 $timeFields = array();
4739 $selectFields = array();
4740 $whereConditions = array();
4741 foreach (array('starttime
', 'endtime
') as $field) {
4742 if (isset($GLOBALS['TCA
'][$tableName]['ctrl
']['enablecolumns
'][$field])) {
4743 $timeFields[$field] = $GLOBALS['TCA
'][$tableName]['ctrl
']['enablecolumns
'][$field];
4744 $selectFields[$field]
4746 . 'CASE WHEN
' . $timeFields[$field] . ' <=
' . $now
4747 . ' THEN NULL ELSE
' . $timeFields[$field] . ' END
'
4749 $whereConditions[$field] = $timeFields[$field] . '>
' . $now;
4753 // if starttime or endtime are defined, evaluate them
4754 if (!empty($timeFields)) {
4755 // find the timestamp, when the current page's content changes the next time
4756 $row =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetSingleRow(
4757 implode(
', ', $selectFields),
4760 .
' AND (' . implode(
' OR ', $whereConditions) .
')'
4764 foreach ($timeFields as $timeField => $_) {
4770 if ($row[$timeField] !== null && (
int)$row[$timeField] > $now) {
4771 $result = min($result, (
int)$row[$timeField]);
4786 protected function getSysDomainCache()
4788 $entryIdentifier =
'core-database-sys_domain-complete';
4792 $sysDomainData = array();
4793 if ($runtimeCache->has($entryIdentifier)) {
4794 $sysDomainData = $runtimeCache->get($entryIdentifier);
4797 'uid, pid, domainName, forced',
4799 'redirectTo=\'\' ' . $this->sys_page->enableFields(
'sys_domain', 0),
4804 foreach ($domainRecords as $row) {
4806 if (isset($sysDomainData[$row[
'pid']])) {
4808 if ($sysDomainData[$row[
'pid']][
'forced']) {
4819 $sysDomainData[$row[
'pid']] = array(
4820 'uid' => $row[
'uid'],
4821 'pid' => $row[
'pid'],
4822 'domainName' => rtrim($row[
'domainName'],
'/'),
4823 'forced' => $row[
'forced'],
4826 $runtimeCache->set($entryIdentifier, $sysDomainData);
4828 return $sysDomainData;
4842 return $currentDomain === $domainName || $currentDomain . $currentPathSegment === $domainName;
4857 if (!array_key_exists($targetPid, $this->domainDataCache)) {
4859 $sysDomainData = $this->getSysDomainCache();
4860 $rootline = $this->sys_page->getRootLine($targetPid);
4863 foreach ($rootline as $pageInRootline) {
4864 $pidInRootline = $pageInRootline[
'uid'];
4865 if (isset($sysDomainData[$pidInRootline])) {
4866 $result = $sysDomainData[$pidInRootline];
4870 $this->domainDataCache[$targetPid] = $result;
4873 return $this->domainDataCache[$targetPid];
4886 return $domainData ? $domainData[
'domainName'] : null;
4912 $this->locks[
$type][
'accessLock'] = $lockFactory->createLocker(
$type);
4914 $this->locks[
$type][
'pageLock'] = $lockFactory->createLocker(
4920 if (!$this->locks[
$type][
'accessLock']->acquire()) {
4921 throw new \RuntimeException(
'Could not acquire access lock for "' .
$type .
'"".', 1294586098);
4925 $locked = $this->locks[
$type][
'pageLock']->acquire(
4932 $this->locks[
$type][
'accessLock']->release();
4938 $this->locks[
$type][
'accessLock']->release();
4942 throw new \RuntimeException(
'Could not acquire page lock for ' . $key .
'.', 1294586098);
4957 if ($this->locks[
$type][
'accessLock']) {
4958 if (!$this->locks[$type][
'accessLock']->acquire()) {
4959 throw new \RuntimeException(
'Could not acquire access lock for "' . $type .
'"".', 1294586098);
4962 $this->locks[
$type][
'pageLock']->release();
4963 $this->locks[
$type][
'pageLock']->destroy();
4964 $this->locks[
$type][
'pageLock'] = null;
4966 $this->locks[
$type][
'accessLock']->release();
4967 $this->locks[
$type][
'accessLock'] = null;