[TASK] Deprecate LoginFramesetController
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / LoginFramesetController.php
1 <?php
2 declare(strict_types = 1);
3 namespace TYPO3\CMS\Backend\Controller;
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
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
20 use TYPO3\CMS\Backend\Routing\UriBuilder;
21 use TYPO3\CMS\Backend\Template\DocumentTemplate;
22 use TYPO3\CMS\Core\Http\HtmlResponse;
23 use TYPO3\CMS\Core\Page\PageRenderer;
24 use TYPO3\CMS\Core\Utility\GeneralUtility;
25
26 /**
27 * Script Class, putting the frameset together.
28 * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0. All logic is moved into LoginController.
29 */
30 class LoginFramesetController
31 {
32 /**
33 * @var string
34 */
35 protected $content;
36
37 /**
38 * Constructor
39 */
40 public function __construct()
41 {
42 trigger_error(__CLASS__ . ' will be removed in TYPO3 v10.0. Request "index.php?loginRefresh=1" directly to work without the frameset.', E_USER_DEPRECATED);
43 $GLOBALS['SOBE'] = $this;
44 }
45
46 /**
47 * Injects the request object for the current request or subrequest
48 * As this controller goes only through the main() method, it is rather simple for now
49 *
50 * @param ServerRequestInterface $request
51 * @return ResponseInterface
52 */
53 public function mainAction(ServerRequestInterface $request): ResponseInterface
54 {
55 $this->createFrameset();
56 return new HtmlResponse($this->content);
57 }
58
59 /**
60 * Main function.
61 * Creates the header code and the frameset for the two frames.
62 */
63 public function main()
64 {
65 $this->createFrameset();
66 }
67 /**
68 * Main function.
69 * Creates the header code and the frameset for the two frames.
70 */
71 protected function createFrameset(): void
72 {
73 $title = 'TYPO3 Re-Login (' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ')';
74 $this->getDocumentTemplate()->startPage($title);
75 /** @var UriBuilder $uriBuilder */
76 $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
77 // Create the frameset for the window
78 $this->content = $this->getPageRenderer()->render(PageRenderer::PART_HEADER) . '
79 <frameset rows="*,1">
80 <frame name="login" src="index.php?loginRefresh=1" marginwidth="0" marginheight="0" scrolling="no" noresize="noresize" />
81 <frame name="dummy" src="' . htmlspecialchars((string)$uriBuilder->buildUriFromRoute('dummy')) . '" marginwidth="0" marginheight="0" scrolling="auto" noresize="noresize" />
82 </frameset>
83 </html>';
84 }
85
86 /**
87 * Returns an instance of DocumentTemplate
88 *
89 * @return DocumentTemplate
90 */
91 protected function getDocumentTemplate(): DocumentTemplate
92 {
93 return $GLOBALS['TBE_TEMPLATE'];
94 }
95
96 /**
97 * @return PageRenderer
98 */
99 protected function getPageRenderer(): PageRenderer
100 {
101 return GeneralUtility::makeInstance(PageRenderer::class);
102 }
103 }