17 use Doctrine\DBAL\DBALException;
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
20 use Psr\Log\LoggerAwareInterface;
21 use Psr\Log\LoggerAwareTrait;
102 'tempPageCacheContent' =>
'Using $TSFE->tempPageCacheContent() has been marked as internal as its purpose is to be managed from within TSFE directly.',
103 'realPageCacheContent' =>
'Using $TSFE->realPageCacheContent() has been marked as internal as its purpose is to be managed from within TSFE directly.',
104 'setPageCacheContent' =>
'Using $TSFE->setPageCacheContent() has been marked as internal as its purpose is to be managed from within TSFE directly.',
105 'clearPageCacheContent_pidList' =>
'Using $TSFE->clearPageCacheContent_pidList() has been marked as internal as its purpose is to be managed from within TSFE directly.',
106 'setSysLastChanged' =>
'Using $TSFE->setSysLastChanged() has been marked as internal as its purpose is to be managed from within TSFE directly.',
107 'contentStrReplace' =>
'Using $TSFE->contentStrReplace() has been marked as internal as its purpose is to be managed from within TSFE directly.',
108 'mergingWithGetVars' =>
'$TSFE->mergingWithGetVars() will be removed in TYPO3 v10.0. Use a middleware instead to override the PSR-7 request object AND set $_GET on top to achieve the same result.',
873 trigger_error(
'Calling TypoScriptFrontendController->__construct() with $no_cache argument set will be removed in TYPO3 v10.0. Use ->set_no_cache() instead.', E_USER_DEPRECATED);
875 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'disableNoCacheParameter']) {
876 $warning =
'&no_cache=1 has been ignored because $TYPO3_CONF_VARS[\'FE\'][\'disableNoCacheParameter\'] is set!';
879 $warning =
'&no_cache=1 has been supplied, so caching is disabled! URL: "' . GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_URL') .
'"';
883 GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__)->warning($warning);
886 $this->cHash = (string)
$cHash;
887 $this->MP =
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'enable_mount_pids'] ? (string)
$MP :
'';
888 $this->uniqueString = md5(microtime());
891 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'tslib_fe-PostProc'])) {
892 trigger_error(
'The "tslib_fe-PostProc" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
893 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'tslib_fe-PostProc'] as $_funcRef) {
894 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
897 $this->cacheHash = GeneralUtility::makeInstance(CacheHashCalculator::class);
900 $this->context = GeneralUtility::makeInstance(Context::class);
908 if ($this->pageRenderer !==
null) {
911 $this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
912 $this->pageRenderer->setTemplateFile(
'EXT:frontend/Resources/Private/Templates/MainPage.html');
934 trigger_error(
'The method "' . __METHOD__ .
'" will be removed in TYPO3 v10.0, as the database connection is checked in the TypoScriptFrontendInitialization middleware.', E_USER_DEPRECATED);
936 $connection = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable(
'pages');
937 $connection->connect();
938 }
catch (DBALException $exception) {
941 'Cannot connect to the configured database. Connection failed with: "%s"',
942 $exception->getMessage()
944 $this->logger->emergency($message, [
'exception' => $exception]);
946 $response = GeneralUtility::makeInstance(ErrorController::class)->unavailableAction(
951 throw new ImmediateResponseException($response, 1533931298);
952 }
catch (ServiceUnavailableException $e) {
953 throw new ServiceUnavailableException($message, 1301648782);
957 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'connectToDB'])) {
958 trigger_error(
'The "connectToDB" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
959 $_params = [
'pObj' => &$this];
960 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'connectToDB'] as $_funcRef) {
961 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
976 $this->pageCache = GeneralUtility::makeInstance(CacheManager::class)->getCache(
'cache_pages');
985 trigger_error(
'$TSFE->initFEuser() will be removed in TYPO3 v10.0. Use the FrontendUserAuthenticator middleware instead to initialize a Frontend User object.', E_USER_DEPRECATED);
986 $this->fe_user = GeneralUtility::makeInstance(FrontendUserAuthentication::class);
988 $pid = GeneralUtility::_GP(
'pid');
989 $this->fe_user->checkPid_value = $pid ? implode(
',', GeneralUtility::intExplode(
',', $pid)) : 0;
991 if (GeneralUtility::_GP(
'FE_SESSION_KEY')) {
992 $fe_sParts = explode(
'-', GeneralUtility::_GP(
'FE_SESSION_KEY'));
994 if (md5($fe_sParts[0] .
'/' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'encryptionKey']) === (
string)$fe_sParts[1]) {
996 $_COOKIE[$cookieName] = $fe_sParts[0];
997 if (isset($_SERVER[
'HTTP_COOKIE'])) {
999 $_SERVER[
'HTTP_COOKIE'] .=
';' . $cookieName .
'=' . $fe_sParts[0];
1001 $this->fe_user->forceSetCookie =
true;
1002 $this->fe_user->dontSetCookie =
false;
1006 $this->fe_user->start();
1007 $this->fe_user->unpack_uc();
1010 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'initFEuser'])) {
1011 trigger_error(
'The "initFEuser" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
1012 $_params = [
'pObj' => &$this];
1013 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'initFEuser'] as $_funcRef) {
1014 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1027 $this->fe_user->showHiddenRecords = $this->context->getPropertyFromAspect(
'visibility',
'includeHiddenContent',
false);
1029 $this->fe_user->fetchGroupData();
1030 $isUserAndGroupSet = is_array($this->fe_user->user) && !empty($this->fe_user->groupData[
'uid']);
1031 if ($isUserAndGroupSet) {
1035 $groupsFromUserRecord = $this->fe_user->groupData[
'uid'];
1040 if ($this->loginAllowedInBranch) {
1042 $groupsFromUserRecord = $this->fe_user->groupData[
'uid'];
1045 $groupsFromUserRecord = [];
1050 $groupsFromUserRecord = array_unique($groupsFromUserRecord);
1051 if (!empty($groupsFromUserRecord) && !$this->loginAllowedInBranch_mode) {
1052 sort($groupsFromUserRecord);
1053 $userGroups = array_merge($userGroups, array_map(
'intval', $groupsFromUserRecord));
1056 $this->context->setAspect(
'frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?:
null, $userGroups));
1059 if ($isUserAndGroupSet) {
1060 $this->fe_user->updateOnlineTimestamp();
1063 $this->logger->debug(
'Valid usergroups for TSFE: ' . implode(
',', $userGroups));
1074 $userAspect = $this->context->getAspect(
'frontend.user');
1075 return $userAspect->isUserOrGroupSet();
1089 trigger_error(
'$TSFE->checkAlternativeIdMethods() will removed in TYPO3 v10.0, extensions should use a Frontend PSR-15-based middleware to hook into the frontend process. There is no need to call this method directly.', E_USER_DEPRECATED);
1090 $this->siteScript = GeneralUtility::getIndpEnv(
'TYPO3_SITE_SCRIPT');
1092 $_params = [
'pObj' => &$this];
1093 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkAlternativeIdMethods-PostProc'] ?? [] as $_funcRef) {
1094 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1106 $GLOBALS[
'SIM_EXEC_TIME'] =
$GLOBALS[
'EXEC_TIME'];
1108 $this->fePreview = 0;
1109 $this->context->setAspect(
'date', GeneralUtility::makeInstance(DateTimeAspect::class,
new \DateTimeImmutable(
'@' .
$GLOBALS[
'SIM_EXEC_TIME'])));
1110 $this->context->setAspect(
'visibility', GeneralUtility::makeInstance(VisibilityAspect::class));
1121 return (
bool)$this->context->getPropertyFromAspect(
'backend.user',
'isLoggedIn',
false);
1132 trigger_error(
'$TSFE->initializeBackendUser() will be removed in TYPO3 v10.0. Extensions should ensure that the BackendAuthenticator middleware is run to load a backend user.', E_USER_DEPRECATED);
1134 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'preBeUser'])) {
1135 trigger_error(
'The "preBeUser" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
1136 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'preBeUser'] as $_funcRef) {
1138 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1141 $backendUserObject =
null;
1145 $GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_start'] = microtime(
true);
1147 $this->beUserLogin =
false;
1149 $backendUserObject = GeneralUtility::makeInstance(FrontendBackendUserAuthentication::class);
1150 $backendUserObject->start();
1151 $backendUserObject->unpack_uc();
1152 if (!empty($backendUserObject->user[
'uid'])) {
1153 $backendUserObject->fetchGroupData();
1156 if (!$backendUserObject->checkBackendAccessSettingsFromInitPhp() || empty($backendUserObject->user[
'uid'])) {
1157 $backendUserObject =
null;
1160 $GLOBALS[
'TYPO3_MISC'][
'microtime_BE_USER_end'] = microtime(
true);
1162 $this->context->setAspect(
'backend.user', GeneralUtility::makeInstance(UserAspect::class, $backendUserObject));
1163 $this->context->setAspect(
'workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, $backendUserObject ? $backendUserObject->workspace : 0));
1165 if (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'postBeUser'])) {
1166 trigger_error(
'The "postBeUser" hook will be removed in TYPO3 v10.0 in favor of PSR-15. Use a middleware instead.', E_USER_DEPRECATED);
1167 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'postBeUser'])) {
1169 'BE_USER' => &$backendUserObject
1171 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/index_ts.php'][
'postBeUser'] as $_funcRef) {
1172 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1175 $this->context->setAspect(
'backend.user', GeneralUtility::makeInstance(UserAspect::class, $backendUserObject));
1176 $this->context->setAspect(
'workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, $backendUserObject ? $backendUserObject->workspace : 0));
1179 return $backendUserObject;
1191 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'determineId-PreProcessing'] ?? [] as $functionReference) {
1192 $parameters = [
'parentObject' => $this];
1193 GeneralUtility::callUserFunction($functionReference, $parameters, $this);
1208 $this->fe_user->user[$this->fe_user->usergroup_column] = $originalFrontendUserGroups;
1216 if ($this->loginAllowedInBranch_mode ===
'all') {
1218 $this->fe_user->hideActiveLogin();
1219 $userGroups = [0, -1];
1221 $userGroups = [0, -2];
1223 $this->context->setAspect(
'frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?:
null, $userGroups));
1229 $this->
id = ($this->contentPid = (int)$this->
id);
1231 $this->type = (int)$this->type;
1233 $_params = [
'pObj' => &$this];
1234 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'determineId-PostProc'] ?? [] as $_funcRef) {
1235 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1254 if (!$backendUser) {
1257 $originalFrontendUserGroup =
null;
1258 if ($this->fe_user->user) {
1259 $originalFrontendUserGroup = $this->context->getPropertyFromAspect(
'frontend.user',
'groupIds');
1264 $this->fePreview = 1;
1266 $aspect = $this->context->getAspect(
'visibility');
1267 $newAspect = GeneralUtility::makeInstance(VisibilityAspect::class,
true, $aspect->includeHiddenContent(), $aspect->includeDeletedRecords());
1268 $this->context->setAspect(
'visibility', $newAspect);
1272 $this->fePreview = 1;
1274 return $this->fePreview ? $originalFrontendUserGroup :
null;
1285 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1286 ->getQueryBuilderForTable(
'pages');
1290 ->add(GeneralUtility::makeInstance(DeletedRestriction::class));
1293 ->select(
'uid',
'hidden',
'starttime',
'endtime')
1296 $queryBuilder->expr()->gte(
'pid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT))
1305 $constraint = $queryBuilder->expr()->andX(
1306 $queryBuilder->expr()->eq(
'l10n_parent', $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)),
1307 $queryBuilder->expr()->in(
'sys_language_uid', $queryBuilder->createNamedParameter(array_filter($languagesToCheck), Connection::PARAM_INT_ARRAY))
1310 if (in_array(0, $languagesToCheck,
true)) {
1312 $constraint = $queryBuilder->expr()->orX(
1315 $queryBuilder->expr()->andX(
1316 $queryBuilder->expr()->eq($field, $queryBuilder->createNamedParameter($this->id)),
1317 $queryBuilder->expr()->in(
'sys_language_uid', 0)
1322 $queryBuilder->orderBy(
'sys_language_uid',
'DESC');
1325 $constraint = $queryBuilder->expr()->eq($field, $queryBuilder->createNamedParameter($this->id));
1327 $queryBuilder->andWhere($constraint);
1329 $page = $queryBuilder->execute()->fetch();
1334 $customContext->
setAspect(
'workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, $this->
whichWorkspace()));
1335 $customContext->setAspect(
'visibility', GeneralUtility::makeInstance(VisibilityAspect::class));
1336 $pageSelectObject = GeneralUtility::makeInstance(PageRepository::class, $customContext);
1337 $targetPage = $pageSelectObject->getWorkspaceVersionOfRecord($this->
whichWorkspace(),
'pages',
$page[
'uid']);
1339 $result = $targetPage === -1 || $targetPage === -2 || (is_array($targetPage) && $targetPage[
'hidden'] == 0 &&
$page[
'hidden'] == 1);
1410 $timeTracker->push(
'fetch_the_id initialize/');
1415 $this->sys_page = GeneralUtility::makeInstance(PageRepository::class, $this->context);
1419 $this->
id = (int)$this->
id;
1420 $this->type = (int)$this->type;
1421 $timeTracker->pull();
1423 $timeTracker->push(
'fetch_the_id domain/');
1425 if ($this->domainStartPage) {
1430 $rootLevelPages = $this->sys_page->getMenu([0],
'uid',
'sorting',
'',
false);
1431 if (!empty($rootLevelPages)) {
1432 $theFirstPage = reset($rootLevelPages);
1433 $this->
id = $theFirstPage[
'uid'];
1435 $message =
'No pages are found on the rootlevel!';
1436 $this->logger->alert($message);
1438 $response = GeneralUtility::makeInstance(ErrorController::class)->unavailableAction(
1443 throw new ImmediateResponseException($response, 1533931299);
1444 }
catch (ServiceUnavailableException $e) {
1445 throw new ServiceUnavailableException($message, 1301648975);
1450 $timeTracker->pull();
1451 $timeTracker->push(
'fetch_the_id rootLine/');
1457 $this->pageNotFound = 1;
1459 $timeTracker->pull();
1460 if ($this->pageNotFound) {
1461 switch ($this->pageNotFound) {
1463 $response = GeneralUtility::makeInstance(ErrorController::class)->accessDeniedAction(
1465 'ID was not an accessible page',
1470 $response = GeneralUtility::makeInstance(ErrorController::class)->accessDeniedAction(
1472 'Subsection was found and not accessible',
1477 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
1479 'ID was outside the domain',
1484 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
1486 'The requested page alias does not exist',
1491 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
1493 'Unspecified error',
1497 throw new ImmediateResponseException($response, 1533931329);
1502 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'fetchPageId-PostProcessing'] ?? [] as $functionReference) {
1503 $parameters = [
'parentObject' => $this];
1504 GeneralUtility::callUserFunction($functionReference, $parameters, $this);
1559 if (empty($this->page)) {
1562 $this->pageNotFound = 1;
1564 $requestedPageRowWithoutGroupCheck = $this->sys_page->getPage($this->
id,
true);
1565 if (!empty($requestedPageRowWithoutGroupCheck)) {
1566 $this->pageAccessFailureHistory[
'direct_access'][] = $requestedPageRowWithoutGroupCheck;
1568 $this->rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $this->
id, $this->MP, $this->context)->get();
1569 if (!empty($this->rootLine)) {
1570 $c = count($this->rootLine) - 1;
1573 $this->pageAccessFailureHistory[
'direct_access'][] = $this->rootLine[$c];
1576 $this->
id = $this->rootLine[$c][
'uid'];
1577 $this->page = $this->sys_page->getPage($this->
id);
1578 if (!empty($this->page)) {
1583 }
catch (RootLineException $e) {
1584 $this->rootLine = [];
1587 if (empty($requestedPageRowWithoutGroupCheck) && empty($this->page)) {
1588 $message =
'The requested page does not exist!';
1589 $this->logger->error($message);
1591 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
1596 throw new ImmediateResponseException($response, 1533931330);
1597 }
catch (PageNotFoundException $e) {
1598 throw new PageNotFoundException($message, 1301648780);
1604 $message =
'The requested page does not exist!';
1605 $this->logger->error($message);
1607 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
1626 $this->page = $this->sys_page->getPageShortcut($this->page[
'shortcut'], $this->page[
'shortcut_mode'], $this->page[
'uid']);
1627 $this->
id = $this->page[
'uid'];
1634 $this->page = $this->sys_page->getPage($this->page[
'mount_pid']);
1635 if (empty($this->page)) {
1636 $message =
'This page (ID ' . $this->originalMountPointPage[
'uid'] .
') is of type "Mount point" and '
1637 .
'mounts a page which is not accessible (ID ' . $this->originalMountPointPage[
'mount_pid'] .
').';
1641 if ($this->MP ===
'' || !empty($this->originalShortcutPage)) {
1642 $this->MP = $this->page[
'uid'] .
'-' . $this->originalMountPointPage[
'uid'];
1644 $this->MP .=
',' . $this->page[
'uid'] .
'-' . $this->originalMountPointPage[
'uid'];
1646 $this->
id = $this->page[
'uid'];
1650 $this->rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $this->
id, $this->MP, $this->context)->get();
1651 }
catch (RootLineException $e) {
1652 $this->rootLine = [];
1655 if (empty($this->rootLine)) {
1656 $message =
'The requested page didn\'t have a proper connection to the tree-root!';
1657 $this->logger->error($message);
1659 $response = GeneralUtility::makeInstance(ErrorController::class)->unavailableAction(
1664 throw new ImmediateResponseException($response, 1533931350);
1665 }
catch (ServiceUnavailableException $e) {
1671 if (empty($this->rootLine)) {
1672 $message =
'The requested page was not accessible!';
1674 $response = GeneralUtility::makeInstance(ErrorController::class)->unavailableAction(
1679 throw new ImmediateResponseException($response, 1533931351);
1680 }
catch (ServiceUnavailableException $e) {
1681 $this->logger->warning($message);
1682 throw new ServiceUnavailableException($message, 1301648234);
1685 $el = reset($this->rootLine);
1686 $this->
id = $el[
'uid'];
1687 $this->page = $this->sys_page->getPage($this->
id);
1689 $this->rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $this->
id, $this->MP, $this->context)->get();
1690 }
catch (RootLineException $e) {
1691 $this->rootLine = [];
1705 $this->page = $this->sys_page->getPage($this->
id);
1707 if (empty($this->page) || (
int)$this->page[
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField']] === 0) {
1710 $languageId = (int)$this->page[
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'languageField']];
1711 $this->page = $this->sys_page->getPage($this->page[
$GLOBALS[
'TCA'][
'pages'][
'ctrl'][
'transOrigPointerField']]);
1712 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, $languageId));
1713 $this->
id = $this->page[
'uid'];
1716 $_GET[
'L'] = $languageId;
1717 $GLOBALS[
'HTTP_GET_VARS'][
'L'] = $languageId;
1737 public function getPageShortcut($SC, $mode, $thisUid, $itera = 20, $pageLog = [], $disableGroupCheck =
false)
1739 trigger_error(
'$TSFE->getPageShortcut() has been moved to PageRepository, use the PageRepository directly to call this functionality, as this method will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
1740 return $this->sys_page->getPageShortcut($SC, $mode, $thisUid, $itera, $pageLog, $disableGroupCheck);
1769 $c = count($this->rootLine);
1770 $removeTheRestFlag =
false;
1771 for ($a = 0; $a < $c; $a++) {
1775 $this->pageAccessFailureHistory[
'sub_section'][] = $this->rootLine[$a];
1776 $this->pageNotFound = 2;
1782 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
1783 ->getQueryBuilderForTable(
'pages');
1789 $row = $queryBuilder
1793 $queryBuilder->expr()->eq(
1795 $queryBuilder->createNamedParameter($this->id, \PDO::PARAM_INT)
1805 $removeTheRestFlag =
true;
1809 $removeTheRestFlag =
true;
1813 $removeTheRestFlag =
true;
1815 if ($removeTheRestFlag) {
1817 $this->pageNotFound = 2;
1818 unset($this->rootLine[$a]);
1821 return $removeTheRestFlag;
1836 $_params = [
'pObj' => $this,
'row' => &$row,
'bypassGroupCheck' => &$bypassGroupCheck];
1837 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_checkEnableFields'] ?? [] as $_funcRef) {
1839 $return = GeneralUtility::callUserFunction($_funcRef, $_params, $this);
1840 if ($return ===
false) {
1844 if ((!$row[
'hidden'] || $this->context->getPropertyFromAspect(
'visibility',
'includeHiddenPages',
false))
1845 && $row[
'starttime'] <=
$GLOBALS[
'SIM_ACCESS_TIME']
1846 && ($row[
'endtime'] == 0 || $row[
'endtime'] >
$GLOBALS[
'SIM_ACCESS_TIME'])
1847 && ($bypassGroupCheck || $this->checkPageGroupAccess($row))) {
1863 $userAspect = $this->context->getAspect(
'frontend.user');
1864 $pageGroupList = explode(
',', $row[
'fe_group'] ?: 0);
1865 return count(array_intersect($userAspect->getGroupIds(), $pageGroupList)) > 0;
1896 $c = count($this->rootLine);
1897 $loginAllowed =
true;
1899 for ($a = 0; $a < $c; $a++) {
1901 if ($this->rootLine[$a][
'fe_login_mode'] > 0) {
1903 if ((
int)$this->rootLine[$a][
'fe_login_mode'] === 1) {
1904 $loginAllowed =
false;
1905 $this->loginAllowedInBranch_mode =
'all';
1906 } elseif ((
int)$this->rootLine[$a][
'fe_login_mode'] === 3) {
1907 $loginAllowed =
false;
1908 $this->loginAllowedInBranch_mode =
'groups';
1910 $loginAllowed =
true;
1914 return $loginAllowed;
1926 if ($failureReasonCode) {
1927 $output[
'code'] = $failureReasonCode;
1929 $combinedRecords = array_merge(is_array($this->pageAccessFailureHistory[
'direct_access']) ? $this->pageAccessFailureHistory[
'direct_access'] : [[
'fe_group' => 0]], is_array($this->pageAccessFailureHistory[
'sub_section']) ? $this->pageAccessFailureHistory[
'sub_section'] : []);
1930 if (!empty($combinedRecords)) {
1931 foreach ($combinedRecords as $k => $pagerec) {
1934 if (!$k || $pagerec[
'extendToSubpages']) {
1935 if ($pagerec[
'hidden']) {
1936 $output[
'hidden'][$pagerec[
'uid']] =
true;
1938 if ($pagerec[
'starttime'] >
$GLOBALS[
'SIM_ACCESS_TIME']) {
1939 $output[
'starttime'][$pagerec[
'uid']] = $pagerec[
'starttime'];
1941 if ($pagerec[
'endtime'] != 0 && $pagerec[
'endtime'] <=
$GLOBALS[
'SIM_ACCESS_TIME']) {
1942 $output[
'endtime'][$pagerec[
'uid']] = $pagerec[
'endtime'];
1945 $output[
'fe_group'][$pagerec[
'uid']] = $pagerec[
'fe_group'];
1966 foreach ($this->rootLine as $key => $val) {
1974 $this->pageNotFound = 3;
1991 trigger_error(
'$TSFE->pageUnavailableAndExit() will be removed in TYPO3 v10.0. Use TYPO3\'s ErrorController with Request/Response objects instead.', E_USER_DEPRECATED);
1992 $header = $header ?:
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageUnavailable_handling_statheader'];
1993 $this->
pageUnavailableHandler($GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageUnavailable_handling'], $header, $reason);
2006 trigger_error(
'$TSFE->pageNotFoundAndExit() will be removed in TYPO3 v10.0. Use TYPO3\'s ErrorController with Request/Response objects instead.', E_USER_DEPRECATED);
2007 $header = $header ?:
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageNotFound_handling_statheader'];
2008 $this->
pageNotFoundHandler($GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageNotFound_handling'], $header, $reason);
2021 trigger_error(
'$TSFE->checkPageUnavailableHandler() will be removed in TYPO3 v10.0. Use TYPO3\'s ErrorController with Request/Response objects instead.', E_USER_DEPRECATED);
2023 $GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageUnavailable_handling']
2024 && !GeneralUtility::cmpIP(
2025 GeneralUtility::getIndpEnv(
'REMOTE_ADDR'),
2026 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'devIPmask']
2029 $checkPageUnavailableHandler =
true;
2031 $checkPageUnavailableHandler =
false;
2033 return $checkPageUnavailableHandler;
2046 trigger_error(
'$TSFE->pageUnavailableHandler() will be removed in TYPO3 v10.0. Use TYPO3\'s ErrorController with Request/Response objects instead.', E_USER_DEPRECATED);
2060 trigger_error(
'$TSFE->pageNotFoundHandler() will be removed in TYPO3 v10.0. Use TYPO3\'s ErrorController with Request/Response objects instead.', E_USER_DEPRECATED);
2076 trigger_error(
'$TSFE->pageErrorHandler() will be removed in TYPO3 v10.0. Use TYPO3\'s ErrorController with Request/Response objects instead.', E_USER_DEPRECATED);
2079 $headerArr = preg_split(
'/\\r|\\n/', $header, -1, PREG_SPLIT_NO_EMPTY);
2080 foreach ($headerArr as $header) {
2086 if (strtolower($code) ===
'true' || (
string)$code ===
'1' || is_bool($code)) {
2087 echo GeneralUtility::makeInstance(ErrorPageController::class)->errorAction(
2089 'The page did not exist or was inaccessible.' . ($reason ?
' Reason: ' . $reason :
'')
2091 } elseif (GeneralUtility::isFirstPartOfStr($code,
'USER_FUNCTION:')) {
2092 $funcRef = trim(substr($code, 14));
2094 'currentUrl' => GeneralUtility::getIndpEnv(
'REQUEST_URI'),
2095 'reasonText' => $reason,
2099 echo GeneralUtility::callUserFunction($funcRef, $params, $this);
2100 }
catch (\Exception $e) {
2101 throw new \RuntimeException(
'Error: 404 page by USER_FUNCTION "' . $funcRef .
'" failed.', 1509296032, $e);
2103 } elseif (GeneralUtility::isFirstPartOfStr($code,
'READFILE:')) {
2104 $readFile = GeneralUtility::getFileAbsFileName(trim(substr($code, 9)));
2105 if (@is_file($readFile)) {
2108 '###CURRENT_URL###',
2112 GeneralUtility::getIndpEnv(
'REQUEST_URI'),
2113 htmlspecialchars($reason)
2115 file_get_contents($readFile)
2118 throw new \RuntimeException(
'Configuration Error: 404 page "' . $readFile .
'" could not be found.', 1294587214);
2120 } elseif (GeneralUtility::isFirstPartOfStr($code,
'REDIRECT:')) {
2122 } elseif ($code !==
'') {
2124 $url_parts = parse_url($code);
2126 if (empty($url_parts[
'host'])) {
2127 $url_parts[
'host'] = GeneralUtility::getIndpEnv(
'HTTP_HOST');
2128 if ($code[0] ===
'/') {
2129 $code = GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_HOST') . $code;
2131 $code = GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_DIR') . $code;
2133 $checkBaseTag =
false;
2135 $checkBaseTag =
true;
2138 if ($code == GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_URL')) {
2139 if ($reason ==
'') {
2140 $reason =
'Page cannot be found.';
2142 $reason .= LF . LF .
'Additionally, ' . $code .
' was not found while trying to retrieve the error document.';
2143 throw new \RuntimeException(nl2br(htmlspecialchars($reason)), 1294587215);
2147 'User-agent: ' . GeneralUtility::getIndpEnv(
'HTTP_USER_AGENT'),
2148 'Referer: ' . GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_URL')
2151 $res = GeneralUtility::getUrl($code, 1, $headerArr, $report);
2152 if ((
int)$report[
'error'] !== 0 && (
int)$report[
'error'] !== 200) {
2153 throw new \RuntimeException(
'Failed to fetch error page "' . $code .
'", reason: ' . $report[
'message'], 1509296606);
2156 list($header,
$content) = explode(CRLF . CRLF, $res, 2);
2158 if (
false === $res) {
2166 $headerArr = preg_split(
'/\\r|\\n/', $header, -1, PREG_SPLIT_NO_EMPTY);
2167 foreach ($headerArr as $header) {
2168 foreach ($forwardHeaders as $h) {
2169 if (preg_match(
'/^' . $h .
'/', $header)) {
2175 if ($checkBaseTag) {
2177 if (
false === stristr(
$content,
'<base ')) {
2179 $base = $url_parts[
'scheme'] .
'://';
2180 if ($url_parts[
'user'] !=
'') {
2181 $base .= $url_parts[
'user'];
2182 if ($url_parts[
'pass'] !=
'') {
2183 $base .=
':' . $url_parts[
'pass'];
2187 $base .= $url_parts[
'host'];
2189 $base .= preg_replace(
'/(.*\\/)[^\\/]*/',
'${1}', $url_parts[
'path']);
2191 $replacement = LF .
'<base href="' . htmlentities($base) .
'" />' . LF;
2195 $content = preg_replace(
'/(<html[^>]*>)/i',
'\\1<head>' . $replacement .
'</head>',
$content);
2203 echo GeneralUtility::makeInstance(ErrorPageController::class)->errorAction(
2205 $reason ?
'Reason: ' . $reason :
'Page cannot be found.'
2218 $aid = $this->sys_page->getPageIdFromAlias($this->
id);
2222 $this->pageNotFound = 4;
2235 if (is_array($GET_VARS)) {
2237 $realGet = GeneralUtility::_GET();
2238 if (!is_array($realGet)) {
2247 if (isset($GET_VARS[
'type'])) {
2248 $this->type = (int)$GET_VARS[
'type'];
2250 if (isset($GET_VARS[
'cHash'])) {
2251 $this->cHash = (string)$GET_VARS[
'cHash'];
2253 if (isset($GET_VARS[
'MP'])) {
2254 $this->MP =
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'enable_mount_pids'] ? $GET_VARS[
'MP'] :
'';
2256 if (isset($GET_VARS[
'no_cache']) && $GET_VARS[
'no_cache']) {
2257 $this->
set_no_cache(
'no_cache is requested via GET parameter');
2278 trigger_error(
'$TSFE->makeCacheHash() will be removed in TYPO3 v10.0, as this is now handled in the PSR-15 middleware.', E_USER_DEPRECATED);
2280 if ($this->no_cache && !
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageNotFoundOnCHashError']) {
2283 $GET = GeneralUtility::_GET();
2284 if ($this->cHash !==
'' && is_array($GET)) {
2288 $cHash_calc = $this->cacheHash->calculateCacheHash($this->cHash_array);
2289 if (!hash_equals($cHash_calc, $this->cHash)) {
2290 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageNotFoundOnCHashError']) {
2291 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
2293 'Request parameters could not be validated (&cHash comparison failed)',
2296 throw new ImmediateResponseException($response, 1533931352);
2299 $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);
2301 } elseif (is_array($GET)) {
2317 $skip = $this->pageArguments !==
null && empty($this->pageArguments->getDynamicArguments());
2318 if ($this->cHash !==
'' || $skip) {
2321 if ($this->pageArguments) {
2322 $queryParams = $this->pageArguments->getDynamicArguments();
2323 $queryParams[
'id'] = $this->pageArguments->getPageId();
2324 $argumentsThatWouldRequireCacheHash = $this->cacheHash
2326 if (empty($argumentsThatWouldRequireCacheHash)) {
2330 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'pageNotFoundOnCHashError']) {
2331 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
2333 'Request parameters could not be validated (&cHash empty)',
2336 throw new ImmediateResponseException($response, 1533931354);
2357 trigger_error(
'$TSFE->initTemplate() will be removed in TYPO3 v10.0. Instantiating TemplateService is done implicitly on usage within $TSFE directly.', E_USER_DEPRECATED);
2358 $this->tmpl = GeneralUtility::makeInstance(TemplateService::class, $this->context);
2371 $this->content =
'';
2374 $this->cacheContentFlag =
false;
2376 if ($this->no_cache) {
2380 if (!($this->tmpl instanceof TemplateService)) {
2381 $this->tmpl = GeneralUtility::makeInstance(TemplateService::class, $this->context);
2384 $pageSectionCacheContent = $this->tmpl->getCurrentPageData();
2385 if (!is_array($pageSectionCacheContent)) {
2390 $this->
acquireLock(
'pagesection', $this->
id .
'::' . $this->MP);
2396 $pageSectionCacheContent = $this->tmpl->getCurrentPageData();
2397 if (is_array($pageSectionCacheContent)) {
2405 if (is_array($pageSectionCacheContent)) {
2409 $pageSectionCacheContent = $this->tmpl->matching($pageSectionCacheContent);
2410 ksort($pageSectionCacheContent);
2411 $this->all = $pageSectionCacheContent;
2413 unset($pageSectionCacheContent);
2420 $this->newHash = $this->
getHash();
2423 if (!is_array($row)) {
2433 if (is_array($row)) {
2440 if (is_array($row)) {
2444 $_params = [
'pObj' => &$this,
'cache_pages_row' => &$row];
2445 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'pageLoadedFromCache'] ?? [] as $_funcRef) {
2446 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
2449 $this->config = $row[
'cache_data'];
2451 $this->content = $row[
'content'];
2453 $this->cacheContentFlag =
true;
2454 $this->cacheExpires = $row[
'expires'];
2456 $this->pageCacheTags = $row[
'cacheTags'] ?? [];
2460 $this->page[
'title'] = $row[
'pageTitleInfo'][
'title'];
2461 $this->altPageTitle = $row[
'pageTitleInfo'][
'altPageTitle'];
2462 $this->indexedDocTitle = $row[
'pageTitleInfo'][
'indexedDocTitle'];
2464 if (isset($this->config[
'config'][
'debug'])) {
2465 $debugCacheTime = (bool)$this->config[
'config'][
'debug'];
2467 $debugCacheTime = !empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'debug']);
2469 if ($debugCacheTime) {
2470 $dateFormat =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'ddmmyy'];
2471 $timeFormat =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'hhmm'];
2472 $this->content .= LF .
'<!-- Cached page generated ' . date($dateFormat .
' ' . $timeFormat, $row[
'tstamp']) .
'. Expires ' . date($dateFormat .
' ' . $timeFormat, $row[
'expires']) .
' -->';
2493 $row = $this->pageCache->get($this->newHash);
2507 $disableAcquireCacheData =
false;
2509 if (strtolower($_SERVER[
'HTTP_CACHE_CONTROL']) ===
'no-cache' || strtolower($_SERVER[
'HTTP_PRAGMA']) ===
'no-cache') {
2510 $disableAcquireCacheData =
true;
2514 $_params = [
'pObj' => &$this,
'disableAcquireCacheData' => &$disableAcquireCacheData];
2515 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'headerNoCache'] ?? [] as $_funcRef) {
2516 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
2518 return $disableAcquireCacheData;
2544 return md5($lockHash);
2565 $userAspect = $this->context->getAspect(
'frontend.user');
2567 'id' => (int)$this->
id,
2569 'gr_list' => (string)implode(
',', $userAspect->getGroupIds()),
2571 'siteBase' => $siteBase,
2575 'staticRouteArguments' => $this->pageArguments !==
null ? $this->pageArguments->getStaticArguments() :
null,
2579 if (!$createLockHashBase) {
2584 'hashParameters' => &$hashParameters,
2585 'createLockHashBase' => $createLockHashBase
2587 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'createHashBase'] ?? [] as $_funcRef) {
2588 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
2590 return serialize($hashParameters);
2600 if (!($this->tmpl instanceof TemplateService)) {
2601 $this->tmpl = GeneralUtility::makeInstance(TemplateService::class, $this->context);
2605 if (empty($this->config) || is_array($this->config[
'INTincScript']) || $this->forceTemplateParsing) {
2607 $timeTracker->push(
'Parse template');
2611 $this->tmpl->start($this->rootLine);
2612 $timeTracker->pull();
2616 if ($this->tmpl->loaded) {
2617 $timeTracker->push(
'Setting the config-array');
2619 $this->sPre = $this->tmpl->setup[
'types.'][
$this->type];
2620 $this->pSetup = $this->tmpl->setup[$this->sPre .
'.'];
2621 if (!is_array($this->pSetup)) {
2622 $message =
'The page is not configured! [type=' . $this->type .
'][' . $this->sPre .
'].';
2623 $this->logger->alert($message);
2625 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
2630 throw new ImmediateResponseException($response, 1533931374);
2631 }
catch (PageNotFoundException $e) {
2632 $explanation =
'This means that there is no TypoScript object of type PAGE with typeNum=' . $this->type .
' configured.';
2636 if (!isset($this->config[
'config'])) {
2637 $this->config[
'config'] = [];
2640 if (is_array($this->tmpl->setup[
'config.'])) {
2642 $this->config[
'config'] = $this->tmpl->setup[
'config.'];
2645 if (is_array($this->pSetup[
'config.'])) {
2649 if ($this->config[
'config'][
'typolinkCheckRootline']) {
2650 $this->
logDeprecatedTyposcript(
'config.typolinkCheckRootline',
'The functionality is always enabled since TYPO3 v9 and can be removed from your TypoScript code');
2653 if (!isset($this->config[
'config'][
'removeDefaultJS'])) {
2654 $this->config[
'config'][
'removeDefaultJS'] =
'external';
2656 if (!isset($this->config[
'config'][
'inlineStyle2TempFile'])) {
2657 $this->config[
'config'][
'inlineStyle2TempFile'] = 1;
2660 if (!isset($this->config[
'config'][
'compressJs'])) {
2661 $this->config[
'config'][
'compressJs'] = 0;
2664 $this->config[
'rootLine'] = $this->tmpl->rootLine;
2666 if ($this->pSetup[
'pageHeaderFooterTemplateFile']) {
2668 $file = GeneralUtility::makeInstance(FilePathSanitizer::class)
2669 ->sanitize((
string)$this->pSetup[
'pageHeaderFooterTemplateFile']);
2670 $this->pageRenderer->setTemplateFile($file);
2671 }
catch (\
TYPO3\CMS\Core\Resource\Exception $e) {
2676 $timeTracker->pull();
2678 $message =
'No TypoScript template found!';
2679 $this->logger->alert($message);
2681 $response = GeneralUtility::makeInstance(ErrorController::class)->unavailableAction(
2686 throw new ImmediateResponseException($response, 1533931380);
2687 }
catch (ServiceUnavailableException $e) {
2688 throw new ServiceUnavailableException($message, 1294587218);
2695 if ($this->config[
'config'][
'no_cache']) {
2700 if (!empty($this->config[
'config'][
'defaultGetVars.'])) {
2701 $modifiedGetVars = GeneralUtility::removeDotsFromTS($this->config[
'config'][
'defaultGetVars.']);
2703 $_GET = $modifiedGetVars;
2704 $GLOBALS[
'HTTP_GET_VARS'] = $modifiedGetVars;
2709 $this->config[
'config'][
'absRefPrefix'] = $this->config[
'config'][
'absRefPrefix'] ??
'auto';
2715 $params = [
'config' => &$this->config[
'config']];
2716 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'configArrayPostProc'] ?? [] as $funcRef) {
2717 GeneralUtility::callUserFunction($funcRef, $params, $this);
2736 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'settingLanguage_preProcess'] ?? [] as $_funcRef) {
2737 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
2745 if ($siteLanguage) {
2746 $languageKey = $siteLanguage->getTypo3Language();
2748 $languageKey = $this->config[
'config'][
'language'] ??
'default';
2750 $this->lang = $languageKey;
2754 if (isset($this->config[
'config'][
'metaCharset']) && $this->config[
'config'][
'metaCharset'] !==
'utf-8') {
2755 $this->metaCharset = $this->config[
'config'][
'metaCharset'];
2759 if ($siteLanguage) {
2765 $languageId = $languageAspect->getId();
2766 $languageContentId = $languageAspect->getContentId();
2769 if ($languageAspect->getId() > 0) {
2775 $olRec = $this->sys_page->getPageOverlay($this->
id, $languageAspect->getId());
2776 if (empty($olRec)) {
2778 if (GeneralUtility::hideIfNotTranslated($this->page[
'l18n_cfg'])) {
2779 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
2781 'Page is not available in the requested language.',
2784 throw new ImmediateResponseException($response, 1533931388);
2786 switch ((
string)$languageAspect->getLegacyLanguageMode()) {
2788 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
2790 'Page is not available in the requested language (strict).',
2793 throw new ImmediateResponseException($response, 1533931395);
2796 case 'content_fallback':
2799 foreach ($languageAspect->getFallbackChain() ?? [] as $orderValue) {
2800 if ($orderValue ===
'0' || $orderValue === 0 || $orderValue ===
'') {
2801 $languageContentId = 0;
2805 $languageContentId = (int)$orderValue;
2808 if ($orderValue ===
'pageNotFound') {
2812 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
2814 'Page is not available in the requested language (fallbacks did not apply).',
2822 $languageContentId = $languageAspect->getId();
2826 $languageId = ($languageContentId = 0);
2831 $languageAspect = GeneralUtility::makeInstance(
2832 LanguageAspect::class,
2835 $languageAspect->getOverlayType(),
2836 $languageAspect->getFallbackChain()
2842 $this->page = $this->sys_page->getPageOverlay($this->page, $languageAspect->getContentId());
2849 $this->context->setAspect(
'language', $languageAspect);
2852 $this->sys_page = GeneralUtility::makeInstance(PageRepository::class, $this->context);
2854 if ((!$languageAspect->getContentId() || !$languageAspect->getId())
2855 && GeneralUtility::hideIfDefaultLanguage($this->page[
'l18n_cfg'] ?? 0)
2857 $message =
'Page is not available in default language.';
2858 $this->logger->error($message);
2859 $response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
2867 if ($languageAspect->getId() > 0) {
2874 $this->sys_language_isocode = $siteLanguage->getTwoLetterIsoCode();
2875 } elseif ($languageAspect->getContentId() > 0) {
2879 $sys_language_row = $this->sys_page->getRawRecord(
'sys_language', $languageAspect->getContentId(),
'language_isocode,static_lang_isocode');
2880 if (is_array($sys_language_row) && !empty($sys_language_row[
'language_isocode'])) {
2881 $this->sys_language_isocode = $sys_language_row[
'language_isocode'];
2884 if (!empty($this->config[
'config'][
'sys_language_isocode'])) {
2885 $this->sys_language_isocode = $this->config[
'config'][
'sys_language_isocode'];
2890 if (!empty($this->config[
'config'][
'sys_language_isocode_default'])) {
2891 $this->sys_language_isocode = $this->config[
'config'][
'sys_language_isocode_default'];
2893 $this->sys_language_isocode = $languageKey !==
'default' ? $languageKey :
'en';
2898 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'settingLanguage_postProcess'] ?? [] as $_funcRef) {
2899 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
2909 $this->rootLine = GeneralUtility::makeInstance(RootlineUtility::class, $this->
id, $this->MP, $this->context)->get();
2910 }
catch (RootLineException $e) {
2911 $this->rootLine = [];
2913 $this->tmpl->updateRootlineData($this->rootLine);
2922 $locale = $this->config[
'config'][
'locale_all'];
2924 if ($siteLanguage) {
2925 $locale = $siteLanguage->getLocale();
2928 $availableLocales = GeneralUtility::trimExplode(
',', $locale,
true);
2932 $locale = setlocale(LC_COLLATE, ...$availableLocales);
2937 if (strpos($locale,
'tr') !== 0) {
2938 setlocale(LC_CTYPE, ...$availableLocales);
2940 setlocale(LC_MONETARY, ...$availableLocales);
2941 setlocale(LC_TIME, ...$availableLocales);
2957 if (!is_null($this->originalShortcutPage)) {
2958 $originalShortcutPageOverlay = $this->sys_page->getPageOverlay($this->originalShortcutPage[
'uid'], $languageId);
2959 if (!empty($originalShortcutPageOverlay[
'shortcut']) && $originalShortcutPageOverlay[
'shortcut'] != $this->
id) {
2962 $shortcut = $this->sys_page->getPageShortcut($originalShortcutPageOverlay[
'shortcut'], $originalShortcutPageOverlay[
'shortcut_mode'], $originalShortcutPageOverlay[
'uid']);
2963 $this->
id = ($this->contentPid = $shortcut[
'uid']);
2964 $this->page = $this->sys_page->getPage($this->
id);
2967 $this->tmpl->rootLine = array_reverse($this->rootLine);
2979 trigger_error(
'$TSFE->handleDataSubmission() will be removed in TYPO3 v10.0. Use a PSR-15 middleware. The hooks are still executed as PSR-15 middleware but will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
2981 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'checkDataSubmission'] ?? [] as $className) {
2982 $_procObj = GeneralUtility::makeInstance($className);
2983 $_procObj->checkDataSubmission($this);
2996 $urlHandlers =
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'urlProcessing'][
'urlHandlers'] ??
false;
2997 if (!$urlHandlers) {
2998 if (!$calledFromCore) {
2999 trigger_error(
'$TSFE->initializeRedirectUrlHandlers() will be removed in TYPO3 v10.0. Do not call this method anymore and implement UrlHandlers by PSR-15 middlewares instead.', E_USER_DEPRECATED);
3003 trigger_error(
'The system has registered RedirectUrlHandlers via $TYPO3_CONF_VARS[SC_OPTIONS][urlProcessing][urlHandlers]. This functionality will be removed in TYPO3 v10.0. Ensure that extensions using this functionality switch to PSR-15 middlewares instead.', E_USER_DEPRECATED);
3005 foreach ($urlHandlers as $identifier => $configuration) {
3006 if (empty($configuration) || !is_array($configuration)) {
3007 throw new \RuntimeException(
'Missing configuration for URL handler "' . $identifier .
'".', 1442052263);
3009 if (!is_string($configuration[
'handler']) || empty($configuration[
'handler']) || !class_exists($configuration[
'handler']) || !is_subclass_of($configuration[
'handler'], UrlHandlerInterface::class)) {
3010 throw new \RuntimeException(
'The URL handler "' . $identifier .
'" defines an invalid provider. Ensure the class exists and implements the "' . UrlHandlerInterface::class .
'".', 1442052249);
3014 $orderedHandlers = GeneralUtility::makeInstance(DependencyOrderingService::class)->orderByDependencies($urlHandlers);
3016 foreach ($orderedHandlers as $configuration) {
3018 $urlHandler = GeneralUtility::makeInstance($configuration[
'handler']);
3019 if ($urlHandler->canHandleCurrentUrl()) {
3020 $this->activeUrlHandlers[] = $urlHandler;
3038 if (!$calledFromCore) {
3039 trigger_error(
'$TSFE->redirectToExternalUrl() will be removed in TYPO3 v10.0. Do not call this method anymore and implement UrlHandlers by PSR-15 middlewares instead.', E_USER_DEPRECATED);
3041 foreach ($this->activeUrlHandlers as $redirectHandler) {
3042 $response = $redirectHandler->handle();
3043 if ($response instanceof ResponseInterface) {
3048 if (!empty($this->activeUrlHandlers)) {
3049 throw new \RuntimeException(
'A URL handler is active but did not process the URL.', 1442305505);
3061 if ($this->config[
'config'][
'ftu']) {
3062 $this->getMethodUrlIdToken =
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'get_url_id_token'];
3064 $this->getMethodUrlIdToken =
'';
3076 if ($queryParams ===
null) {
3077 trigger_error(
'Calling $TSFE->calculateLinkVars() without first argument will not be supported in TYPO3 v10.0. anymore, and needs to be an array.', E_USER_DEPRECATED);
3078 $queryParams = GeneralUtility::_GET();
3080 $this->linkVars =
'';
3081 if (empty($this->config[
'config'][
'linkVars'])) {
3091 $test = $value =
'';
3092 if (preg_match(
'/^(.*)\\((.+)\\)$/', $linkVar, $match)) {
3093 $linkVar = trim($match[1]);
3094 $test = trim($match[2]);
3097 $keys = explode(
'|', $linkVar);
3098 $numberOfLevels = count($keys);
3099 $rootKey = trim($keys[0]);
3100 if (!isset($queryParams[$rootKey])) {
3103 $value = $queryParams[$rootKey];
3104 for ($i = 1; $i < $numberOfLevels; $i++) {
3105 $currentKey = trim($keys[$i]);
3106 if (isset($value[$currentKey])) {
3107 $value = $value[$currentKey];
3113 if ($value !==
false) {
3114 $parameterName = $keys[0];
3115 for ($i = 1; $i < $numberOfLevels; $i++) {
3116 $parameterName .=
'[' . $keys[$i] .
']';
3118 if (!is_array($value)) {
3119 $temp = rawurlencode($value);
3124 $value =
'&' . $parameterName .
'=' . $temp;
3126 if ($test !==
'' && $test !==
'array') {
3132 $this->linkVars .= $value;
3146 $tempCommaReplacementString =
'###KASPER###';
3149 $string = preg_replace_callback(
'/\((?>[^()]|(?R))*\)/',
function ($result) use ($tempCommaReplacementString) {
3150 return str_replace(
',', $tempCommaReplacementString, $result[0]);
3153 $string = GeneralUtility::trimExplode(
',', $string);
3156 return str_replace($tempCommaReplacementString,
',', $string);
3171 if ($needle ===
'int' || $needle ===
'integer') {
3175 } elseif (preg_match(
'/^\\/.+\\/[imsxeADSUXu]*$/', $needle)) {
3177 if (@preg_match($needle, $haystack)) {
3180 } elseif (strstr($needle,
'-')) {
3183 $range = explode(
'-', $needle);
3184 if ($range[0] <= $haystack && $range[1] >= $haystack) {
3188 } elseif (strstr($needle,
'|')) {
3191 $haystack = str_replace(
' ',
'', $haystack);
3192 if (strstr(
'|' . $needle .
'|',
'|' . $haystack .
'|')) {
3195 } elseif ((
string)$needle === (
string)$haystack) {
3229 trigger_error(
'$TSFE->checkPageForMountpointRedirect() will be removed in TYPO3 v10.0, as this is now handled within a PSR-15 middleware.', E_USER_DEPRECATED);
3263 trigger_error(
'$TSFE->checkPageForShortcutRedirect() will be removed in TYPO3 v10.0, as this is now done within a PSR-15 middleware.', E_USER_DEPRECATED);
3276 trigger_error(
'$TSFE->redirectToCurrentPage() will be removed in TYPO3 v10.0, as this is now done within a PSR-15 middleware.', E_USER_DEPRECATED);
3279 if (!empty($redirectUrl) && GeneralUtility::getIndpEnv(
'REQUEST_URI') !==
'/' . $redirectUrl) {
3294 $parameter = $this->page[
'uid'];
3298 return GeneralUtility::makeInstance(ContentObjectRenderer::class, $this)->typoLink_URL([
3299 'parameter' => $parameter,
3300 'addQueryString' =>
true,
3301 'addQueryString.' => [
'exclude' =>
'id'],
3303 'forceAbsoluteUrl' =>
$GLOBALS[
'TYPO3_REQUEST'] instanceof ServerRequestInterface
3304 &&
$GLOBALS[
'TYPO3_REQUEST']->getAttribute(
'site') instanceof
Site
3321 return !$this->cacheContentFlag && empty($this->activeUrlHandlers);
3331 $timeOutTime =
$GLOBALS[
'EXEC_TIME'] + $cacheTimeout;
3332 $usePageCache =
true;
3336 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'usePageCache'] ?? [] as $className) {
3337 $usePageCache = GeneralUtility::makeInstance($className)->usePageCache($this, $usePageCache);
3340 if ($usePageCache) {
3344 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'insertPageIncache'] ?? [] as $className) {
3345 GeneralUtility::makeInstance($className)->insertPageIncache($this, $timeOutTime);
3363 'cache_data' => $data,
3364 'expires' => $expirationTstamp,
3366 'pageTitleInfo' => [
3367 'title' => $this->page[
'title'],
3372 $this->cacheExpires = $expirationTstamp;
3373 $this->pageCacheTags[] =
'pageId_' . $cacheData[
'page_id'];
3375 if ($this->
id !== $this->contentPid) {
3378 if ($this->page_cache_reg1) {
3380 trigger_error(
'$TSFE->page_cache_reg1 will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
3381 $reg1 = (int)$this->page_cache_reg1;
3382 $cacheData[
'reg1'] = $reg1;
3383 $this->pageCacheTags[] =
'reg1_' . $reg1;
3385 if (!empty($this->page[
'cache_tags'])) {
3386 $tags = GeneralUtility::trimExplode(
',', $this->page[
'cache_tags'],
true);
3387 $this->pageCacheTags = array_merge($this->pageCacheTags, $tags);
3391 $this->pageCache->set($this->newHash, $cacheData, $this->pageCacheTags, $expirationTstamp -
$GLOBALS[
'EXEC_TIME']);
3399 $this->pageCache->remove($this->newHash);
3409 $pageIds = GeneralUtility::trimExplode(
',', $pidList);
3410 foreach ($pageIds as $pageId) {
3411 $this->pageCache->flushByTag(
'pageId_' . (
int)$pageId);
3424 if ($this->page[
'SYS_LASTCHANGED'] < (
int)$this->
register[
'SYS_LASTCHANGED'] && !$this->
doWorkspacePreview()) {
3425 $connection = GeneralUtility::makeInstance(ConnectionPool::class)
3426 ->getConnectionForTable(
'pages');
3427 $pageId = $this->page[
'_PAGES_OVERLAY_UID'] ??
$this->id;
3428 $connection->update(
3431 'SYS_LASTCHANGED' => (
int)$this->
register[
'SYS_LASTCHANGED']
3434 'uid' => (
int)$pageId
3449 $this->
register[
'SYS_LASTCHANGED'] = (int)
$page[
'tstamp'];
3450 if ($this->
register[
'SYS_LASTCHANGED'] < (
int)$page[
'SYS_LASTCHANGED']) {
3451 $this->
register[
'SYS_LASTCHANGED'] = (int)
$page[
'SYS_LASTCHANGED'];
3474 $this->pageCacheTags = array_merge($this->pageCacheTags, $tags);
3497 $this->newHash = $this->
getHash();
3500 $this->cacheTimeOutDefault = (int)($this->config[
'config'][
'cache_period'] ?? 0);
3513 if ($request ===
null) {
3514 trigger_error(
'$TSFE->preparePageContentGeneration() requires a ServerRequestInterface as first argument, add this argument in order to avoid this deprecation error.', E_USER_DEPRECATED);
3518 if (isset($this->page[
'content_from_pid']) && $this->page[
'content_from_pid'] > 0) {
3520 $temp_copy_TSFE = clone $this;
3522 $temp_copy_TSFE->id = $this->page[
'content_from_pid'];
3523 $temp_copy_TSFE->MP =
'';
3524 $temp_copy_TSFE->getPageAndRootlineWithDomain($this->config[
'config'][
'content_from_pid_allowOutsideDomain'] ? 0 : $this->domainStartPage);
3525 $this->contentPid = (int)$temp_copy_TSFE->id;
3526 unset($temp_copy_TSFE);
3528 if ($this->config[
'config'][
'MP_defaults'] ??
false) {
3529 $temp_parts = GeneralUtility::trimExplode(
'|', $this->config[
'config'][
'MP_defaults'],
true);
3530 foreach ($temp_parts as $temp_p) {
3531 list($temp_idP, $temp_MPp) = explode(
':', $temp_p, 2);
3532 $temp_ids = GeneralUtility::intExplode(
',', $temp_idP);
3533 foreach ($temp_ids as $temp_id) {
3534 $this->MP_defaults[$temp_id] = $temp_MPp;
3539 $this->indexedDocTitle = $this->page[
'title'] ??
null;
3540 $this->
debug = !empty($this->config[
'config'][
'debug']);
3542 if (isset($this->config[
'config'][
'baseURL'])) {
3543 $this->baseUrl = $this->config[
'config'][
'baseURL'];
3546 $this->intTarget = (string)($this->config[
'config'][
'intTarget'] ??
'');
3547 $this->extTarget = (string)($this->config[
'config'][
'extTarget'] ??
'');
3548 $this->fileTarget = (string)($this->config[
'config'][
'fileTarget'] ??
'');
3549 $this->spamProtectEmailAddresses = $this->config[
'config'][
'spamProtectEmailAddresses'] ?? 0;
3550 if ($this->spamProtectEmailAddresses !==
'ascii') {
3554 if (!empty($this->config[
'config'][
'absRefPrefix'])) {
3557 $this->absRefPrefix = GeneralUtility::getIndpEnv(
'TYPO3_SITE_PATH');
3562 $this->absRefPrefix =
'';
3564 $this->ATagParams = trim($this->config[
'config'][
'ATagParams'] ??
'') ?
' ' . trim($this->config[
'config'][
'ATagParams']) :
'';
3565 $this->
initializeSearchWordData($request->getParsedBody()[
'sword_list'] ?? $request->getQueryParams()[
'sword_list'] ??
null);
3569 if (!isset($this->config[
'config'][
'xhtmlDoctype']) || !$this->config[
'config'][
'xhtmlDoctype']) {
3570 $this->config[
'config'][
'xhtmlDoctype'] = $this->config[
'config'][
'doctype'] ??
'';
3572 if ($this->config[
'config'][
'xhtmlDoctype']) {
3573 $this->xhtmlDoctype = $this->config[
'config'][
'xhtmlDoctype'];
3575 switch ((
string)$this->config[
'config'][
'xhtmlDoctype']) {
3577 case 'xhtml_strict':
3578 $this->xhtmlVersion = 100;
3581 $this->xhtmlVersion = 105;
3584 case 'xhtml+rdfa_10':
3585 $this->xhtmlVersion = 110;
3588 $this->pageRenderer->setRenderXhtml(
false);
3589 $this->xhtmlDoctype =
'';
3590 $this->xhtmlVersion = 0;
3593 $this->pageRenderer->setRenderXhtml(
false);
3611 $this->sWordRegEx =
'';
3612 $this->sWordList = $searchWords ===
null ?
'' : $searchWords;
3613 if (is_array($this->sWordList)) {
3614 $space = !empty($this->config[
'config'][
'sword_standAlone'] ??
null) ?
'[[:space:]]' :
'';
3616 foreach ($this->sWordList as $val) {
3617 if (trim($val) !==
'') {
3618 $regexpParts[] = $space . preg_quote($val,
'/') . $space;
3621 $this->sWordRegEx = implode(
'|', $regexpParts);
3632 if ($this->no_cacheBeforePageGen) {
3633 $this->
set_no_cache(
'no_cache has been set before the page was generated - safety check',
true);
3636 $_params = [
'pObj' => &$this];
3637 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-all'] ?? [] as $_funcRef) {
3638 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
3641 if (!$this->no_cache) {
3643 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-cached'] ?? [] as $_funcRef) {
3644 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
3654 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'pageIndexing'] ?? [] as $className) {
3655 GeneralUtility::makeInstance($className)->hook_indexContent($this);
3658 if (!$this->no_cache) {
3673 $pageTitleSeparator =
'';
3676 if (isset($this->config[
'config'][
'pageTitleSeparator']) && $this->config[
'config'][
'pageTitleSeparator'] !==
'') {
3677 $pageTitleSeparator = $this->config[
'config'][
'pageTitleSeparator'];
3679 if (isset($this->config[
'config'][
'pageTitleSeparator.']) && is_array($this->config[
'config'][
'pageTitleSeparator.'])) {
3680 $pageTitleSeparator = $this->cObj->stdWrap($pageTitleSeparator, $this->config[
'config'][
'pageTitleSeparator.']);
3682 $pageTitleSeparator .=
' ';
3686 $titleProvider = GeneralUtility::makeInstance(PageTitleProviderManager::class);
3687 if (!empty($this->config[
'config'][
'pageTitleCache'])) {
3688 $titleProvider->setPageTitleCache($this->config[
'config'][
'pageTitleCache']);
3690 $pageTitle = $titleProvider->getTitle();
3691 $this->config[
'config'][
'pageTitleCache'] = $titleProvider->getPageTitleCache();
3693 if ($pageTitle !==
'') {
3694 $this->indexedDocTitle = $pageTitle;
3699 (
bool)($this->config[
'config'][
'noPageTitle'] ??
false),
3700 (
bool)($this->config[
'config'][
'pageTitleFirst'] ??
false),
3703 if ($this->config[
'config'][
'titleTagFunction'] ??
false) {
3705 $this->
logDeprecatedTyposcript(
'config.titleTagFunction',
'Please use the new TitleTag API to create custom title tags. Deprecated in version 9, will be removed in version 10');
3707 $titleTagContent = $this->cObj->callUserFunction(
3708 $this->config[
'config'][
'titleTagFunction'],
3714 if (isset($this->config[
'config'][
'pageTitle.']) && is_array($this->config[
'config'][
'pageTitle.'])) {
3715 $titleTagContent = $this->cObj->stdWrap($titleTagContent, $this->config[
'config'][
'pageTitle.']);
3719 if (isset($this->config[
'config'][
'noPageTitle']) && (
int)$this->config[
'config'][
'noPageTitle'] === 2) {
3720 $titleTagContent =
'';
3722 if ($titleTagContent !==
'') {
3723 $this->pageRenderer->setTitle($titleTagContent);
3725 return (
string)$titleTagContent;
3738 protected function printTitle(
string $pageTitle,
bool $noTitle =
false,
bool $showTitleFirst =
false,
string $pageTitleSeparator =
''): string
3740 $siteTitle = trim($this->tmpl->setup[
'sitetitle'] ??
'');
3741 $pageTitle = $noTitle ?
'' : $pageTitle;
3742 if ($showTitleFirst) {
3744 $siteTitle = $pageTitle;
3748 if ($pageTitle ===
'' || $siteTitle ===
'') {
3749 $pageTitleSeparator =
'';
3750 } elseif (empty($pageTitleSeparator)) {
3752 $pageTitleSeparator =
': ';
3754 return $siteTitle . $pageTitleSeparator . $pageTitle;
3764 $this->additionalHeaderData = (isset($this->config[
'INTincScript_ext'][
'additionalHeaderData']) && is_array($this->config[
'INTincScript_ext'][
'additionalHeaderData']))
3765 ? $this->config[
'INTincScript_ext'][
'additionalHeaderData']
3767 $this->additionalFooterData = (isset($this->config[
'INTincScript_ext'][
'additionalFooterData']) && is_array($this->config[
'INTincScript_ext'][
'additionalFooterData']))
3768 ? $this->config[
'INTincScript_ext'][
'additionalFooterData']
3770 $this->additionalJavaScript = $this->config[
'INTincScript_ext'][
'additionalJavaScript'] ??
null;
3771 $this->additionalCSS = $this->config[
'INTincScript_ext'][
'additionalCSS'] ??
null;
3772 $this->divSection =
'';
3773 if (empty($this->config[
'INTincScript_ext'][
'pageRenderer'])) {
3777 $pageRenderer = unserialize($this->config[
'INTincScript_ext'][
'pageRenderer']);
3779 GeneralUtility::setSingletonInstance(PageRenderer::class,
$pageRenderer);
3787 $this->content = str_replace(
3789 '<!--HD_' . $this->config[
'INTincScript_ext'][
'divKey'] .
'-->',
3790 '<!--FD_' . $this->config[
'INTincScript_ext'][
'divKey'] .
'-->',
3791 '<!--TDS_' . $this->config[
'INTincScript_ext'][
'divKey'] .
'-->'
3798 $this->pageRenderer->renderJavaScriptAndCssForProcessingOfUncachedContentObjects($this->content, $this->config[
'INTincScript_ext'][
'divKey'])
3814 $INTiS_config = $this->config[
'INTincScript'];
3818 $INTiS_config = @array_diff_assoc($this->config[
'INTincScript'], $INTiS_config);
3819 $reprocess = count($INTiS_config) > 0;
3820 }
while ($reprocess);
3832 $timeTracker->push(
'Split content');
3834 $INTiS_splitC = explode(
'<!--INT_SCRIPT.', $this->content);
3835 $this->content =
'';
3836 $timeTracker->setTSlogMessage(
'Parts: ' . count($INTiS_splitC));
3837 $timeTracker->pull();
3838 foreach ($INTiS_splitC as $INTiS_c => $INTiS_cPart) {
3840 if (substr($INTiS_cPart, 32, 3) ===
'-->') {
3841 $INTiS_key =
'INT_SCRIPT.' . substr($INTiS_cPart, 0, 32);
3842 if (is_array($INTiS_config[$INTiS_key])) {
3843 $label =
'Include ' . $INTiS_config[$INTiS_key][
'type'];
3844 $label = $label . isset($INTiS_config[$INTiS_key][
'file']) ?
' ' . $INTiS_config[$INTiS_key][
'file'] :
'';
3845 $timeTracker->push($label);
3847 $INTiS_cObj = unserialize($INTiS_config[$INTiS_key][
'cObj']);
3849 switch ($INTiS_config[$INTiS_key][
'type']) {
3851 $incContent = $INTiS_cObj->cObjGetSingle(
'COA', $INTiS_config[$INTiS_key][
'conf']);
3854 $incContent = $INTiS_cObj->cObjGetSingle(
'USER', $INTiS_config[$INTiS_key][
'conf']);
3856 case 'POSTUSERFUNC':
3857 $incContent = $INTiS_cObj->callUserFunction($INTiS_config[$INTiS_key][
'postUserFunc'], $INTiS_config[$INTiS_key][
'conf'], $INTiS_config[$INTiS_key][
'content']);
3861 $this->content .= substr($INTiS_cPart, 35);
3862 $timeTracker->pull($incContent);
3864 $this->content .= substr($INTiS_cPart, 35);
3867 $this->content .= ($INTiS_c ?
'<!--INT_SCRIPT.' :
'') . $INTiS_cPart;
3878 $jsCode = trim($this->JSCode);
3880 ? implode(LF, $this->additionalJavaScript)
3881 : $this->additionalJavaScript;
3884 $this->additionalHeaderData[
'JSCode'] =
'
3885 <script type="text/javascript">
3895 $additionalCss = is_array($this->additionalCSS) ? implode(LF, $this->additionalCSS) : $this->additionalCSS;
3896 $additionalCss = trim($additionalCss);
3897 if ($additionalCss !==
'') {
3898 $this->additionalHeaderData[
'_CSS'] =
'
3899 <style type="text/css">
3900 ' . $additionalCss .
'
3912 return is_array($this->config[
'INTincScript']) && empty($this->activeUrlHandlers);
3929 $enableOutput = empty($this->activeUrlHandlers);
3931 $_params = [
'pObj' => &$this,
'enableOutput' => &$enableOutput];
3932 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'isOutputting'] ?? [] as $_funcRef) {
3933 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
3935 return $enableOutput;
3949 trigger_error(
'TypoScriptFrontendController->processOutput() will be removed in TYPO3 v10.0. Use streamFile() instead.', E_USER_DEPRECATED);
3962 if (empty($this->config[
'config'][
'disableCharsetHeader'])) {
3963 $headLine =
'Content-Type: ' . $this->contentType .
'; charset=' . trim($this->metaCharset);
3967 if (empty($this->config[
'config'][
'disableLanguageHeader']) && !empty($this->sys_language_isocode)) {
3968 $headLine =
'Content-Language: ' . trim($this->sys_language_isocode);
3972 if (!empty($this->config[
'config'][
'sendCacheHeaders'])) {
3974 foreach ($headers as $header => $value) {
3975 header($header .
': ' . $value);
3980 foreach ($additionalHeaders as $headerConfig) {
3982 $headerConfig[
'header'],
3984 $headerConfig[
'replace'],
3985 $headerConfig[
'statusCode']
3999 if (!$this->isClientCachable) {
4003 $_params = [
'pObj' => &$this];
4004 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'contentPostProc-output'] ?? [] as $_funcRef) {
4005 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
4018 if (empty($this->config[
'config'][
'disableCharsetHeader'])) {
4019 $response = $response->withHeader(
'Content-Type', $this->contentType .
'; charset=' . trim($this->metaCharset));
4022 if (empty($this->config[
'config'][
'disableLanguageHeader']) && !empty($this->sys_language_isocode)) {
4023 $response = $response->withHeader(
'Content-Language', trim($this->sys_language_isocode));
4026 if (!empty($this->config[
'config'][
'sendCacheHeaders'])) {
4028 foreach ($headers as $header => $value) {
4029 $response = $response->withHeader($header, $value);
4034 foreach ($additionalHeaders as $headerConfig) {
4035 list($header, $value) = GeneralUtility::trimExplode(
':', $headerConfig[
'header'],
false, 2);
4036 if ($headerConfig[
'statusCode']) {
4037 $response = $response->withStatus((
int)$headerConfig[
'statusCode']);
4039 if ($headerConfig[
'replace']) {
4040 $response = $response->withHeader($header, $value);
4042 $response = $response->withAddedHeader($header, $value);
4055 trigger_error(
'$TSFE->sendCacheHeaders() will be removed in TYPO3 v10.0, as all headers are compiled within "processOutput" depending on various scenarios. Use $TSFE->processOutput() instead.', E_USER_DEPRECATED);
4057 foreach ($headers as $header => $value) {
4058 header($header .
': ' . $value);
4072 $loginsDeniedCfg = empty($this->config[
'config'][
'sendCacheHeaders_onlyWhenLoginDeniedInBranch']) || empty($this->loginAllowedInBranch);
4075 if ($this->isClientCachable) {
4077 'Expires' => gmdate(
'D, d M Y H:i:s T', $this->cacheExpires),
4078 'ETag' =>
'"' . md5($this->content) .
'"',
4079 'Cache-Control' =>
'max-age=' . ($this->cacheExpires -
$GLOBALS[
'EXEC_TIME']),
4081 'Pragma' =>
'public'
4086 'Cache-Control' =>
'private, no-store'
4094 if ($this->no_cache) {
4095 $reasonMsg[] =
'Caching disabled (no_cache).';
4098 $reasonMsg[] =
'*_INT object(s) on page.';
4100 if (is_array($this->fe_user->user)) {
4101 $reasonMsg[] =
'Frontend user logged in.';
4134 if (!empty($this->fe_user->user[
'uid'])) {
4136 $token = isset($this->config[
'config'][
'USERNAME_substToken']) ? trim($this->config[
'config'][
'USERNAME_substToken']) :
'';
4137 $search[] = $token ? $token :
'<!--###USERNAME###-->';
4138 $replace[] = htmlspecialchars($this->fe_user->user[
'username']);
4140 $token = isset($this->config[
'config'][
'USERUID_substToken']) ? trim($this->config[
'config'][
'USERUID_substToken']) :
'';
4143 $replace[] = $this->fe_user->user[
'uid'];
4147 if ($this->getMethodUrlIdToken) {
4149 $replace[] = $this->fe_user->get_URL_ID;
4152 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'tslib_fe-contentStrReplace'] ?? [] as $_funcRef) {
4154 'search' => &$search,
4155 'replace' => &$replace
4157 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
4159 if (!empty($search)) {
4160 $this->content = str_replace($search, $replace, $this->content);
4171 trigger_error(
'$TSFE->storeSessionData() will be removed in TYPO3 v10.0. Use the call on the FrontendUserAuthentication object directly instead.', E_USER_DEPRECATED);
4172 $this->fe_user->storeSessionData();
4184 trigger_error(
'$TSFE->previewInfo() will be removed in TYPO3 v10.0, as this is now called by the Frontend RequestHandler.', E_USER_DEPRECATED);
4185 } elseif (!empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_previewInfo'])) {
4186 trigger_error(
'The hook "hook_previewInfo" will be removed in TYPO3 v10.0, but is still in use. Use "hook_eofe" instead.', E_USER_DEPRECATED);
4188 if ($this->fePreview !== 0) {
4190 $_params = [
'pObj' => &$this];
4191 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_previewInfo'] ?? [] as $_funcRef) {
4192 $previewInfo .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
4194 $this->content = str_ireplace(
'</body>', $previewInfo .
'</body>', $this->content);
4205 trigger_error(
'$TSFE->hook_eofe() will be removed in TYPO3 v10.0. The hook is now executed within Frontend RequestHandler.', E_USER_DEPRECATED);
4206 $_params = [
'pObj' => &$this];
4207 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'hook_eofe'] ?? [] as $_funcRef) {
4208 GeneralUtility::callUserFunction($_funcRef, $_params, $this);
4219 trigger_error(
'$TSFE->addTempContentHttpHeaders() will be removed in TYPO3 v10.0, as all headers are compiled within "processOutput" depending on various scenarios. Use $TSFE->processOutput() instead.', E_USER_DEPRECATED);
4220 header(
'HTTP/1.0 503 Service unavailable');
4222 foreach ($headers as $header => $value) {
4223 header($header .
': ' . $value);
4235 'Retry-after' =>
'3600',
4236 'Pragma' =>
'no-cache',
4237 'Cache-control' =>
'no-cache',
4255 $this->cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class, $this);
4256 $this->cObj->start($this->page,
'pages');
4267 if (!$this->absRefPrefix) {
4277 '"' . $this->absRefPrefix .
'typo3temp/',
4283 $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
4284 $storages = $storageRepository->findAll();
4285 foreach ($storages as $storage) {
4286 if ($storage->getDriverType() ===
'Local' && $storage->isPublic() && $storage->isOnline()) {
4287 $folder = $storage->getPublicUrl($storage->getRootLevelFolder(),
true);
4288 $search[] =
'"' . $folder;
4289 $replace[] =
'"' . $this->absRefPrefix . $folder;
4293 $directories = GeneralUtility::trimExplode(
',',
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'additionalAbsRefPrefixDirectories'],
true);
4294 foreach ($directories as $directory) {
4295 $search[] =
'"' . $directory;
4296 $replace[] =
'"' . $this->absRefPrefix . $directory;
4298 $this->content = str_replace(
4314 if ($this->baseUrl) {
4315 $urlParts = parse_url($url);
4316 if (empty($urlParts[
'scheme']) && $url[0] !==
'/') {
4317 $url = $this->baseUrl . $url;
4333 $explanationText = $explanation !==
'' ?
' - ' . $explanation :
'';
4335 trigger_error(
'TypoScript property ' . $typoScriptProperty .
' is deprecated' . $explanationText, E_USER_DEPRECATED);
4349 return $this->context->getPropertyFromAspect(
'workspace',
'isOffline',
false);
4359 return $this->context->getPropertyFromAspect(
'workspace',
'id', 0);
4375 if (!is_array($this->pagesTSconfig)) {
4377 foreach ($this->rootLine as $k => $v) {
4379 $TSdataArray[] = $v[
'TSconfig'];
4380 if (trim($v[
'tsconfig_includes'])) {
4381 $includeTsConfigFileList = GeneralUtility::trimExplode(
',', $v[
'tsconfig_includes'],
true);
4383 $includeTsConfigFileList = array_reverse($includeTsConfigFileList);
4385 foreach ($includeTsConfigFileList as $includeTsConfigFile) {
4386 if (strpos($includeTsConfigFile,
'EXT:') === 0) {
4387 list($includeTsConfigFileExtensionKey, $includeTsConfigFilename) = explode(
4389 substr($includeTsConfigFile, 4),
4392 if ((
string)$includeTsConfigFileExtensionKey !==
''
4393 && (
string)$includeTsConfigFilename !==
''
4398 if (strpos($includeTsConfigFileAndPath, $extensionPath) === 0 && file_exists($includeTsConfigFileAndPath)) {
4399 $TSdataArray[] = file_get_contents($includeTsConfigFileAndPath);
4407 $TSdataArray[] =
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'defaultPageTSconfig'];
4409 $TSdataArray = array_reverse($TSdataArray);
4412 $userTS = implode(LF .
'[GLOBAL]' . LF, $TSdataArray);
4413 $identifier = md5(
'pageTS:' . $userTS);
4414 $contentHashCache = GeneralUtility::makeInstance(CacheManager::class)->getCache(
'cache_hash');
4415 $this->pagesTSconfig = $contentHashCache->get($identifier);
4416 if (!is_array($this->pagesTSconfig)) {
4417 $parseObj = GeneralUtility::makeInstance(TypoScriptParser::class);
4418 $parseObj->parse($userTS);
4419 $this->pagesTSconfig = $parseObj->setup;
4420 $contentHashCache->set($identifier, $this->pagesTSconfig, [
'PAGES_TSconfig'], 0);
4438 trigger_error(
'$TSFE->setJS("mouseOver") will be removed in TYPO3 v10.0. If necessary, use setJS() with your recommended code.', E_USER_DEPRECATED);
4440 $this->additionalJavaScript[$key] =
' // JS function for mouse-over
4441 function over(name, imgObj) { //
4442 if (document[name]) {document[name].src = eval(name+"_h.src");}
4443 else if (document.getElementById && document.getElementById(name)) {document.getElementById(name).src = eval(name+"_h.src");}
4444 else if (imgObj) {imgObj.src = eval(name+"_h.src");}
4446 // JS function for mouse-out
4447 function out(name, imgObj) { //
4448 if (document[name]) {document[name].src = eval(name+"_n.src");}
4449 else if (document.getElementById && document.getElementById(name)) {document.getElementById(name).src = eval(name+"_n.src");}
4450 else if (imgObj) {imgObj.src = eval(name+"_n.src");}
4454 $this->additionalJavaScript[$key] =
' function openPic(url, winName, winParams) { //
4455 var theWindow = window.open(url, winName, winParams);
4456 if (theWindow) {theWindow.focus();}
4460 $this->additionalJavaScript[$key] =
$content;
4476 trigger_error(
'$TSFE->setCSS() will be removed in TYPO3 v10.0, use PageRenderer instead to add CSS.', E_USER_DEPRECATED);
4491 return md5($this->uniqueString .
'_' . $str . $this->uniqueCounter++);
4500 public function set_no_cache($reason =
'', $internal =
false)
4502 if ($reason !==
'') {
4503 $warning =
'$TSFE->set_no_cache() was triggered. Reason: ' . $reason .
'.';
4505 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
4508 $file = $trace[0][
'file'];
4509 if (strpos($file, $realWebPath) === 0) {
4510 $file = str_replace($realWebPath,
'', $file);
4514 $line = $trace[0][
'line'];
4515 $trigger = $file .
' on line ' . $line;
4516 $warning =
'$GLOBALS[\'TSFE\']->set_no_cache() was triggered by ' . $trigger .
'.';
4518 if (!$internal &&
$GLOBALS[
'TYPO3_CONF_VARS'][
'FE'][
'disableNoCacheParameter']) {
4519 $warning .=
' However, $TYPO3_CONF_VARS[\'FE\'][\'disableNoCacheParameter\'] is set, so it will be ignored!';
4522 $warning .=
' Caching is disabled!';
4526 $this->logger->notice($warning);
4528 $this->logger->warning($warning);
4539 $this->no_cache =
true;
4549 $this->cacheTimeOutDefault = (int)$seconds;
4560 $runtimeCache = GeneralUtility::makeInstance(CacheManager::class)->getCache(
'cache_runtime');
4561 $cachedCacheLifetimeIdentifier =
'core-tslib_fe-get_cache_timeout';
4562 $cachedCacheLifetime = $runtimeCache->get($cachedCacheLifetimeIdentifier);
4563 if ($cachedCacheLifetime ===
false) {
4564 if ($this->page[
'cache_timeout']) {
4566 $cacheTimeout = $this->page[
'cache_timeout'];
4567 } elseif ($this->cacheTimeOutDefault) {
4572 $cacheTimeout = 86400;
4574 if (!empty($this->config[
'config'][
'cache_clearAtMidnight'])) {
4575 $timeOutTime =
$GLOBALS[
'EXEC_TIME'] + $cacheTimeout;
4576 $midnightTime = mktime(0, 0, 0, date(
'm', $timeOutTime), date(
'd', $timeOutTime), date(
'Y', $timeOutTime));
4579 if ($midnightTime >
$GLOBALS[
'EXEC_TIME']) {
4580 $cacheTimeout = $midnightTime -
$GLOBALS[
'EXEC_TIME'];
4587 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'tslib/class.tslib_fe.php'][
'get_cache_timeout'] ?? [] as $_funcRef) {
4588 $params = [
'cacheTimeout' => $cacheTimeout];
4589 $cacheTimeout = GeneralUtility::callUserFunction($_funcRef, $params, $this);
4591 $runtimeCache->set($cachedCacheLifetimeIdentifier, $cacheTimeout);
4592 $cachedCacheLifetime = $cacheTimeout;
4594 return $cachedCacheLifetime;
4606 trigger_error(
'$TSFE->getUniqueId() will be removed in TYPO3 v10.0, implement this functionality on your own with a proper Singleton Pattern which can be used outside of the frontend scope as well, if needed.', E_USER_DEPRECATED);
4607 if ($desired ===
'') {
4611 $uniqueId = $desired;
4612 for ($i = 1; isset($this->usedUniqueIds[$uniqueId]); $i++) {
4613 $uniqueId = $desired .
'_' . $i;
4616 $this->usedUniqueIds[$uniqueId] =
true;
4631 public function sL($input)
4633 return $this->languageService->sL($input);
4645 trigger_error(
'$TSFE->readLLfile() will be removed in TYPO3 v10.0. The method LanguageService->includeLLFile() can be used directly.', E_USER_DEPRECATED);
4646 return $this->languageService->includeLLFile($fileRef,
false,
true);
4657 public function getLLL($index, $LOCAL_LANG)
4659 trigger_error(
'$TSFE->getLLL() will be removed in TYPO3 v10.0. The method LanguageService->getLLL() can be used directly.', E_USER_DEPRECATED);
4660 if (isset($LOCAL_LANG[$this->lang][$index][0][
'target'])) {
4663 if (isset($LOCAL_LANG[
'default'][$index][0][
'target'])) {
4664 return $LOCAL_LANG[
'default'][$index][0][
'target'];
4677 trigger_error(
'$TSFE->initLLvars() will be removed in TYPO3 v10.0, the initialization can be altered via hooks within settingLanguage().', E_USER_DEPRECATED);
4678 $this->lang = $this->config[
'config'][
'language'] ?:
'default';
4682 if ($this->config[
'config'][
'metaCharset']) {
4683 $this->metaCharset = trim(strtolower($this->config[
'config'][
'metaCharset']));
4695 $this->pageRenderer->setLanguage($language);
4696 $this->languageService = GeneralUtility::makeInstance(LanguageService::class);
4698 $this->languageService->debugKey =
false;
4699 $this->languageService->init($language);
4711 if ($this->metaCharset !==
'utf-8') {
4713 $charsetConverter = GeneralUtility::makeInstance(CharsetConverter::class);
4717 throw new \RuntimeException(
'Invalid config.metaCharset: ' . $e->getMessage(), 1508916185);
4729 trigger_error(
'$TSFE->convPOSTCharset() will be removed in TYPO3 v10.0. A PSR-15 middleware is now taking care of the conversion. It seems you called this method from your own bootstrap code - ensure that the PrepareTypoScriptFrontendRendering middleware is called and you can remove the method call.', E_USER_DEPRECATED);
4730 if ($this->metaCharset !==
'utf-8' && is_array($_POST) && !empty($_POST)) {
4745 foreach ($data as $key => $value) {
4746 if (is_array($data[$key])) {
4748 } elseif (is_string($data[$key])) {
4749 $data[$key] = mb_convert_encoding($data[$key],
'utf-8', $fromCharset);
4761 $result = PHP_INT_MAX;
4770 foreach ($tablesToConsider as $tableDef) {
4774 return $result === PHP_INT_MAX ? PHP_INT_MAX : $result - $now + 1;
4794 if (isset($this->config[
'config'][
'cache.'][$this->
id])) {
4795 $result = array_merge($result, GeneralUtility::trimExplode(
',', $this->config[
'config'][
'cache.'][$this->
id]));
4797 if (isset($this->config[
'config'][
'cache.'][
'all'])) {
4798 $result = array_merge($result, GeneralUtility::trimExplode(
',', $this->config[
'config'][
'cache.'][
'all']));
4800 return array_unique($result);
4815 $result = PHP_INT_MAX;
4816 list($tableName, $pid) = GeneralUtility::trimExplode(
':', $tableDef);
4817 if (empty($tableName) || empty($pid)) {
4818 throw new \InvalidArgumentException(
'Unexpected value for parameter $tableDef. Expected <tablename>:<pid>, got \'' . htmlspecialchars($tableDef) .
'\'.
', 1307190365);
4821 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
4822 ->getQueryBuilderForTable($tableName);
4823 $queryBuilder->getRestrictions()
4824 ->removeByType(StartTimeRestriction::class)
4825 ->removeByType(EndTimeRestriction::class);
4827 $timeConditions = $queryBuilder->expr()->orX();
4828 foreach (['starttime
', 'endtime
'] as $field) {
4829 if (isset($GLOBALS['TCA
'][$tableName]['ctrl
']['enablecolumns
'][$field])) {
4830 $timeFields[$field] = $GLOBALS['TCA
'][$tableName]['ctrl
']['enablecolumns
'][$field];
4831 $queryBuilder->addSelectLiteral(
4834 . $queryBuilder->expr()->lte(
4835 $timeFields[$field],
4836 $queryBuilder->createNamedParameter($now, \PDO::PARAM_INT)
4838 . ' THEN NULL ELSE
' . $queryBuilder->quoteIdentifier($timeFields[$field]) . ' END
'
4839 . ') AS
' . $queryBuilder->quoteIdentifier($timeFields[$field])
4841 $timeConditions->add(
4842 $queryBuilder->expr()->gt(
4843 $timeFields[$field],
4844 $queryBuilder->createNamedParameter($now, \PDO::PARAM_INT)
4850 // if starttime or endtime are defined, evaluate them
4851 if (!empty($timeFields)) {
4852 // find the timestamp, when the current page's content changes the next time
4853 $row = $queryBuilder
4856 $queryBuilder->expr()->eq(
4858 $queryBuilder->createNamedParameter($pid, \PDO::PARAM_INT)
4866 foreach ($timeFields as $timeField => $_) {
4872 if ($row[$timeField] !==
null && (
int)$row[$timeField] > $now) {
4873 $result = min($result, (
int)$row[$timeField]);
4892 trigger_error(
'$TSFE->domainNameMatchesCurrentRequest() will be removed in TYPO3 v10.0, use LegacyDomainResolver instead.', E_USER_DEPRECATED);
4893 $currentDomain = GeneralUtility::getIndpEnv(
'HTTP_HOST');
4894 $currentPathSegment = trim(preg_replace(
'|/[^/]*$|',
'', GeneralUtility::getIndpEnv(
'SCRIPT_NAME')));
4895 return $currentDomain === $domainName || $currentDomain . $currentPathSegment === $domainName;
4908 trigger_error(
'$TSFE->getDomainDataForPid() will be removed in TYPO3 v10.0, use LegacyDomainResolver instead.', E_USER_DEPRECATED);
4909 return GeneralUtility::makeInstance(LegacyDomainResolver::class)->matchPageId((
int)$targetPid,
$GLOBALS[
'TYPO3_REQUEST']);
4922 trigger_error(
'$TSFE->getDomainNameForPid() will be removed in TYPO3 v10.0, use LegacyDomainResolver instead.', E_USER_DEPRECATED);
4923 $domainData = GeneralUtility::makeInstance(LegacyDomainResolver::class)->matchPageId((
int)$targetPid,
$GLOBALS[
'TYPO3_REQUEST']);
4924 return $domainData ? $domainData[
'domainName'] :
null;
4974 $lockFactory = GeneralUtility::makeInstance(LockFactory::class);
4977 $this->locks[
$type][
'pageLock'] = $lockFactory->createLocker(
4983 if (!$this->locks[
$type][
'accessLock']->acquire()) {
4984 throw new \RuntimeException(
'Could not acquire access lock for "' .
$type .
'"".', 1294586098);
4988 $locked = $this->locks[
$type][
'pageLock']->acquire(
4991 }
catch (LockAcquireWouldBlockException $e) {
4995 $this->locks[
$type][
'accessLock']->release();
5001 $this->locks[
$type][
'accessLock']->release();
5005 throw new \RuntimeException(
'Could not acquire page lock for ' . $key .
'.', 1460975877);
5019 if ($this->locks[
$type][
'accessLock']) {
5020 if (!$this->locks[
$type][
'accessLock']->acquire()) {
5021 throw new \RuntimeException(
'Could not acquire access lock for "' .
$type .
'"".', 1460975902);
5024 $this->locks[
$type][
'pageLock']->release();
5025 $this->locks[
$type][
'pageLock']->destroy();
5026 $this->locks[
$type][
'pageLock'] =
null;
5028 $this->locks[
$type][
'accessLock']->release();
5029 $this->locks[
$type][
'accessLock'] =
null;
5040 if (!isset($this->config[
'config'][
'additionalHeaders.'])) {
5043 $additionalHeaders = [];
5044 ksort($this->config[
'config'][
'additionalHeaders.']);
5045 foreach ($this->config[
'config'][
'additionalHeaders.'] as $options) {
5046 if (!is_array($options)) {
5049 $header = trim($options[
'header'] ??
'');
5050 if ($header ===
'') {
5053 $additionalHeaders[] = [
5054 'header' => $header,
5056 'replace' => ($options[
'replace'] ??
'') !==
'0',
5057 'statusCode' => (
int)($options[
'httpResponseCode'] ?? 0) ?:
null
5060 return $additionalHeaders;
5065 return $this->fePreview
5067 || $this->context->getPropertyFromAspect(
'visibility',
'includeHiddenPages',
false)
5068 || $this->context->getPropertyFromAspect(
'visibility',
'includeHiddenContent',
false);
5086 return GeneralUtility::makeInstance(TimeTracker::class);
5097 &&
$GLOBALS[
'TYPO3_REQUEST'] instanceof ServerRequestInterface
5099 return $GLOBALS[
'TYPO3_REQUEST']->getAttribute(
'language');
5119 public function __isset(
string $propertyName)
5121 switch ($propertyName) {
5122 case 'sys_language_uid':
5123 trigger_error(
'Property $TSFE->sys_language_uid is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5124 return isset($this->$propertyName);
5125 case 'sys_language_content':
5126 trigger_error(
'Property $TSFE->sys_language_content is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5127 return isset($this->$propertyName);
5128 case 'sys_language_contentOL':
5129 trigger_error(
'Property $TSFE->sys_language_contentOL is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5130 return isset($this->$propertyName);
5131 case 'sys_language_mode':
5132 trigger_error(
'Property $TSFE->sys_language_mode is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5133 return isset($this->$propertyName);
5135 trigger_error(
'Property $TSFE->loginUser is not in use anymore as this information is now stored within the frontend.user aspect.', E_USER_DEPRECATED);
5136 return isset($this->$propertyName);
5138 trigger_error(
'Property $TSFE->gr_list is not in use anymore as this information is now stored within the frontend.user aspect.', E_USER_DEPRECATED);
5139 return isset($this->$propertyName);
5141 trigger_error(
'Property $TSFE->beUserLogin is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5142 return isset($this->$propertyName);
5143 case 'showHiddenPage':
5144 trigger_error(
'Property $TSFE->showHiddenPage is not in use anymore as this information is now stored within the visibility aspect.', E_USER_DEPRECATED);
5145 return isset($this->$propertyName);
5146 case 'showHiddenRecords':
5147 trigger_error(
'Property $TSFE->showHiddenRecords is not in use anymore as this information is now stored within the visibility aspect.', E_USER_DEPRECATED);
5148 return isset($this->$propertyName);
5149 case 'ADMCMD_preview_BEUSER_uid':
5150 trigger_error(
'Property $TSFE->ADMCMD_preview_BEUSER_uid is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5151 return isset($this->$propertyName);
5152 case 'workspacePreview':
5153 trigger_error(
'Property $TSFE->workspacePreview is not in use anymore as this information is now stored within the workspace aspect.', E_USER_DEPRECATED);
5154 return isset($this->$propertyName);
5155 case 'loginAllowedInBranch':
5156 trigger_error(
'Property $TSFE->loginAllowedInBranch is marked as protected now as it only contains internal state. Use checkIfLoginAllowedInBranch() instead.', E_USER_DEPRECATED);
5157 return isset($this->$propertyName);
5159 case 'loginAllowedInBranch_mode':
5160 case 'cacheTimeOutDefault':
5161 case 'cacheContentFlag':
5162 case 'cacheExpires':
5163 case 'isClientCachable':
5164 case 'no_cacheBeforePageGen':
5166 case 'pagesTSconfig':
5167 case 'pageCacheTags':
5168 case 'uniqueCounter':
5169 case 'uniqueString':
5173 case 'pageAccessFailureHistory':
5174 trigger_error(
'Property $TSFE->' . $propertyName .
' is marked as protected now as it only contains internal state.', E_USER_DEPRECATED);
5175 return isset($this->$propertyName);
5189 public function __get(
string $propertyName)
5191 switch ($propertyName) {
5192 case 'sys_language_uid':
5193 trigger_error(
'Property $TSFE->sys_language_uid is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5194 return $this->context->getPropertyFromAspect(
'language',
'id', 0);
5195 case 'sys_language_content':
5196 trigger_error(
'Property $TSFE->sys_language_content is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5197 return $this->context->getPropertyFromAspect(
'language',
'contentId', 0);
5198 case 'sys_language_contentOL':
5199 trigger_error(
'Property $TSFE->sys_language_contentOL is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5200 return $this->context->getPropertyFromAspect(
'language',
'legacyOverlayType',
'0');
5201 case 'sys_language_mode':
5202 trigger_error(
'Property $TSFE->sys_language_mode is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5203 return $this->context->getPropertyFromAspect(
'language',
'legacyLanguageMode',
'');
5205 trigger_error(
'Property $TSFE->loginUser is not in use anymore as this information is now stored within the frontend.user aspect.', E_USER_DEPRECATED);
5206 return $this->context->getPropertyFromAspect(
'frontend.user',
'isLoggedIn',
false);
5208 trigger_error(
'Property $TSFE->gr_list is not in use anymore as this information is now stored within the frontend.user aspect.', E_USER_DEPRECATED);
5209 return implode(
',', $this->context->getPropertyFromAspect(
'frontend.user',
'groupIds', [0, -1]));
5211 trigger_error(
'Property $TSFE->beUserLogin is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5212 return $this->context->getPropertyFromAspect(
'backend.user',
'isLoggedIn',
false);
5213 case 'showHiddenPage':
5214 trigger_error(
'Property $TSFE->showHiddenPage is not in use anymore as this information is now stored within the visibility aspect.', E_USER_DEPRECATED);
5215 return $this->context->getPropertyFromAspect(
'visibility',
'includeHiddenPages',
false);
5216 case 'showHiddenRecords':
5217 trigger_error(
'Property $TSFE->showHiddenRecords is not in use anymore as this information is now stored within the visibility aspect.', E_USER_DEPRECATED);
5218 return $this->context->getPropertyFromAspect(
'visibility',
'includeHiddenContent',
false);
5219 case 'ADMCMD_preview_BEUSER_uid':
5220 trigger_error(
'Property $TSFE->ADMCMD_preview_BEUSER_uid is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5221 return $this->context->getPropertyFromAspect(
'backend.user',
'id', 0);
5222 case 'workspacePreview':
5223 trigger_error(
'Property $TSFE->workspacePreview is not in use anymore as this information is now stored within the workspace aspect.', E_USER_DEPRECATED);
5224 return $this->context->getPropertyFromAspect(
'workspace',
'id', 0);
5225 case 'loginAllowedInBranch':
5226 trigger_error(
'Property $TSFE->loginAllowedInBranch is marked as protected now as it only contains internal state. Use checkIfLoginAllowedInBranch() instead.', E_USER_DEPRECATED);
5229 case 'loginAllowedInBranch_mode':
5230 case 'cacheTimeOutDefault':
5231 case 'cacheContentFlag':
5232 case 'cacheExpires':
5233 case 'isClientCachable':
5234 case 'no_cacheBeforePageGen':
5236 case 'pagesTSconfig':
5237 case 'pageCacheTags':
5238 case 'uniqueCounter':
5239 case 'uniqueString':
5243 case 'pageAccessFailureHistory':
5244 trigger_error(
'Property $TSFE->' . $propertyName .
' is marked as protected now as it only contains internal state.', E_USER_DEPRECATED);
5247 return $this->$propertyName;
5261 public function __set(
string $propertyName, $propertyValue)
5263 switch ($propertyName) {
5264 case 'sys_language_uid':
5265 trigger_error(
'Property $TSFE->sys_language_uid is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5267 $aspect = $this->context->getAspect(
'language');
5268 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, (
int)$propertyValue, $aspect->getContentId(), $aspect->getOverlayType(), $aspect->getFallbackChain()));
5270 case 'sys_language_content':
5271 trigger_error(
'Property $TSFE->sys_language_content is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5273 $aspect = $this->context->getAspect(
'language');
5274 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, $aspect->getId(), (
int)$propertyValue, $aspect->getOverlayType(), $aspect->getFallbackChain()));
5276 case 'sys_language_contentOL':
5277 trigger_error(
'Property $TSFE->sys_language_contentOL is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5279 $aspect = $this->context->getAspect(
'language');
5280 switch ((
string)$propertyValue) {
5281 case 'hideNonTranslated':
5290 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, $aspect->getId(), $aspect->getContentId(), $overlayType, $aspect->getFallbackChain()));
5292 case 'sys_language_mode':
5293 trigger_error(
'Property $TSFE->sys_language_mode is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5295 $aspect = $this->context->getAspect(
'language');
5296 switch ((
string)$propertyValue) {
5298 $fallBackOrder = [];
5302 $fallBackOrder = [-1];
5305 case 'content_fallback':
5306 if (!empty($propertyValue)) {
5307 $fallBackOrder = GeneralUtility::trimExplode(
',', $propertyValue);
5309 if (!in_array(0, $fallBackOrder) && !in_array(
'pageNotFound', $fallBackOrder)) {
5310 $fallBackOrder[] =
'pageNotFound';
5313 $fallBackOrder = [0];
5317 $fallBackOrder = [
'off'];
5320 $fallBackOrder = [0];
5322 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, $aspect->getId(), $aspect->getContentId(), $aspect->getOverlayType(), $fallBackOrder));
5325 trigger_error(
'Property $TSFE->loginUser is not in use anymore as this information is now stored within the frontend.user aspect.', E_USER_DEPRECATED);
5327 $aspect = $this->context->getAspect(
'frontend.user');
5328 if ($propertyValue) {
5329 $aspect = GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?:
null, $aspect->getGroupIds());
5331 $aspect = GeneralUtility::makeInstance(UserAspect::class,
null, $aspect->getGroupIds());
5333 $this->context->setAspect(
'frontend.user', $aspect);
5336 trigger_error(
'Property $TSFE->gr_list is not in use anymore as this information is now stored within the frontend.user aspect.', E_USER_DEPRECATED);
5337 $this->context->setAspect(
'frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?:
null, GeneralUtility::intExplode(
',', $propertyValue)));
5340 trigger_error(
'Property $TSFE->beUserLogin is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5341 if ($propertyValue) {
5342 $aspect = GeneralUtility::makeInstance(UserAspect::class,
$GLOBALS[
'BE_USER']);
5344 $aspect = GeneralUtility::makeInstance(UserAspect::class);
5346 $this->context->setAspect(
'backend.user', $aspect);
5348 case 'showHiddenPage':
5349 case 'showHiddenRecords':
5350 trigger_error(
'Property $TSFE->' . $propertyName .
' is not in use anymore as this information is now stored within the visibility aspect.', E_USER_DEPRECATED);
5352 $aspect = $this->context->getAspect(
'visibility');
5353 if ($propertyName ===
'showHiddenPage') {
5354 $newAspect = GeneralUtility::makeInstance(VisibilityAspect::class, (
bool)$propertyValue, $aspect->includeHiddenContent(), $aspect->includeDeletedRecords());
5356 $newAspect = GeneralUtility::makeInstance(VisibilityAspect::class, $aspect->includeHiddenPages(), (
bool)$propertyValue, $aspect->includeDeletedRecords());
5358 $this->context->setAspect(
'visibility', $newAspect);
5360 case 'ADMCMD_preview_BEUSER_uid':
5361 trigger_error(
'Property $TSFE->ADMCMD_preview_BEUSER_uid is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5364 case 'workspacePreview':
5365 trigger_error(
'Property $TSFE->workspacePreview is not in use anymore as this information is now stored within the workspace aspect.', E_USER_DEPRECATED);
5366 $this->context->setAspect(
'workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, (
int)$propertyValue));
5368 case 'loginAllowedInBranch':
5369 trigger_error(
'Property $TSFE->loginAllowedInBranch is marked as protected now as it only contains internal state. Use checkIfLoginAllowedInBranch() instead.', E_USER_DEPRECATED);
5372 case 'loginAllowedInBranch_mode':
5373 case 'cacheTimeOutDefault':
5374 case 'cacheContentFlag':
5375 case 'cacheExpires':
5376 case 'isClientCachable':
5377 case 'no_cacheBeforePageGen':
5379 case 'pagesTSconfig':
5380 case 'pageCacheTags':
5381 case 'uniqueCounter':
5382 case 'uniqueString':
5386 case 'pageAccessFailureHistory':
5387 trigger_error(
'Property $TSFE->' . $propertyName .
' is marked as protected now as it only contains internal state.', E_USER_DEPRECATED);
5390 $this->$propertyName = $propertyValue;
5398 public function __unset(
string $propertyName)
5400 switch ($propertyName) {
5401 case 'sys_language_uid':
5402 trigger_error(
'Property $TSFE->sys_language_uid is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5403 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class));
5405 case 'sys_language_content':
5406 trigger_error(
'Property $TSFE->sys_language_content is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5408 $aspect = $this->context->getAspect(
'language');
5409 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, $aspect->getId(), 0, $aspect->getOverlayType()));
5411 case 'sys_language_contentOL':
5412 trigger_error(
'Property $TSFE->sys_language_contentOL is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5414 $aspect = $this->context->getAspect(
'language');
5415 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, $aspect->getId(), $aspect->getContentId(),
LanguageAspect::OVERLAYS_OFF));
5417 case 'sys_language_mode':
5418 trigger_error(
'Property $TSFE->sys_language_mode is not in use anymore as this information is now stored within the language aspect.', E_USER_DEPRECATED);
5420 $aspect = $this->context->getAspect(
'language');
5421 $this->context->setAspect(
'language', GeneralUtility::makeInstance(LanguageAspect::class, $aspect->getId(), $aspect->getContentId(), $aspect->getOverlayType(), [
'off']));
5425 $aspect = $this->context->getAspect(
'frontend.user');
5426 $this->context->setAspect(
'frontend.user', GeneralUtility::makeInstance(UserAspect::class,
null, $aspect->getGroupIds()));
5429 trigger_error(
'Property $TSFE->gr_list is not in use anymore as this information is now stored within the frontend.user aspect.', E_USER_DEPRECATED);
5430 $this->context->setAspect(
'frontend.user', GeneralUtility::makeInstance(UserAspect::class, $this->fe_user ?:
null, []));
5433 trigger_error(
'Property $TSFE->beUserLogin is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5434 $this->context->setAspect(
'backend.user', GeneralUtility::makeInstance(UserAspect::class));
5436 case 'showHiddenPage':
5437 case 'showHiddenRecords':
5438 trigger_error(
'Property $TSFE->' . $propertyName .
' is not in use anymore as this information is now stored within the visibility aspect.', E_USER_DEPRECATED);
5440 $aspect = $this->context->getAspect(
'visibility');
5441 if ($propertyName ===
'showHiddenPage') {
5442 $newAspect = GeneralUtility::makeInstance(VisibilityAspect::class,
false, $aspect->includeHiddenContent(), $aspect->includeDeletedRecords());
5444 $newAspect = GeneralUtility::makeInstance(VisibilityAspect::class, $aspect->includeHiddenPages(),
false, $aspect->includeDeletedRecords());
5446 $this->context->setAspect(
'visibility', $newAspect);
5448 case 'ADMCMD_preview_BEUSER_uid':
5449 trigger_error(
'Property $TSFE->ADMCMD_preview_BEUSER_uid is not in use anymore as this information is now stored within the backend.user aspect.', E_USER_DEPRECATED);
5452 case 'workspacePreview':
5453 trigger_error(
'Property $TSFE->workspacePreview is not in use anymore as this information is now stored within the workspace aspect.', E_USER_DEPRECATED);
5454 $this->context->setAspect(
'workspace', GeneralUtility::makeInstance(WorkspaceAspect::class, 0));
5456 case 'loginAllowedInBranch':
5457 trigger_error(
'Property $TSFE->loginAllowedInBranch is marked as protected now as it only contains internal state. Use checkIfLoginAllowedInBranch() instead.', E_USER_DEPRECATED);
5460 case 'loginAllowedInBranch_mode':
5461 case 'cacheTimeOutDefault':
5462 case 'cacheContentFlag':
5463 case 'cacheExpires':
5464 case 'isClientCachable':
5465 case 'no_cacheBeforePageGen':
5467 case 'pagesTSconfig':
5468 case 'uniqueCounter':
5469 case 'uniqueString':
5473 case 'pageAccessFailureHistory':
5474 trigger_error(
'Property $TSFE->' . $propertyName .
' is marked as protected now as it only contains internal state.', E_USER_DEPRECATED);
5477 unset($this->$propertyName);