diff --git a/typo3/mod.php b/typo3/mod.php index f17d8cccb892ccfca5bfae65973cbed20bf23300..6e09e2802ad6d4057d82b281ad883e6303e63f5e 100644 --- a/typo3/mod.php +++ b/typo3/mod.php @@ -27,7 +27,6 @@ if (!$formProtection->validateToken(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP( throw new UnexpectedValueException('Invalid form/module token detected. Access Denied!', 1392409507); } if ($temp_path = $GLOBALS['TBE_MODULES']['_PATHS'][$moduleName]) { - $GLOBALS['MCONF']['_'] = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl($moduleName); if (file_exists($temp_path . 'conf.php')) { require $temp_path . 'conf.php'; $moduleConfiguration = $GLOBALS['MCONF']; diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-65432-ModulUriInGlobalVarRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-65432-ModulUriInGlobalVarRemoved.rst new file mode 100644 index 0000000000000000000000000000000000000000..0ec882f3632072685137311fa9cca87d66af4e97 --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-65432-ModulUriInGlobalVarRemoved.rst @@ -0,0 +1,30 @@ +============================================================================ +Breaking: #65432 - Storage of module URI in global variable has been removed +============================================================================ + +Description +=========== + +Previously the URI to a module which was dispatched through mod.php was stored +in a global variable ``$GLOBALS['MCONF']['_']``. + +In terms of cleanup of global variable usage and module configuration cleanup and streamlining, +this functionality has been removed without substitution. + + +Impact +====== + +Any backend module code which accesses ``$GLOBALS['MCONF']['_']`` to get the module URI will not function any more. + + +Affected installations +====================== + +TYPO3 CMS 7 installations using extensions with backend modules which use ``$GLOBALS['MCONF']['_']``. + + +Migration +========= + +Extension code needs to be changed in a way that the API ``BackendUtility::getModuleUrl('module_name')`` is used instead of accessing ``$GLOBALS['MCONF']['_']``. diff --git a/typo3/sysext/impexp/Classes/Controller/ImportExportController.php b/typo3/sysext/impexp/Classes/Controller/ImportExportController.php index 982f8dcbf08d2b487e18e681a6b0a92378106a77..f213487e68c815416dfa465d3c717b838add7c0c 100644 --- a/typo3/sysext/impexp/Classes/Controller/ImportExportController.php +++ b/typo3/sysext/impexp/Classes/Controller/ImportExportController.php @@ -99,7 +99,7 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass { // Setting up the context sensitive menu: $this->doc->getContextMenuCode(); $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';'); - $this->doc->form = '<form action="' . htmlspecialchars($GLOBALS['MCONF']['_']) . '" method="post" enctype="' + $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('xMOD_tximpexp')) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"><input type="hidden" name="id" value="' . $this->id . '" />'; $this->content .= $this->doc->header($this->lang->getLL('title')); $this->content .= $this->doc->spacer(5); diff --git a/typo3/sysext/openid/Classes/Wizard.php b/typo3/sysext/openid/Classes/Wizard.php index 120200f9edc36cfc2202cae1e5cd411b9511172f..d1af9798086974bb1cccbba4af640f4398a6d01c 100644 --- a/typo3/sysext/openid/Classes/Wizard.php +++ b/typo3/sysext/openid/Classes/Wizard.php @@ -14,6 +14,7 @@ namespace TYPO3\CMS\Openid; * The TYPO3 project - inspiring people to share! */ +use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Messaging\FlashMessage; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -96,8 +97,9 @@ class Wizard extends OpenidService { * @return string Full URL with protocol and hostname */ protected function getSelfUrl() { - return GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . TYPO3_mainDir . - $GLOBALS['MCONF']['_']; + return GeneralUtility::getIndpEnv('TYPO3_SITE_URL') + . TYPO3_mainDir + . BackendUtility::getModuleUrl('wizard_openid'); } /** diff --git a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php index c8ad306b806302efb77868eaaa94d36ec9a81b98..7d8744d66879019d765852d2593f2918100a11a1 100644 --- a/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php +++ b/typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php @@ -89,6 +89,11 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas */ protected $moduleName = 'system_txschedulerM1'; + /** + * @var string Base URI of scheduler module + */ + protected $moduleUri; + /** * @return \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController */ @@ -102,6 +107,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas $this->backendTemplatePath = ExtensionManagementUtility::extPath('scheduler') . 'Resources/Private/Templates/Backend/SchedulerModule/'; $this->view = GeneralUtility::makeInstance(\TYPO3\CMS\Fluid\View\StandaloneView::class); $this->view->getRequest()->setControllerExtensionName('scheduler'); + $this->moduleUri = BackendUtility::getModuleUrl($this->moduleName); } /** @@ -386,7 +392,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas // Check CLI user $checkUser = $this->checkSchedulerUser(); if ($checkUser == -1) { - $link = $GLOBALS['MCONF']['_'] . '&SET[function]=check&CMD=user'; + $link = $this->moduleUri . '&SET[function]=check&CMD=user'; $message = sprintf($this->getLanguageService()->getLL('msg.schedulerUserMissing'), htmlspecialchars($link)); $severity = FlashMessage::ERROR; } elseif ($checkUser == 0) { @@ -932,7 +938,7 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas foreach ($taskGroup['tasks'] as $schedulerRecord) {// Define action icons - $editAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:edit', TRUE) . '" class="icon">' . + $editAction = '<a href="' . htmlspecialchars($this->moduleUri . '&CMD=edit&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:edit', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-document-open') . '</a>'; if ((int)$schedulerRecord['disable'] === 1) { $translationKey = 'enable'; @@ -941,13 +947,13 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas $translationKey = 'disable'; $spriteIcon = 'actions-edit-hide'; } - $toggleHiddenAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=toggleHidden&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:' . $translationKey, TRUE) . '" class="icon">' . + $toggleHiddenAction = '<a href="' . htmlspecialchars($this->moduleUri . '&CMD=toggleHidden&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:' . $translationKey, TRUE) . '" class="icon">' . IconUtility::getSpriteIcon($spriteIcon) . '</a>'; - $deleteAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $this->getLanguageService()->getLL('msg.delete') . '\');" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '" class="icon">' . + $deleteAction = '<a href="' . htmlspecialchars($this->moduleUri . '&CMD=delete&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" onclick="return confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('msg.delete')) . ');" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:delete', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('actions-edit-delete') . '</a>'; - $stopAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid'] . '" onclick="return confirm(\'' . $this->getLanguageService()->getLL('msg.stop') . '\');" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop', TRUE) . '" class="icon">' . + $stopAction = '<a href="' . htmlspecialchars($this->moduleUri . '&CMD=stop&tx_scheduler[uid]=' . $schedulerRecord['uid']) . '" onclick="return confirm(' . GeneralUtility::quoteJSvalue($this->getLanguageService()->getLL('msg.stop')) . ');" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop', TRUE) . '" class="icon">' . '<img ' . IconUtility::skinImg($this->backPath, (ExtensionManagementUtility::extRelPath('scheduler') . '/Resources/Public/Images/stop.png')) . ' alt="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:stop') . '" /></a>'; - $runAction = '<a href="' . $GLOBALS['MCONF']['_'] . '&tx_scheduler[execute][]=' . $schedulerRecord['uid'] . '" title="' . $this->getLanguageService()->getLL('action.run_task') . '" class="icon">' . + $runAction = '<a href="' . htmlspecialchars($this->moduleUri . '&tx_scheduler[execute][]=' . $schedulerRecord['uid']) . '" title="' . $this->getLanguageService()->getLL('action.run_task', TRUE) . '" class="icon">' . IconUtility::getSpriteIcon('extensions-scheduler-run-task') . '</a>'; // Define some default values @@ -1454,15 +1460,15 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas 'shortcut' => $this->getShortcutButton() ); if (empty($this->CMD) || $this->CMD === 'list' || $this->CMD === 'delete' || $this->CMD === 'stop' || $this->CMD === 'toggleHidden') { - $buttons['reload'] = '<a href="' . $GLOBALS['MCONF']['_'] . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>'; + $buttons['reload'] = '<a href="' . htmlspecialchars($this->moduleUri) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.reload', TRUE) . '">' . IconUtility::getSpriteIcon('actions-system-refresh') . '</a>'; if ($this->MOD_SETTINGS['function'] === 'scheduler' && count($this->getRegisteredClasses())) { - $link = $GLOBALS['MCONF']['_'] . '&CMD=add'; + $link = $this->moduleUri . '&CMD=add'; $image = IconUtility::getSpriteIcon('actions-document-new', array('alt' => $this->getLanguageService()->getLL('action.add'))); $buttons['addtask'] = '<a href="' . htmlspecialchars($link) . '" ' . 'title="' . $this->getLanguageService()->getLL('action.add') . '">' . $image . '</a>'; } } if ($this->CMD === 'add' || $this->CMD === 'edit') { - $buttons['close'] = '<a href="#" onclick="document.location=\'' . $GLOBALS['MCONF']['_'] . '\'" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>'; + $buttons['close'] = '<a href="#" onclick="document.location=' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->moduleUri)) . '" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:cancel', TRUE) . '">' . IconUtility::getSpriteIcon('actions-document-close') . '</a>'; $buttons['save'] = '<button style="padding: 0; margin: 0; cursor: pointer;" type="submit" name="CMD" value="save" class="c-inputButton" src="clear.gif" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:save', TRUE) . '" />' . IconUtility::getSpriteIcon('actions-document-save') . '</button>'; $buttons['saveclose'] = '<button style="padding: 0; margin: 0; cursor: pointer;" type="submit" name="CMD" value="saveclose" class="c-inputButton" src="clear.gif" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:saveAndClose', TRUE) . '" />' . IconUtility::getSpriteIcon('actions-document-save-close') . '</button>'; $buttons['savenew'] = '<button style="padding: 0; margin: 0; cursor: pointer;" type="submit" name="CMD" value="savenew" class="c-inputButton" src="clear.gif" title="' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_common.xlf:saveAndCreateNewDoc', TRUE) . '" />' . IconUtility::getSpriteIcon('actions-document-save-new') . '</button>'; diff --git a/typo3/sysext/scheduler/Classes/ViewHelpers/ModuleLinkViewHelper.php b/typo3/sysext/scheduler/Classes/ViewHelpers/ModuleLinkViewHelper.php index d5458be2cba7e95f48adbcb09fb269934ca6b549..187937f1cf2bdfe21ee1166140fc3352d5f7b3e9 100644 --- a/typo3/sysext/scheduler/Classes/ViewHelpers/ModuleLinkViewHelper.php +++ b/typo3/sysext/scheduler/Classes/ViewHelpers/ModuleLinkViewHelper.php @@ -14,31 +14,54 @@ namespace TYPO3\CMS\Scheduler\ViewHelpers; * The TYPO3 project - inspiring people to share! */ +use TYPO3\CMS\Backend\Utility\BackendUtility; +use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper; + /** - * Create internal link within backend app - * @TODO: Later I want to be an AbstractTagBasedViewHelper + * Create internal link tag within backend app * @internal */ -class ModuleLinkViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper { +class ModuleLinkViewHelper extends AbstractTagBasedViewHelper { /** - * Generate module link + * @var string + */ + protected $tagName = 'a'; + + /** + * Arguments initialization * - * @param string $function - * @param string $cms - * @param array $arguments - * @return string + * @return void */ - public function render($function = '', $cmd = '', array $arguments = array()) { - $link = $GLOBALS['MCONF']['_'] . '&SET[function]=' . $function . '&CMD=' . $cmd; + public function initializeArguments() { + $this->registerUniversalTagAttributes(); + $this->registerTagAttribute('name', 'string', 'Specifies the name of an anchor'); + $this->registerTagAttribute('rel', 'string', 'Specifies the relationship between the current document and the linked document'); + $this->registerTagAttribute('rev', 'string', 'Specifies the relationship between the linked document and the current document'); + $this->registerTagAttribute('target', 'string', 'Specifies where to open the linked document'); + } + /** + * Render module link with command and arguments + * + * @param string $controller The "controller" of scheduler. Possible values are "scheduler", "check", "info" + * @param string $action The action to be called within each controller + * @param array $arguments Arguments for the action + * @return string + */ + public function render($controller, $action, array $arguments = array()) { + $moduleArguments = array(); + $moduleArguments['SET']['function'] = $controller; + $moduleArguments['CMD'] = $action; if (!empty($arguments)) { - foreach ($arguments as $key => $value) { - $link .= '&tx_scheduler[' . $key . ']=' . $value; - } + $moduleArguments['tx_scheduler'] = $arguments; } - return htmlspecialchars($link); + $uri = BackendUtility::getModuleUrl('system_txschedulerM1', $moduleArguments); + $this->tag->addAttribute('href', $uri); + $this->tag->setContent($this->renderChildren()); + $this->tag->forceClosingTag(TRUE); + return $this->tag->render(); } } \ No newline at end of file diff --git a/typo3/sysext/scheduler/Resources/Private/Templates/Backend/SchedulerModule/InfoScreen.html b/typo3/sysext/scheduler/Resources/Private/Templates/Backend/SchedulerModule/InfoScreen.html index 780c16f9f9c8ab4a97dc7228ea60a43ec99814e9..865a26fa58753e721db3ae118765553a34e427f1 100644 --- a/typo3/sysext/scheduler/Resources/Private/Templates/Backend/SchedulerModule/InfoScreen.html +++ b/typo3/sysext/scheduler/Resources/Private/Templates/Backend/SchedulerModule/InfoScreen.html @@ -26,12 +26,14 @@ <td>{classInfo.description}</td> <td> <div class="btn-group" role="group"> - <a - href="{s:moduleLink(function:'list',cmd:'add',arguments:'{class: class}')}" + <s:moduleLink + controller="scheduler" + action="add" arguments="{class: class}" title="{f:translate(key:'LLL:EXT:lang/locallang_common.xlf:new')}" - class="btn btn-default"> - <s:spriteIcon iconName="actions-document-new" /> - </a> + class="btn btn-default" + > + <s:spriteIcon iconName="actions-document-new" /> + </s:moduleLink> </div> </td> </tr>