handle($request); } /** * This request handler can handle any frontend request. * * @param ServerRequestInterface $request The request to process * @return bool If the request is not an eID request, TRUE otherwise FALSE */ public function canHandleRequest(ServerRequestInterface $request): bool { trigger_error(self::class . ' will be removed in TYPO3 v10.0. Use ' . EidMiddleware::class . ' instead.', E_USER_DEPRECATED); return !empty($request->getQueryParams()['eID']) || !empty($request->getParsedBody()['eID']); } /** * Returns the priority - how eager the handler is to actually handle the * request. * * @return int The priority of the request handler. */ public function getPriority(): int { trigger_error(self::class . ' will be removed in TYPO3 v10.0. Use ' . EidMiddleware::class . ' instead.', E_USER_DEPRECATED); return 80; } /** * Dispatches the request to the corresponding eID class or eID script * * @param ServerRequestInterface $request * @return ResponseInterface * @throws Exception */ public function handle(ServerRequestInterface $request): ResponseInterface { trigger_error(self::class . ' will be removed in TYPO3 v10.0. Use ' . EidMiddleware::class . ' instead.', E_USER_DEPRECATED); // Remove any output produced until now ob_clean(); /** @var Response $response */ $response = GeneralUtility::makeInstance(Response::class); $eID = $request->getParsedBody()['eID'] ?? $request->getQueryParams()['eID'] ?? ''; if (empty($eID) || !isset($GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include'][$eID])) { return $response->withStatus(404, 'eID not registered'); } $configuration = $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include'][$eID]; // Simple check to make sure that it's not an absolute file (to use the fallback) if (strpos($configuration, '::') !== false || is_callable($configuration)) { /** @var Dispatcher $dispatcher */ $dispatcher = GeneralUtility::makeInstance(Dispatcher::class); $request = $request->withAttribute('target', $configuration); return $dispatcher->dispatch($request, $response); } $scriptPath = GeneralUtility::getFileAbsFileName($configuration); if ($scriptPath === '') { throw new Exception('Registered eID has invalid script path.', 1416391467); } include $scriptPath; return new NullResponse(); } }