‪TYPO3CMS  ‪main
Application.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use Psr\Http\Message\ResponseInterface;
21 use Psr\Http\Message\ServerRequestInterface;
22 use Psr\Http\Server\RequestHandlerInterface;
28 
33 {
34  public function ‪__construct(
35  RequestHandlerInterface ‪$requestHandler,
36  protected readonly ‪Context $context,
37  ) {
38  $this->requestHandler = ‪$requestHandler;
39  }
40 
41  public function ‪handle(ServerRequestInterface $request): ResponseInterface
42  {
43  $request = $request->withAttribute('applicationType', ‪SystemEnvironmentBuilder::REQUESTTYPE_BE);
44 
45  if (isset(‪$_SERVER['TYPO3_DEPRECATED_ENTRYPOINT'])) {
46  trigger_error('/typo3/index.php entrypoint is deprecated and will be removed in TYPO3 v14. Adapt your webserver config to route all requests via /index.php', E_USER_DEPRECATED);
47  }
48 
49  // Set up the initial context
50  $this->‪initializeContext();
51  return parent::handle($request);
52  }
53 
57  protected function ‪initializeContext(): void
58  {
59  $this->context->setAspect('date', new ‪DateTimeAspect(new \DateTimeImmutable('@' . ‪$GLOBALS['EXEC_TIME'])));
60  $this->context->setAspect('visibility', new ‪VisibilityAspect(true, true));
61  }
62 }
‪TYPO3\CMS\Backend\Http\Application\handle
‪handle(ServerRequestInterface $request)
Definition: Application.php:41
‪TYPO3\CMS\Core\Context\VisibilityAspect
Definition: VisibilityAspect.php:31
‪TYPO3\CMS\Backend\Http\Application
Definition: Application.php:33
‪TYPO3\CMS\Backend\Http
Definition: Application.php:18
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder
Definition: SystemEnvironmentBuilder.php:41
‪TYPO3\CMS\Core\Core\SystemEnvironmentBuilder\REQUESTTYPE_BE
‪const REQUESTTYPE_BE
Definition: SystemEnvironmentBuilder.php:45
‪TYPO3\CMS\Core\Context\Context
Definition: Context.php:54
‪TYPO3\CMS\Core\Http\AbstractApplication
Definition: AbstractApplication.php:29
‪$_SERVER
‪$_SERVER['TYPO3_DEPRECATED_ENTRYPOINT']
Definition: legacy-backend.php:20
‪TYPO3\CMS\Core\Http\AbstractApplication\$requestHandler
‪RequestHandlerInterface null $requestHandler
Definition: AbstractApplication.php:36
‪TYPO3\CMS\Backend\Http\Application\initializeContext
‪initializeContext()
Definition: Application.php:57
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Backend\Http\Application\__construct
‪__construct(RequestHandlerInterface $requestHandler, protected readonly Context $context,)
Definition: Application.php:34
‪TYPO3\CMS\Core\Context\DateTimeAspect
Definition: DateTimeAspect.php:35