[TASK] Clean up data submission handling 26/19826/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 12 Apr 2013 11:51:35 +0000 (13:51 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 12 Apr 2013 12:14:19 +0000 (14:14 +0200)
The patch encapsulates the data submission that can feed
DataSubmissionController from index_ts to
TypoScriptFrontendController.

Change-Id: I3d357f97f77db5e675f4ec446fc3015214e372a2
Resolves: #47158
Related: #47157
Releases: 6.1
Reviewed-on: https://review.typo3.org/19826
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Thomas Maroschik
Tested-by: Thomas Maroschik
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php

index c5ca303..94ce86e 100644 (file)
@@ -162,13 +162,9 @@ $TT->pull();
 // Check JumpUrl
 $TSFE->setExternalJumpUrl();
 $TSFE->checkJumpUrlReferer();
-// Check Submission of data.
-// This is done at this point, because we need the config values
-switch ($TSFE->checkDataSubmission()) {
-case 'email':
-       $TSFE->sendFormmail();
-       break;
-}
+
+$TSFE->handleDataSubmission();
+
 // Check for shortcut page and redirect
 $TSFE->checkPageForShortcutRedirect();
 // Generate page
index f59bd4a..3cf2e2a 100644 (file)
@@ -2619,12 +2619,26 @@ class TypoScriptFrontendController {
        }
 
        /**
+        * Handle data submission
+        *
+        * @return void
+        */
+       public function handleDataSubmission() {
+               // Check Submission of data.
+               // This is done at this point, because we need the config values
+               switch ($this->checkDataSubmission()) {
+               case 'email':
+                       $this->sendFormmail();
+                       break;
+               }
+       }
+
+       /**
         * Checks if any email-submissions
         *
         * @return string "email" if a formmail has been sent, "" if none.
-        * @todo Define visibility
         */
-       public function checkDataSubmission() {
+       protected function checkDataSubmission() {
                $ret = '';
                $formtype_mail = isset($_POST['formtype_mail']) || isset($_POST['formtype_mail_x']);
                if ($formtype_mail) {
@@ -2690,12 +2704,11 @@ class TypoScriptFrontendController {
         * Sends the emails from the formmail content object.
         *
         * @return void
-        * @access private
         * @see checkDataSubmission()
-        * @todo Define visibility
         */
-       public function sendFormmail() {
-               $formmail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('t3lib_formmail');
+       protected function sendFormmail() {
+               /** @var $formmail \TYPO3\CMS\Frontend\Controller\DataSubmissionController */
+               $formmail = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\DataSubmissionController');
                $EMAIL_VARS = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
                $locationData = $EMAIL_VARS['locationData'];
                unset($EMAIL_VARS['locationData']);