get(OtWebsiteRepository::class); $devMode = $_SERVER['TYPO3_CONTEXT'] == "Development"; if (!$GLOBALS['TYPO3_REQUEST']) { return GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction( $request, 'The requested website does not exist', ['code' => PageAccessFailureReasons::PAGE_NOT_FOUND] ); } $website = $GLOBALS['TYPO3_REQUEST']->getAttribute('ot_website'); $params = $request->getQueryParams(); if (!$website['uid'] > 0) { return GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction( $request, 'The requested website does not exist', ['code' => PageAccessFailureReasons::PAGE_NOT_FOUND] ); } // if the page is requested from the BE module Viewpage, it shall be displayed even if hidden // a backend user shall be authenticated for this $requestedFromViewPage = preg_match( "/.+\/typo3\/index.php\?route=.*Viewpage.*/", $_SERVER['HTTP_REFERER'] ) && $GLOBALS['BE_USER']; $pageUid = $otWebsiteRepository->matchUriToPage($website, $request->getUri(), $devMode, !$requestedFromViewPage); if (!$pageUid > 0) { return GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction( $request, 'The requested page does not exist', ['code' => PageAccessFailureReasons::PAGE_NOT_FOUND] ); } $params['id'] = $pageUid; $request = $request->withQueryParams($params); return parent::process($request, $handler); } }