Fixed bug #10266: No user authentication for >1 TYPO3 installation under one domain...
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_htmlmail.php
old mode 100755 (executable)
new mode 100644 (file)
index 912499d..f6335c4
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2008 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
@@ -713,7 +713,7 @@ class t3lib_htmlmail {
 
                        // On windows the -f flag is not used (specific for Sendmail and Postfix),
                        // but instead the php.ini parameter sendmail_from is used.
-               $returnPath = (strlen($this->returnPath) > 0) ? '-f "' . escapeshellarg($this->returnPath) . '"' : '';
+               $returnPath = (strlen($this->returnPath) > 0) ? '-f ' . escapeshellarg($this->returnPath) : '';
                if($this->returnPath) {
                        @ini_set('sendmail_from', t3lib_div::normalizeMailAddress($this->returnPath));
                }
@@ -923,7 +923,7 @@ class t3lib_htmlmail {
                $attribRegex = $this->tag_regex(array('img','table','td','tr','body','iframe','script','input','embed'));
 
                        // split the document by the beginning of the above tags
-               $codepieces = split($attribRegex, $html_code);
+               $codepieces = preg_split($attribRegex, $html_code);
                $len = strlen($codepieces[0]);
                $pieces = count($codepieces);
                $reg = array();
@@ -954,7 +954,7 @@ class t3lib_htmlmail {
                        // Extracting stylesheets
                $attribRegex = $this->tag_regex(array('link'));
                        // Split the document by the beginning of the above tags
-               $codepieces = split($attribRegex, $html_code);
+               $codepieces = preg_split($attribRegex, $html_code);
                $pieces = count($codepieces);
                for ($i = 1; $i < $pieces; $i++) {
                        $dummy = eregi("[^>]*", $codepieces[$i], $reg);
@@ -977,7 +977,7 @@ class t3lib_htmlmail {
                }
 
                        // fixes javascript rollovers
-               $codepieces = split(quotemeta(".src"), $html_code);
+               $codepieces = preg_split('/' . quotemeta(".src") . '/', $html_code);
                $pieces = count($codepieces);
                $expr = "^[^".quotemeta("\"").quotemeta("'")."]*";
                for($i = 1; $i < $pieces; $i++) {
@@ -1013,7 +1013,7 @@ class t3lib_htmlmail {
        public function extractHyperLinks() {
                $html_code = $this->theParts['html']['content'];
                $attribRegex = $this->tag_regex(array('a','form','area'));
-               $codepieces = split($attribRegex, $html_code);  // Splits the document by the beginning of the above tags
+               $codepieces = preg_split($attribRegex, $html_code);     // Splits the document by the beginning of the above tags
                $len = strlen($codepieces[0]);
                $pieces = count($codepieces);
                for($i = 1; $i < $pieces; $i++) {
@@ -1069,7 +1069,7 @@ class t3lib_htmlmail {
                if (strpos(' '.$htmlCode,'<frame ')) {
                        $attribRegex = $this->tag_regex('frame');
                                // Splits the document by the beginning of the above tags
-                       $codepieces = split($attribRegex, $htmlCode, 1000000);
+                       $codepieces = preg_split($attribRegex, $htmlCode, 1000000);
                        $pieces = count($codepieces);
                        for($i = 1; $i < $pieces; $i++) {
                                $dummy = eregi("[^>]*", $codepieces[$i], $reg);
@@ -1418,13 +1418,13 @@ class t3lib_htmlmail {
         */
        public function tag_regex($tags) {
                $tags = (!is_array($tags) ? array($tags) : $tags);
-               $regexp = '';
+               $regexp = '/';
                $c = count($tags);
                foreach($tags as $tag) {
                        $c--;
                        $regexp .= '<' . sql_regcase($tag) . "[[:space:]]" . (($c) ? '|' : '');
                }
-               return $regexp;
+               return $regexp . '/';
        }
 
 
@@ -1444,7 +1444,7 @@ class t3lib_htmlmail {
                        // Find attribute
                while ($tag) {
                        $value = '';
-                       $reg = split("[[:space:]=>]",$tag,2);
+                       $reg = preg_split('/[[:space:]=>]/', $tag, 2);
                        $attrib = $reg[0];
 
                        $tag = ltrim(substr($tag,strlen($attrib),$tagLen));
@@ -1503,4 +1503,5 @@ class t3lib_htmlmail {
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_htmlmail.php']) {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_htmlmail.php']);
 }
+
 ?>