[TASK] Remove last mentions of t3lib_formmail 34/19834/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 12 Apr 2013 12:42:42 +0000 (14:42 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 12 Apr 2013 12:44:54 +0000 (14:44 +0200)
Change-Id: I7774323581f97bd3562eaa1fa67a5faae748446a
Resolves: #47160
Releases: 6.1
Reviewed-on: https://review.typo3.org/19834
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Tests/Legacy/t3lib/class.t3lib_formmailTest.php [deleted file]
typo3/sysext/core/ext_autoload.php
typo3/sysext/frontend/Classes/Controller/DataSubmissionController.php
typo3/sysext/frontend/Tests/Unit/Controller/DataSubmissionControllerTest.php [new file with mode: 0644]

diff --git a/typo3/sysext/core/Tests/Legacy/t3lib/class.t3lib_formmailTest.php b/typo3/sysext/core/Tests/Legacy/t3lib/class.t3lib_formmailTest.php
deleted file mode 100644 (file)
index cd23408..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/***************************************************************
- *  Copyright notice
- *
- *  (c) 2011-2013 Christian Kuhn <lolli@schwarzbu.ch>
- *  All rights reserved
- *
- *  This script is part of the TYPO3 project. The TYPO3 project is
- *  free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  The GNU General Public License can be found at
- *  http://www.gnu.org/copyleft/gpl.html.
- *
- *  This script is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  This copyright notice MUST APPEAR in all copies of the script!
- ***************************************************************/
-
-/**
- * Testcase for t3lib_formmail
- *
- * This legacy test will be removed if t3lib_formmail is removed
- *
- * @author Christian Kuhn <lolli@schwarzbu.ch>
- *
- */
-class t3lib_formmailTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
-
-       ///////////////////////////////
-       // tests concerning __destruct
-       ///////////////////////////////
-
-       /**
-        * Dataprovider for destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory
-        */
-       public function invalidFileReferences() {
-               return array(
-                       'not within PATH_site' => array('/tmp/TYPO3-Formmail-Test'),
-                       'does not start with upload_temp_' => array(PATH_site . 'typo3temp/foo'),
-                       'directory traversal' => array(PATH_site . 'typo3temp/../typo3temp/upload_temp_foo'),
-               );
-       }
-
-       /**
-        * @test
-        * @dataProvider invalidFileReferences
-        */
-       public function destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory($file) {
-               if (TYPO3_OS === 'WIN') {
-                       $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() test not available on Windows.');
-               }
-                       // Reflection needs php 5.3.2 or above
-               if (version_compare(phpversion(), '5.3.2', '<')) {
-                       $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() test not available with php version smaller than 5.3.2');
-               }
-
-                       // Create test file
-               touch($file);
-               if (!is_file($file)) {
-                       $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() skipped: Test file could not be created');
-               }
-
-                       // Create t3lib_formmail instance, inject invalid file
-               $instance = new t3lib_formmail(999999999, $lockMethod);
-               $t3libLockReflection = new ReflectionClass('t3lib_formmail');
-               $t3libLockReflectionResourceProperty = $t3libLockReflection->getProperty('temporaryFiles');
-               $t3libLockReflectionResourceProperty->setAccessible(TRUE);
-               $t3libLockReflectionResourceProperty->setValue($instance, array($file));
-
-                       // Call release method
-               $instance->__destruct();
-
-                       // Check if file is still there and clean up
-               $fileExists = is_file($file);
-               if (is_file($file)) {
-                       unlink($file);
-               }
-
-               $this->assertTrue($fileExists);
-       }
-}
-?>
\ No newline at end of file
index 0241a59..3b3176c 100644 (file)
@@ -3,7 +3,6 @@
 // This file was generated on 2012-06-22 14:48
 $t3libClasses = array(
        't3lib_ajax' => PATH_t3lib . 'class.t3lib_ajax.php',
-       't3lib_formmail' => PATH_t3lib . 'class.t3lib_formmail.php',
        't3lib_install' => PATH_t3lib . 'class.t3lib_install.php',
        't3lib_readmail' => PATH_t3lib . 'class.t3lib_readmail.php',
        't3lib_syntaxhl' => PATH_t3lib . 'class.t3lib_syntaxhl.php',
@@ -22,4 +21,4 @@ $typo3Classes = array(
        'transferdata' => PATH_typo3 . 'show_item.php',
 );
 return array_merge($t3libClasses, $typo3Classes);
-?>
\ No newline at end of file
+?>
index 41f8db9..34d85bd 100644 (file)
@@ -137,7 +137,7 @@ class DataSubmissionController {
                                $autoRespondChecksum = $valueList['auto_respond_checksum'];
                                $correctHmacChecksum = Utility\GeneralUtility::hmac($this->autoRespondMessage);
                                if ($autoRespondChecksum !== $correctHmacChecksum) {
-                                       Utility\GeneralUtility::sysLog('Possible misuse of t3lib_formmail auto respond method. Subject: ' . $valueList['subject'], 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
+                                       Utility\GeneralUtility::sysLog('Possible misuse of DataSubmissionController auto respond method. Subject: ' . $valueList['subject'], 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                                        return;
                                } else {
                                        $this->autoRespondMessage = $this->sanitizeHeaderString($this->autoRespondMessage);
@@ -173,10 +173,10 @@ class DataSubmissionController {
                                        continue;
                                }
                                if (!is_uploaded_file($_FILES[$variableName]['tmp_name'])) {
-                                       Utility\GeneralUtility::sysLog('Possible abuse of t3lib_formmail: temporary file "' . $_FILES[$variableName]['tmp_name'] . '" ("' . $_FILES[$variableName]['name'] . '") was not an uploaded file.', 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
+                                       Utility\GeneralUtility::sysLog('Possible abuse of DataSubmissionController: temporary file "' . $_FILES[$variableName]['tmp_name'] . '" ("' . $_FILES[$variableName]['name'] . '") was not an uploaded file.', 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                                }
                                if ($_FILES[$variableName]['tmp_name']['error'] !== UPLOAD_ERR_OK) {
-                                       Utility\GeneralUtility::sysLog('Error in uploaded file in t3lib_formmail: temporary file "' . $_FILES[$variableName]['tmp_name'] . '" ("' . $_FILES[$variableName]['name'] . '") Error code: ' . $_FILES[$variableName]['tmp_name']['error'], 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
+                                       Utility\GeneralUtility::sysLog('Error in uploaded file in DataSubmissionController: temporary file "' . $_FILES[$variableName]['tmp_name'] . '" ("' . $_FILES[$variableName]['name'] . '") Error code: ' . $_FILES[$variableName]['tmp_name']['error'], 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                                }
                                $theFile = Utility\GeneralUtility::upload_to_tempfile($_FILES[$variableName]['tmp_name']);
                                $theName = $_FILES[$variableName]['name'];
@@ -201,9 +201,9 @@ class DataSubmissionController {
                        // is not worth the trouble
                        // Log dirty header lines
                        if ($this->dirtyHeaders) {
-                               Utility\GeneralUtility::sysLog('Possible misuse of t3lib_formmail: see TYPO3 devLog', 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
+                               Utility\GeneralUtility::sysLog('Possible misuse of DataSubmissionController: see TYPO3 devLog', 'Core', Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
                                if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['enable_DLOG']) {
-                                       Utility\GeneralUtility::devLog('t3lib_formmail: ' . Utility\GeneralUtility::arrayToLogString($this->dirtyHeaders, '', 200), 'Core', 3);
+                                       Utility\GeneralUtility::devLog('DataSubmissionController: ' . Utility\GeneralUtility::arrayToLogString($this->dirtyHeaders, '', 200), 'Core', 3);
                                }
                        }
                }
@@ -290,4 +290,4 @@ class DataSubmissionController {
 
 }
 
-?>
\ No newline at end of file
+?>
diff --git a/typo3/sysext/frontend/Tests/Unit/Controller/DataSubmissionControllerTest.php b/typo3/sysext/frontend/Tests/Unit/Controller/DataSubmissionControllerTest.php
new file mode 100644 (file)
index 0000000..08f0880
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+namespace TYPO3\CMS\Frontend\Tests\Unit\Controller;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2011-2013 Christian Kuhn <lolli@schwarzbu.ch>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Test case
+ *
+ * @author Christian Kuhn <lolli@schwarzbu.ch>
+ */
+class DataSubmissionControllerTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
+
+       ///////////////////////////////
+       // tests concerning __destruct
+       ///////////////////////////////
+
+       /**
+        * Dataprovider for destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory
+        */
+       public function invalidFileReferences() {
+               return array(
+                       'not within PATH_site' => array('/tmp/TYPO3-DataSubmissionControllerTest'),
+                       'does not start with upload_temp_' => array(PATH_site . 'typo3temp/foo'),
+                       'directory traversal' => array(PATH_site . 'typo3temp/../typo3temp/upload_temp_foo'),
+               );
+       }
+
+       /**
+        * @test
+        * @dataProvider invalidFileReferences
+        */
+       public function destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory($file) {
+               if (TYPO3_OS === 'WIN') {
+                       $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() test not available on Windows.');
+               }
+                       // Reflection needs php 5.3.2 or above
+               if (version_compare(phpversion(), '5.3.2', '<')) {
+                       $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() test not available with php version smaller than 5.3.2');
+               }
+
+                       // Create test file
+               touch($file);
+               if (!is_file($file)) {
+                       $this->markTestSkipped('destructorDoesNotRemoveFilesNotWithinTypo3TempDirectory() skipped: Test file could not be created');
+               }
+
+               $instance = new \TYPO3\CMS\Frontend\Controller\DataSubmissionController(999999999, $lockMethod);
+               $t3libLockReflection = new \ReflectionClass('TYPO3\\CMS\\Frontend\\Controller\\DataSubmissionController');
+               $t3libLockReflectionResourceProperty = $t3libLockReflection->getProperty('temporaryFiles');
+               $t3libLockReflectionResourceProperty->setAccessible(TRUE);
+               $t3libLockReflectionResourceProperty->setValue($instance, array($file));
+
+                       // Call release method
+               $instance->__destruct();
+
+                       // Check if file is still there and clean up
+               $fileExists = is_file($file);
+               if (is_file($file)) {
+                       unlink($file);
+               }
+
+               $this->assertTrue($fileExists);
+       }
+}
+?>
\ No newline at end of file