Added feature #11825: Override FE labels with XML files
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_readmail.php
old mode 100755 (executable)
new mode 100644 (file)
index f8a1420..332820f
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 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
  *
  *
  *
- *   87: class t3lib_readmail
- *
- *              SECTION: FUNCTIONS for the Dmailer
- *  122:     function find_MIDfromReturnPath($to)
- *  142:     function find_XTypo3MID($content)
+ *   83: class t3lib_readmail
  *
  *              SECTION: General
- *  188:     function getMessage($mailParts)
- *  213:     function getTextContent($content)
- *  228:     function getMailBoundaryParts($boundary,$content)
- *  248:     function getCType($str)
- *  271:     function analyseReturnError($c)
- *  326:     function decodeHeaderString($str)
- *  354:     function extractNameEmail($str)
- *  383:     function getContentTypeData($contentTypeStr)
- *  406:     function makeUnixDate($dateStr)
- *  429:     function getGMToffset($GMT)
- *  443:     function extractMailHeader($content,$limit=0)
- *  474:     function fullParse($content)
+ *  113:     function getMessage($mailParts)
+ *  138:     function getTextContent($content)
+ *  153:     function getMailBoundaryParts($boundary,$content)
+ *  173:     function getCType($str)
+ *  196:     function analyseReturnError($c)
+ *  251:     function decodeHeaderString($str)
+ *  279:     function extractNameEmail($str)
+ *  308:     function getContentTypeData($contentTypeStr)
+ *  331:     function makeUnixDate($dateStr)
+ *  354:     function getGMToffset($GMT)
+ *  368:     function extractMailHeader($content,$limit=0)
+ *  399:     function fullParse($content)
  *
- * TOTAL FUNCTIONS: 14
+ * TOTAL FUNCTIONS: 12
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
@@ -101,77 +97,6 @@ class t3lib_readmail {
        );
        var $serverGMToffsetMinutes = 60;               // = +0100 (CET)
 
-
-
-
-
-
-       /*******************************
-        *
-        * FUNCTIONS for the Dmailer
-        *
-        ********************************/
-
-       /**
-        * Returns special TYPO3 Message ID (MID) from input TO header (the return address of the sent mail from Dmailer. Used by Dmailer, return mails)
-        *
-        * @param       string          email address, return address string
-        * @return      mixed           array with 'mid', 'rtbl' and 'rid' keys are returned.
-        * @internal
-        */
-       function find_MIDfromReturnPath($to)    {
-               $parts = explode('mid',strtolower($to));
-               $moreParts=explode('_',$parts[1]);
-               $out=array(
-                       'mid' => $moreParts[0],
-                       'rtbl' => substr($moreParts[1],0,1),
-                       'rid' => intval(substr($moreParts[1],1))
-               );
-               if ($out['rtbl']=='p')          $out['rtbl']='P';
-
-               return($out);
-       }
-
-       /**
-        * Returns special TYPO3 Message ID (MID) from input mail content (used by Dmailer, return mails)
-        *
-        * @param       string          Mail (header) content
-        * @return      mixed           If "X-Typo3MID" header is found and integrity is OK, then an array with 'mid', 'rtbl' and 'rid' keys are returned. Otherwise void.
-        * @internal
-        */
-       function find_XTypo3MID($content)       {
-               if (strstr($content,'X-Typo3MID:'))     {
-                       $p=explode('X-Typo3MID:',$content,2);
-                       $l=explode(chr(10),$p[1],2);
-                       list($mid,$hash)=t3lib_div::trimExplode('-',$l[0]);
-                       if (md5($mid)==$hash)   {
-                               $moreParts=explode('_',substr($mid,3));
-                               $out=array(
-                                       'mid' => $moreParts[0],
-                                       'rtbl' => substr($moreParts[1],0,1),
-                                       'rid' => substr($moreParts[1],1)
-                               );
-                               return($out);
-                       }
-               }
-       }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
        /*******************************
         *
         * General
@@ -253,7 +178,7 @@ class t3lib_readmail {
                while(list(,$ppstr)=each($parts))       {
                        $mparts = explode('=',$ppstr,2);
                        if (count($mparts)>1)   {
-                               $cTypes[strtolower(trim($mparts[0]))]=ereg_replace('^"','',trim(ereg_replace('"$','',trim($mparts[1]))));
+                               $cTypes[strtolower(trim($mparts[0]))]=preg_replace('/^"/','',trim(preg_replace('/"$/','',trim($mparts[1]))));
                        } else {
                                $cTypes[]=$ppstr;
                        }
@@ -276,11 +201,11 @@ class t3lib_readmail {
                        $parts = explode('>:',$c,2);
                        $cp['reason_text']=trim($parts[1]);
                        $cp['mailserver']='Qmail';
-                       if (eregi('550|no mailbox|account does not exist',$cp['reason_text']))  {
+                       if (preg_match('/550|no mailbox|account does not exist/i',$cp['reason_text']))  {
                                $cp['reason']=550;      // 550 Invalid recipient
                        } elseif (stristr($cp['reason_text'],'couldn\'t find any host named')) {
                                $cp['reason']=2;        // Bad host
-                       } elseif (eregi('Error in Header|invalid Message-ID header',$cp['reason_text'])) {
+                       } elseif (preg_match('/Error in Header|invalid Message-ID header/i',$cp['reason_text'])) {
                                $cp['reason']=554;
                        } else {
                                $cp['reason']=-1;
@@ -303,11 +228,11 @@ class t3lib_readmail {
                        $cp['content']=trim($c);
                        $cp['reason_text']=trim(substr($c,0,1000));
                        $cp['mailserver']='unknown';
-                       if (eregi('Unknown Recipient|Delivery failed 550|Receiver not found|User not listed|recipient problem|Delivery to the following recipients failed|User unknown|recipient name is not recognized',$cp['reason_text']))   {
+                       if (preg_match('/Unknown Recipient|Delivery failed 550|Receiver not found|User not listed|recipient problem|Delivery to the following recipients failed|User unknown|recipient name is not recognized/i',$cp['reason_text']))   {
                                $cp['reason']=550;      // 550 Invalid recipient, User unknown
-                       } elseif (eregi('over quota|mailbox full',$cp['reason_text']))  {
+                       } elseif (preg_match('/over quota|mailbox full/i',$cp['reason_text']))  {
                                $cp['reason']=551;
-                       } elseif (eregi('Error in Header',$cp['reason_text']))  {
+                       } elseif (preg_match('/Error in Header/i',$cp['reason_text']))  {
                                $cp['reason']=554;
                        } else {
                                $cp['reason']=-1;
@@ -356,7 +281,7 @@ class t3lib_readmail {
 
                        // Email:
                $reg='';
-               ereg('<([^>]*)>',$str,$reg);
+               preg_match('/<([^>]*)>/',$str,$reg);
                if (t3lib_div::validEmail($str)) {
                        $outArr['email']=$str;
                } elseif ($reg[1] && t3lib_div::validEmail($reg[1]))    {
@@ -365,7 +290,7 @@ class t3lib_readmail {
                        list($namePart)=explode($reg[0],$str);
                        if (trim($namePart))    {
                                $reg='';
-                               ereg('"([^"]*)"',$str,$reg);
+                               preg_match('/"([^"]*)"/',$str,$reg);
                                if (trim($reg[1]))      {
                                        $outArr['name']=trim($reg[1]);
                                } else $outArr['name']=trim($namePart);
@@ -389,7 +314,7 @@ class t3lib_readmail {
                next($cTypeParts);
                while(list(,$v)=Each($cTypeParts))      {
                        $reg='';
-                       eregi('([^=]*)="(.*)"',$v,$reg);
+                       preg_match('/([^=]*)="(.*)"/i',$v,$reg);
                        if (trim($reg[1]) && trim($reg[2]))     {
                                $outValue[strtolower($reg[1])] = $reg[2];
                        }