[TASK] Fix CGL violations against NonExecutableCode
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 21 Sep 2012 17:05:25 +0000 (19:05 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 21 Sep 2012 20:06:31 +0000 (22:06 +0200)
Change-Id: I1dfd2fdbfd39ed851272e450dd2f114c8f62ccbe
Resolves: #41189
Releases: 6.0
Reviewed-on: http://review.typo3.org/14850
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/core/Classes/Mail/Mailer.php
typo3/sysext/impexp/classes/ImportExport.php
typo3/sysext/rtehtmlarea/Classes/Controller/SpellCheckingController.php
typo3/sysext/rtehtmlarea/ext_autoload.php

index 7208c57..2a542bb 100644 (file)
@@ -67,59 +67,58 @@ class Mailer extends \Swift_Mailer {
         */
        private function initializeTransport() {
                switch ($this->mailSettings['transport']) {
-               case 'smtp':
-                       // Get settings to be used when constructing the transport object
-                       list($host, $port) = preg_split('/:/', $this->mailSettings['transport_smtp_server']);
-                       if ($host === '') {
-                               throw new \TYPO3\CMS\Core\Exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_smtp_server\'] needs to be set when transport is set to "smtp"', 1291068606);
-                       }
-                       if ($port === '') {
-                               $port = '25';
-                       }
-                       $useEncryption = $this->mailSettings['transport_smtp_encrypt'] ? $this->mailSettings['transport_smtp_encrypt'] : NULL;
-                       // Create our transport
-                       $this->transport = \Swift_SmtpTransport::newInstance($host, $port, $useEncryption);
-                       // Need authentication?
-                       $username = $this->mailSettings['transport_smtp_username'];
-                       if ($username !== '') {
-                               $this->transport->setUsername($username);
-                       }
-                       $password = $this->mailSettings['transport_smtp_password'];
-                       if ($password !== '') {
-                               $this->transport->setPassword($password);
-                       }
-                       break;
-               case 'sendmail':
-                       $sendmailCommand = $this->mailSettings['transport_sendmail_command'];
-                       if (empty($sendmailCommand)) {
-                               throw new \TYPO3\CMS\Core\Exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_sendmail_command\'] needs to be set when transport is set to "sendmail"', 1291068620);
-                       }
-                       // Create our transport
-                       $this->transport = \Swift_SendmailTransport::newInstance($sendmailCommand);
-                       break;
-               case 'mbox':
-                       $mboxFile = $this->mailSettings['transport_mbox_file'];
-                       if ($mboxFile == '') {
-                               throw new \TYPO3\CMS\Core\Exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_mbox_file\'] needs to be set when transport is set to "mbox"', 1294586645);
-                       }
-                       // Create our transport
-                       $this->transport = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MboxTransport', $mboxFile);
-                       break;
-               case 'mail':
-                       // Create the transport, no configuration required
-                       $this->transport = \Swift_MailTransport::newInstance();
-                       break;
-               default:
-                       // Custom mail transport
-                       $customTransport = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($this->mailSettings['transport'], $this->mailSettings);
-                       if ($customTransport instanceof \Swift_Transport) {
-                               $this->transport = $customTransport;
-                       } else {
-                               throw new \RuntimeException($this->mailSettings['transport'] . ' is not an implementation of \\Swift_Transport,
-                                               but must implement that interface to be used as a mail transport.', 1323006478);
-                       }
+                       case 'smtp':
+                               // Get settings to be used when constructing the transport object
+                               list($host, $port) = preg_split('/:/', $this->mailSettings['transport_smtp_server']);
+                               if ($host === '') {
+                                       throw new \TYPO3\CMS\Core\Exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_smtp_server\'] needs to be set when transport is set to "smtp"', 1291068606);
+                               }
+                               if ($port === '') {
+                                       $port = '25';
+                               }
+                               $useEncryption = $this->mailSettings['transport_smtp_encrypt'] ? $this->mailSettings['transport_smtp_encrypt'] : NULL;
+                               // Create our transport
+                               $this->transport = \Swift_SmtpTransport::newInstance($host, $port, $useEncryption);
+                               // Need authentication?
+                               $username = $this->mailSettings['transport_smtp_username'];
+                               if ($username !== '') {
+                                       $this->transport->setUsername($username);
+                               }
+                               $password = $this->mailSettings['transport_smtp_password'];
+                               if ($password !== '') {
+                                       $this->transport->setPassword($password);
+                               }
+                               break;
+                       case 'sendmail':
+                               $sendmailCommand = $this->mailSettings['transport_sendmail_command'];
+                               if (empty($sendmailCommand)) {
+                                       throw new \TYPO3\CMS\Core\Exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_sendmail_command\'] needs to be set when transport is set to "sendmail"', 1291068620);
+                               }
+                               // Create our transport
+                               $this->transport = \Swift_SendmailTransport::newInstance($sendmailCommand);
+                               break;
+                       case 'mbox':
+                               $mboxFile = $this->mailSettings['transport_mbox_file'];
+                               if ($mboxFile == '') {
+                                       throw new \TYPO3\CMS\Core\Exception('$TYPO3_CONF_VARS[\'MAIL\'][\'transport_mbox_file\'] needs to be set when transport is set to "mbox"', 1294586645);
+                               }
+                               // Create our transport
+                               $this->transport = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Mail\\MboxTransport', $mboxFile);
+                               break;
+                       case 'mail':
+                               // Create the transport, no configuration required
+                               $this->transport = \Swift_MailTransport::newInstance();
+                               break;
+                       default:
+                               // Custom mail transport
+                               $customTransport = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($this->mailSettings['transport'], $this->mailSettings);
+                               if ($customTransport instanceof \Swift_Transport) {
+                                       $this->transport = $customTransport;
+                               } else {
+                                       throw new \RuntimeException($this->mailSettings['transport'] . ' is not an implementation of \\Swift_Transport,
+                                                       but must implement that interface to be used as a mail transport.', 1323006478);
+                               }
                }
-               return;
        }
 
        /**
index 3f2dcf6..c4a3486 100644 (file)
@@ -1819,27 +1819,25 @@ class ImportExport {
                        default:
                                // Mapping IDs/creating files: Based on type, look up new value:
                                switch ((string) $cfg['subst']['type']) {
-                               case 'db':
-
-                               default:
-                                       // Trying to map database element if found in the mapID array:
-                                       list($tempTable, $tempUid) = explode(':', $cfg['subst']['recordRef']);
-                                       if (isset($this->import_mapId[$tempTable][$tempUid])) {
-                                               $insertValue = \TYPO3\CMS\Backend\Utility\BackendUtility::wsMapId($tempTable, $this->import_mapId[$tempTable][$tempUid]);
-                                               // Look if reference is to a page and the original token value was NOT an integer - then we assume is was an alias and try to look up the new one!
-                                               if ($tempTable === 'pages' && !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($cfg['subst']['tokenValue'])) {
-                                                       $recWithUniqueValue = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($tempTable, $insertValue, 'alias');
-                                                       if ($recWithUniqueValue['alias']) {
-                                                               $insertValue = $recWithUniqueValue['alias'];
+                                       case 'file':
+                                               // Create / Overwrite file:
+                                               $insertValue = $this->processSoftReferences_saveFile($cfg['subst']['relFileName'], $cfg, $table, $uid);
+                                               break;
+                                       case 'db':
+                                       default:
+                                               // Trying to map database element if found in the mapID array:
+                                               list($tempTable, $tempUid) = explode(':', $cfg['subst']['recordRef']);
+                                               if (isset($this->import_mapId[$tempTable][$tempUid])) {
+                                                       $insertValue = \TYPO3\CMS\Backend\Utility\BackendUtility::wsMapId($tempTable, $this->import_mapId[$tempTable][$tempUid]);
+                                                       // Look if reference is to a page and the original token value was NOT an integer - then we assume is was an alias and try to look up the new one!
+                                                       if ($tempTable === 'pages' && !\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($cfg['subst']['tokenValue'])) {
+                                                               $recWithUniqueValue = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($tempTable, $insertValue, 'alias');
+                                                               if ($recWithUniqueValue['alias']) {
+                                                                       $insertValue = $recWithUniqueValue['alias'];
+                                                               }
                                                        }
                                                }
-                                       }
-                                       break;
-                                       break;
-                               case 'file':
-                                       // Create / Overwrite file:
-                                       $insertValue = $this->processSoftReferences_saveFile($cfg['subst']['relFileName'], $cfg, $table, $uid);
-                                       break;
+                                               break;
                                }
                                break;
                        }
index 9e088e5..ed52984 100644 (file)
@@ -443,38 +443,37 @@ var selectedDictionary = "' . $this->dictionary . '";
                        $this->xmlCharacterData = '';
                }
                switch ($tag) {
-               case 'spellchecker':
-                       break;
-               case 'br':
+                       case 'spellchecker':
+                               break;
+                       case 'br':
 
-               case 'BR':
+                       case 'BR':
 
-               case 'img':
+                       case 'img':
 
-               case 'IMG':
+                       case 'IMG':
 
-               case 'hr':
+                       case 'hr':
 
-               case 'HR':
+                       case 'HR':
 
-               case 'area':
+                       case 'area':
 
-               case 'AREA':
-                       $this->text .= '<' . $this->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
-                       foreach ($attributes as $key => $val) {
-                               $this->text .= $key . '="' . $val . '" ';
-                       }
-                       $this->text .= ' />';
-                       break;
-               default:
-                       $this->text .= '<' . $this->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
-                       foreach ($attributes as $key => $val) {
-                               $this->text .= $key . '="' . $val . '" ';
-                       }
-                       $this->text .= '>';
-                       break;
+                       case 'AREA':
+                               $this->text .= '<' . $this->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
+                               foreach ($attributes as $key => $val) {
+                                       $this->text .= $key . '="' . $val . '" ';
+                               }
+                               $this->text .= ' />';
+                               break;
+                       default:
+                               $this->text .= '<' . $this->csConvObj->conv_case($this->parserCharset, $tag, 'toLower') . ' ';
+                               foreach ($attributes as $key => $val) {
+                                       $this->text .= $key . '="' . $val . '" ';
+                               }
+                               $this->text .= '>';
+                               break;
                }
-               return;
        }
 
        /**
@@ -486,33 +485,32 @@ var selectedDictionary = "' . $this->dictionary . '";
                        $this->xmlCharacterData = '';
                }
                switch ($tag) {
-               case 'spellchecker':
-                       break;
-               case 'br':
+                       case 'spellchecker':
+                               break;
+                       case 'br':
 
-               case 'BR':
+                       case 'BR':
 
-               case 'img':
+                       case 'img':
 
-               case 'IMG':
+                       case 'IMG':
 
-               case 'hr':
+                       case 'hr':
 
-               case 'HR':
+                       case 'HR':
 
-               case 'input':
+                       case 'input':
 
-               case 'INPUT':
+                       case 'INPUT':
 
-               case 'area':
+                       case 'area':
 
-               case 'AREA':
-                       break;
-               default:
-                       $this->text .= '</' . $tag . '>';
-                       break;
+                       case 'AREA':
+                               break;
+                       default:
+                               $this->text .= '</' . $tag . '>';
+                               break;
                }
-               return;
        }
 
        /**
@@ -598,7 +596,6 @@ var selectedDictionary = "' . $this->dictionary . '";
                }
                $this->text .= $stringText;
                unset($incurrent);
-               return;
        }
 
        /**
@@ -613,7 +610,6 @@ var selectedDictionary = "' . $this->dictionary . '";
         */
        public function defaultHandler($xml_parser, $string) {
                $this->text .= $string;
-               return;
        }
 
 }
index bfd3a77..b795266 100644 (file)
@@ -16,5 +16,4 @@ return array(
        'tx_rtehtmlarea_user' => $rtehtmlareaExtensionPath . 'mod5/class.tx_rtehtmlarea_user.php',
        'tx_rtehtmlarea_parse_html' => $rtehtmlareaExtensionPath . 'mod6/class.tx_rtehtmlarea_parse_html.php'
 );
-unset($rtehtmlareaExtensionPath);
 ?>
\ No newline at end of file