‪TYPO3CMS  10.4
ServerRequestHandler.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\ServerRequestInterface;
24 
29 {
33  protected ‪$redirectUrlValidator;
34 
38  protected ‪$request;
39 
40  public function ‪__construct()
41  {
42  // todo: refactor when extbase handles PSR-15 requests
43  $this->request = ‪$GLOBALS['TYPO3_REQUEST'];
44  $this->redirectUrlValidator = GeneralUtility::makeInstance(
45  RedirectUrlValidator::class,
46  GeneralUtility::makeInstance(SiteFinder::class)
47  );
48  }
49 
56  public function ‪getPropertyFromGetAndPost(string $propertyName)
57  {
58  return $this->request->getParsedBody()[$propertyName] ?? $this->request->getQueryParams(
59  )[$propertyName] ?? null;
60  }
61 
67  public function ‪getRedirectUrlRequestParam(): string
68  {
69  // If config.typolinkLinkAccessRestrictedPages is set, the var is return_url
70  $redirectUrl = (string)$this->‪getPropertyFromGetAndPost('return_url')
71  ?: (string)$this->‪getPropertyFromGetAndPost('redirect_url');
72 
73  return $this->redirectUrlValidator->isValid($redirectUrl) ? $redirectUrl : '';
74  }
75 }
‪TYPO3\CMS\FrontendLogin\Redirect\ServerRequestHandler\getRedirectUrlRequestParam
‪string getRedirectUrlRequestParam()
Definition: ServerRequestHandler.php:65
‪TYPO3\CMS\FrontendLogin\Redirect\ServerRequestHandler
Definition: ServerRequestHandler.php:29
‪TYPO3\CMS\Core\Site\SiteFinder
Definition: SiteFinder.php:31
‪TYPO3\CMS\FrontendLogin\Redirect\ServerRequestHandler\getPropertyFromGetAndPost
‪mixed null getPropertyFromGetAndPost(string $propertyName)
Definition: ServerRequestHandler.php:54
‪TYPO3\CMS\FrontendLogin\Redirect\ServerRequestHandler\$redirectUrlValidator
‪RedirectUrlValidator $redirectUrlValidator
Definition: ServerRequestHandler.php:32
‪TYPO3\CMS\FrontendLogin\Redirect
Definition: RedirectHandler.php:18
‪TYPO3\CMS\FrontendLogin\Redirect\ServerRequestHandler\__construct
‪__construct()
Definition: ServerRequestHandler.php:38
‪TYPO3\CMS\FrontendLogin\Redirect\ServerRequestHandler\$request
‪ServerRequestInterface $request
Definition: ServerRequestHandler.php:36
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\FrontendLogin\Validation\RedirectUrlValidator
Definition: RedirectUrlValidator.php:32
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46