Fixed bug #6121: Reply-To field in formmails can contain invalid characters if formMa...
authorMichael Stucki <michael.stucki@typo3.org>
Wed, 17 Oct 2007 10:23:52 +0000 (10:23 +0000)
committerMichael Stucki <michael.stucki@typo3.org>
Wed, 17 Oct 2007 10:23:52 +0000 (10:23 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2582 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_formmail.php

index 56f93cb..221edbb 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-17  Michael Stucki  <michael@typo3.org>
+
+       * Fixed bug #6121: Reply-To field in formmails can contain invalid characters if formMailCharset different from site charset (patch by Wolfgang Zenker)
+
 2007-10-17  Sebastian Kurfuerst  <sebastian@typo3.org>
 
        * Fixed bug #6202: Company field is missing for table fe_users in "View Item" (Thanks to Christian Kuhn)
index 7eca0de..1f5452a 100644 (file)
@@ -114,14 +114,14 @@ class t3lib_formmail extends t3lib_htmlmail {
                        $val = ($V['subject']) ? $V['subject'] : 'Formmail on '.t3lib_div::getIndpEnv('HTTP_HOST');
                        $this->subject = ($convCharset && strlen($val)) ? $GLOBALS['TSFE']->csConvObj->conv($val,$GLOBALS['TSFE']->renderCharset,$this->charset) : $val;
                        $this->subject = $this->sanitizeHeaderString($this->subject);
-                       $val = ($V['from_name']) ? $V['from_name'] : (($V['name'])?$V['name']:'');
+                       $val = ($V['from_name']) ? $V['from_name'] : (($V['name'])?$V['name']:'');      // Be careful when changing $val! It is used again as the fallback value for replyto_name
                        $this->from_name = ($convCharset && strlen($val)) ? $GLOBALS['TSFE']->csConvObj->conv($val,$GLOBALS['TSFE']->renderCharset,$this->charset) : $val;
                        $this->from_name = $this->sanitizeHeaderString($this->from_name);
                        $this->from_name = preg_match( '/\s|,/', $this->from_name ) >= 1 ? '"'.$this->from_name.'"' : $this->from_name;
-                       $val = ($V['replyto_name']) ? $V['replyto_name'] : $this->from_name;
+                       $val = ($V['replyto_name']) ? $V['replyto_name'] : $val;
                        $this->replyto_name = ($convCharset && strlen($val)) ? $GLOBALS['TSFE']->csConvObj->conv($val,$GLOBALS['TSFE']->renderCharset,$this->charset) : $val;
                        $this->replyto_name = $this->sanitizeHeaderString($this->replyto_name);
-                       $this->replyto_name = preg_match( '/\s|,/', $this->replyto_name ) > 1 ? '"'.$this->replyto_name.'"' : $this->replyto_name;
+                       $this->replyto_name = preg_match( '/\s|,/', $this->replyto_name ) >= 1 ? '"'.$this->replyto_name.'"' : $this->replyto_name;
                        $val = ($V['organisation']) ? $V['organisation'] : '';
                        $this->organisation = ($convCharset && strlen($val)) ? $GLOBALS['TSFE']->csConvObj->conv($val,$GLOBALS['TSFE']->renderCharset,$this->charset) : $val;
                        $this->organisation = $this->sanitizeHeaderString($this->organisation);