[BUGFIX] Add values to submit buttons 64/42764/3
authorWouter Wolters <typo3@wouterwolters.nl>
Wed, 19 Aug 2015 17:25:57 +0000 (19:25 +0200)
committerBenjamin Kott <info@bk2k.info>
Thu, 20 Aug 2015 16:17:15 +0000 (18:17 +0200)
Submit buttons need to have a value set,
otherwise submit checks in the PHP code won't work.

Some useless POST checks are removed after the removal of the
type=image input fields for saving data.

Resolves: #69194
Releases: master
Change-Id: If42da73242d82d96d0042e0bedce69ad2a302427
Reviewed-on: http://review.typo3.org/42764
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Benjamin Kott <info@bk2k.info>
Tested-by: Benjamin Kott <info@bk2k.info>
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/compatibility6/Classes/Controller/Wizard/FormsController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateConstantEditorModuleFunctionController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php

index 8df723b..b80c8c6 100644 (file)
@@ -1131,7 +1131,7 @@ class EditDocumentController implements \TYPO3\CMS\Core\Http\ControllerInterface
                // The action of each button is decided by its name attribute. (See doProcessData())
                if (!$this->errorC && !$GLOBALS['TCA'][$this->firstEl['table']]['ctrl']['readOnly']) {
                        // SAVE button:
-                       $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="submit" name="_savedok" class="c-inputButton t3js-editform-submitButton" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
+                       $buttons['save'] = IconUtility::getSpriteIcon('actions-document-save', array('html' => '<input type="submit" name="_savedok" class="c-inputButton t3js-editform-submitButton" value="1" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE) . '" />'));
                        // SAVE / VIEW button:
                        if ($this->viewId && !$this->noView && $this->getNewIconMode($this->firstEl['table'], 'saveDocView')) {
                                $pagesTSconfig = BackendUtility::getPagesTSconfig($this->pageinfo['uid']);
@@ -1142,15 +1142,15 @@ class EditDocumentController implements \TYPO3\CMS\Core\Http\ControllerInterface
                                        $excludeDokTypes = array(PageRepository::DOKTYPE_RECYCLER, PageRepository::DOKTYPE_SYSFOLDER, PageRepository::DOKTYPE_SPACER);
                                }
                                if (!in_array((int)$this->pageinfo['doktype'], $excludeDokTypes, TRUE) || isset($pagesTSconfig['TCEMAIN.']['preview.'][$this->firstEl['table'].'.']['previewPageId'])) {
-                                       $buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="submit" class="c-inputButton t3js-editform-submitButton" name="_savedokview"  value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
+                                       $buttons['save_view'] = IconUtility::getSpriteIcon('actions-document-save-view', array('html' => '<input onclick="window.open(\'\', \'newTYPO3frontendWindow\');" type="submit" class="c-inputButton t3js-editform-submitButton" name="_savedokview" value="1" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDocShow', TRUE) . '" />'));
                                }
                        }
                        // SAVE / NEW button:
                        if (count($this->elementsData) === 1 && $this->getNewIconMode($this->firstEl['table'])) {
-                               $buttons['save_new'] = IconUtility::getSpriteIcon('actions-document-save-new', array('html' => '<input type="submit" class="c-inputButton t3js-editform-submitButton" name="_savedoknew" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc', TRUE) . '" />'));
+                               $buttons['save_new'] = IconUtility::getSpriteIcon('actions-document-save-new', array('html' => '<input type="submit" class="c-inputButton t3js-editform-submitButton" name="_savedoknew" value="1" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveNewDoc', TRUE) . '" />'));
                        }
                        // SAVE / CLOSE
-                       $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="submit" class="c-inputButton t3js-editform-submitButton" name="_saveandclosedok" value="" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
+                       $buttons['save_close'] = IconUtility::getSpriteIcon('actions-document-save-close', array('html' => '<input type="submit" class="c-inputButton t3js-editform-submitButton" name="_saveandclosedok" value="1" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE) . '" />'));
                        // FINISH TRANSLATION / SAVE / CLOSE
                        if ($GLOBALS['TYPO3_CONF_VARS']['BE']['explicitConfirmationOfTranslation']) {
                                $buttons['translation_save'] = '<input type="image" class="c-inputButton" name="_translation_savedok" src="sysext/t3skin/images/icons/actions/document-save-translation.png" title="' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.translationSaveDoc', TRUE) . '" /> ';
index b2f41ef..584ce1f 100755 (executable)
@@ -1205,11 +1205,11 @@ class PageLayoutController {
                        }
                        if ($function == 'quickEdit') {
                                // Save record
-                               $buttons['savedok'] = '<button class="c-inputButton" name="_savedok_x">'
+                               $buttons['savedok'] = '<button class="c-inputButton" name="_savedok_x" value="1">'
                                        . IconUtility::getSpriteIcon('actions-document-save', array('title' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE)))
                                        . '</button>';
                                // Save and close
-                               $buttons['save_close'] = '<button class="c-inputButton" name="_saveandclosedok_x">'
+                               $buttons['save_close'] = '<button class="c-inputButton" name="_saveandclosedok_x" value="1">'
                                        . IconUtility::getSpriteIcon('actions-document-save-close', array('title' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE)))
                                        . '</button>';
                                // Save record and show page
index 92ad40b..4f3f72c 100644 (file)
@@ -270,11 +270,11 @@ class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizar
                        // Close
                        $buttons['close'] = '<a href="#" onclick="' . htmlspecialchars(('jumpToUrl(unescape(\'' . rawurlencode(GeneralUtility::sanitizeLocalUrl($this->P['returnUrl'])) . '\')); return false;')) . '">' . IconUtility::getSpriteIcon('actions-document-close', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE))) . '</a>';
                        // Save
-                       $buttons['save'] = '<button class="c-inputButton" name="savedok">' . IconUtility::getSpriteIcon('actions-document-save', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE))) . '</button>';
+                       $buttons['save'] = '<button class="c-inputButton" name="savedok" value="1">' . IconUtility::getSpriteIcon('actions-document-save', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE))) . '</button>';
                        // Save & Close
-                       $buttons['save_close'] = '<button class="c-inputButton" name="saveandclosedok">' . IconUtility::getSpriteIcon('actions-document-save-close', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE))) . '</button>';
+                       $buttons['save_close'] = '<button class="c-inputButton" name="saveandclosedok" value="1">' . IconUtility::getSpriteIcon('actions-document-save-close', array('title' => $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE))) . '</button>';
                        // Reload
-                       $buttons['reload'] = '<button class="c-inputButton" name="_refresh">' . IconUtility::getSpriteIcon('actions-system-refresh', array('title' => $this->getLanguageService()->getLL('forms_refresh', TRUE))) . '</button>';
+                       $buttons['reload'] = '<button class="c-inputButton" name="_refresh" value="1">' . IconUtility::getSpriteIcon('actions-system-refresh', array('title' => $this->getLanguageService()->getLL('forms_refresh', TRUE))) . '</button>';
                }
                return $buttons;
        }
index 5587160..1d05324 100644 (file)
@@ -125,7 +125,7 @@ class TypoScriptTemplateConstantEditorModuleFunctionController extends AbstractF
                        $this->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Tstemplate/ConstantEditor');
                        $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
                        // Update template ?
-                       if (GeneralUtility::_POST('submit') || MathUtility::canBeInterpretedAsInteger(GeneralUtility::_POST('submit_x')) && MathUtility::canBeInterpretedAsInteger(GeneralUtility::_POST('submit_y'))) {
+                       if (GeneralUtility::_POST('submit') ) {
                                $templateService->changed = 0;
                                $templateService->ext_procesInput(GeneralUtility::_POST(), array(), $theConstants, $tplRow);
                                if ($templateService->changed) {
index 69b8387..efa88d4 100755 (executable)
@@ -293,11 +293,11 @@ class TypoScriptTemplateModuleController extends BaseScriptClass {
                                        // no NEW-button while edit
                                        $buttons['new'] = '';
                                        // SAVE button
-                                       $buttons['save'] = '<button type="submit" class="c-inputButton" name="submit">'
+                                       $buttons['save'] = '<button type="submit" class="c-inputButton" name="submit" value="1">'
                                                . IconUtility::getSpriteIcon('actions-document-save', array('title' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE)))
                                                . '</button>';
                                        // SAVE AND CLOSE button
-                                       $buttons['save_close'] = '<button type="submit" class="c-inputButton" name="saveclose">'
+                                       $buttons['save_close'] = '<button type="submit" class="c-inputButton" name="saveclose" value="1">'
                                                . IconUtility::getSpriteIcon('actions-document-save-close', array('title' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveCloseDoc', TRUE)))
                                                . '</button>';
                                        // CLOSE button
@@ -306,7 +306,7 @@ class TypoScriptTemplateModuleController extends BaseScriptClass {
                                }
                        } elseif ($this->extClassConf['name'] === TypoScriptTemplateConstantEditorModuleFunctionController::class && !empty($this->MOD_MENU['constant_editor_cat'])) {
                                // SAVE button
-                               $buttons['save'] = '<button class="c-inputButton" name="submit">'
+                               $buttons['save'] = '<button class="c-inputButton" name="submit" value="1">'
                                        . IconUtility::getSpriteIcon('actions-document-save', array('title' => $lang->sL('LLL:EXT:lang/locallang_core.xlf:rm.saveDoc', TRUE)))
                                        . '</button>';
                        } elseif ($this->extClassConf['name'] === TypoScriptTemplateObjectBrowserModuleFunctionController::class) {
@@ -470,7 +470,7 @@ class TypoScriptTemplateModuleController extends BaseScriptClass {
                $tce = GeneralUtility::makeInstance(DataHandler::class);
                $tce->stripslashes_values = FALSE;
 
-               if (GeneralUtility::_GP('createExtension') || GeneralUtility::_GP('createExtension_x')) {
+               if (GeneralUtility::_GP('createExtension')) {
                        $recData['sys_template']['NEW'] = array(
                                'pid' => $actTemplateId ? -1 * $actTemplateId : $id,
                                'title' => '+ext'