dispatcher = $dispatcher; } /** * Dispatches the request to the corresponding eID class or eID script * * @param ServerRequestInterface $request * @param RequestHandlerInterface $handler * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $eID = $request->getParsedBody()['eIDSR'] ?? $request->getQueryParams()['eIDSR'] ?? null; if ($eID === null) { return $handler->handle($request); } // Remove any output produced until now ob_clean(); /** @var Response $response */ $response = new Response(); if (empty($eID) || !isset($GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sr_freecap']['eIDSR_include'][$eID])) { $response = $response->withStatus(404, 'eIDSR not registered'); } else { $configuration = $GLOBALS['TYPO3_CONF_VARS']['EXTENSIONS']['sr_freecap']['eIDSR_include'][$eID]; $response = new NullResponse(); // Simple check to make sure that it's not an absolute file (to use the fallback) if (strpos($configuration, '::') !== false || is_callable($configuration)) { $frontendUser = $request->getAttribute('frontend.user'); $request = $request->withAttribute('target', $configuration); $response = $this->dispatcher->dispatch($request); } } return $response; } }