t3lib_htmlmail: auto-detect charset (using FE or BE settings) with manual override
authorMartin Kutschker <martin.t.kutschker@blackbox.net>
Fri, 30 Jun 2006 14:06:35 +0000 (14:06 +0000)
committerMartin Kutschker <martin.t.kutschker@blackbox.net>
Fri, 30 Jun 2006 14:06:35 +0000 (14:06 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1578 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_htmlmail.php

index b3747f6..b23d30e 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+
+2006-06-30  Martin Kutschker  <martin.t.kutschker@blackbox.net>
+
+       * t3lib_htmlmail: auto-detect charset (using FE or BE settings) with manual override
+
 2006-06-30 Karsten Dambekalns <karsten@typo3.org>
 
        * t3lib_page: Changed getMultipleGroupsWhereClause() to include a check using IS NULL to make it compatible to Oracle. Made enableFields() call getMultipleGroupsWhereClause() non-statically using $this.
 2006-06-30 Karsten Dambekalns <karsten@typo3.org>
 
        * t3lib_page: Changed getMultipleGroupsWhereClause() to include a check using IS NULL to make it compatible to Oracle. Made enableFields() call getMultipleGroupsWhereClause() non-statically using $this.
index 93612d2..8a9f687 100755 (executable)
@@ -274,26 +274,30 @@ class t3lib_htmlmail {
                        $host = ($TYPO3_CONF_VARS['SYS']['sitename'] ? preg_replace('/[^A-Za-z0-9_\-]/', '_', $TYPO3_CONF_VARS['SYS']['sitename']) : 'localhost') . '.TYPO3';
                }
                $this->messageid = md5(microtime()) . '@' . $host;
                        $host = ($TYPO3_CONF_VARS['SYS']['sitename'] ? preg_replace('/[^A-Za-z0-9_\-]/', '_', $TYPO3_CONF_VARS['SYS']['sitename']) : 'localhost') . '.TYPO3';
                }
                $this->messageid = md5(microtime()) . '@' . $host;
-
+               
                        // Default line break for Unix systems.
                $this->linebreak = chr(10);
                        // Line break for Windows. This is needed because PHP on Windows systems send mails via SMTP instead of using sendmail, and thus the linebreak needs to be \r\n.
                if (TYPO3_OS=='WIN')    {
                        $this->linebreak = chr(13).chr(10);
                }
                        // Default line break for Unix systems.
                $this->linebreak = chr(10);
                        // Line break for Windows. This is needed because PHP on Windows systems send mails via SMTP instead of using sendmail, and thus the linebreak needs to be \r\n.
                if (TYPO3_OS=='WIN')    {
                        $this->linebreak = chr(13).chr(10);
                }
-
-               $charset = $this->defaultCharset;
-               if (is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->config['metaCharset'])     {
-                       $charset = $GLOBALS['TSFE']->config['metaCharset'];
-               } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'])    {
-                       $charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
+               
+               if (!$this->charset) {
+                       if (is_object($GLOBALS['TSFE']) && $GLOBALS['TSFE']->renderCharset) {
+                               $this->charset = $GLOBALS['TSFE']->renderCharset;
+                       } elseif (is_object($GLOBALS['LANG']) && $GLOBALS['LANG']->charSet) {
+                               $this->charset = $GLOBALS['LANG']->charSet;
+                       } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset']) {
+                               $this->charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'];
+                       } else {
+                               $this->charset = $this->defaultCharset;
+                       }
                }
                }
-               $this->charset = $charset;
-
+               
                        // Use quoted-printable headers by default
                $this->useQuotedPrintable();
        }
                        // Use quoted-printable headers by default
                $this->useQuotedPrintable();
        }
-
+       
        /**
         * [Describe function...]
         *
        /**
         * [Describe function...]
         *