[TASK] Removes beuser/SectionViewHelper
[Packages/TYPO3.CMS.git] / typo3 / sysext / beuser / Classes / ViewHelpers / IssueCommandViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Beuser\ViewHelpers;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Backend\Utility\BackendUtility;
18 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
19 use TYPO3\CMS\Core\Utility\GeneralUtility;
20 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
21
22 /**
23 * Issue command ViewHelper, see TYPO3 Core Engine method issueCommand
24 *
25 * @author Felix Kopp <felix-source@phorax.com>
26 * @internal
27 */
28 class IssueCommandViewHelper extends AbstractViewHelper {
29
30 /**
31 * Returns a URL with a command to TYPO3 Core Engine (tce_db.php)
32 *
33 * @param string $parameters Is a set of GET params to send to tce_db.php. Example: "&cmd[tt_content][123][move]=456" or "&data[tt_content][123][hidden]=1&data[tt_content][123][title]=Hello%20World
34 * @param string $redirectUrl Redirect URL if any other that \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('REQUEST_URI') is wished
35 *
36 * @return string URL to tce_db.php + parameters
37 * @see \TYPO3\CMS\Backend\Utility\BackendUtility::editOnClick()
38 * @see \TYPO3\CMS\Backend\Template\DocumentTemplate::issueCommand()
39 */
40 public function render($parameters, $redirectUrl = '') {
41 /** @var BackendUserAuthentication $beUser */
42 $beUser = $GLOBALS['BE_USER'];
43 $urlParameters = [
44 'vC' => $beUser->veriCode(),
45 'prErr' => 1,
46 'uPT' => 1,
47 'redirect' => $redirectUrl ?: GeneralUtility::getIndpEnv('REQUEST_URI')
48 ];
49 return htmlspecialchars(BackendUtility::getModuleUrl('tce_db', $urlParameters) . $parameters . BackendUtility::getUrlToken('tceAction'));
50 }
51
52 }