Files
gutachten_t3/typo3/sysext/adminpanel/Classes/Middleware/AdminPanelDataPersister.php
T
2026-10-19 08:18:39 +02:00

59 lines
1.9 KiB
PHP

<?php
declare(strict_types = 1);
namespace TYPO3\CMS\Adminpanel\Middleware;
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use TYPO3\CMS\Adminpanel\Controller\MainController;
use TYPO3\CMS\Adminpanel\Utility\StateUtility;
use TYPO3\CMS\Core\Http\NullResponse;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
/**
* Store request data of current request in cache for rendering in admin panel
*
* @internal
*/
class AdminPanelDataPersister implements MiddlewareInterface
{
/**
* Render the admin panel if activated
* @param ServerRequestInterface $request
* @param RequestHandlerInterface $handler
* @return ResponseInterface
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
if (
!($response instanceof NullResponse)
&& $GLOBALS['TSFE'] instanceof TypoScriptFrontendController
&& $GLOBALS['TSFE']->isOutputting()
&& StateUtility::isActivatedForUser()
&& StateUtility::isActivatedInTypoScript()
&& !StateUtility::isHiddenForUser()
) {
$mainController = GeneralUtility::makeInstance(MainController::class);
$mainController->storeData($request);
}
return $response;
}
}