[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] CVS: squirrelmail/class/mime Rfc822Header.class.php,1.17.2.7,1.17.2.8
From:       Marc Groot Koerkamp <stekkel () users ! sourceforge ! net>
Date:       2003-06-29 11:41:36
[Download RAW message or body]

Update of /cvsroot/squirrelmail/squirrelmail/class/mime
In directory sc8-pr-cvs1:/tmp/cvs-serv14131

Modified Files:
      Tag: SM-1_4-STABLE
	Rfc822Header.class.php 
Log Message:
fixed warning



Index: Rfc822Header.class.php
===================================================================
RCS file: /cvsroot/squirrelmail/squirrelmail/class/mime/Rfc822Header.class.php,v
retrieving revision 1.17.2.7
retrieving revision 1.17.2.8
diff -u -w -r1.17.2.7 -r1.17.2.8
--- Rfc822Header.class.php	29 Jun 2003 03:33:09 -0000	1.17.2.7
+++ Rfc822Header.class.php	29 Jun 2003 11:41:34 -0000	1.17.2.8
@@ -293,7 +293,7 @@
                 // check the next token in case comments appear in the middle of email addresses
                 $prevToken = end($aTokens);
                 if (!in_array($prevToken,$aSpecials,true)) {
-                    if (isset($address{$i+1}) && !in_array($address{$i+1},$aSpecials,true)) {
+                    if ($i+1<strlen($address) && !in_array($address{$i+1},$aSpecials,true)) {
                         $iEnd = strpos($address,' ',$i+1);
                         if ($iEnd) {
                             $sNextToken = trim(substr($address,$i+1,$iEnd - $i -1));
@@ -504,6 +504,38 @@
         $this->content_type = $content_type;
     }
 
+    /* RFC2184 */
+    function processParameters($aParameters) { 
+        $aResults = array();
+	$aCharset = array();
+	// handle multiline parameters
+        foreach($aParameters as $key => $value) {
+	    if ($iPos = strpos($key,'*')) {
+	        $sKey = substr($key,0,$iPos);
+		if (!isset($aResults[$sKey])) {
+		    $aResults[$sKey] = $value;
+		    if (substr($key,-1) == '*') { // parameter contains language/charset info
+		        $aCharset[] = $sKey;
+		    }
+	        } else {
+		    $aResults[$sKey] .= $value;
+		}
+	    }
+        }
+	foreach ($aCharset as $key) {
+	    $value = $aResults[$key];
+	    // extract the charset & language
+	    $charset = substr($value,0,strpos($value,"'"));
+	    $value = substr($value,strlen($charset)+1);
+	    $language = substr($value,0,strpos($value,"'"));
+	    $value = substr($value,strlen($charset)+1);
+	    // FIX ME What's the status of charset decode with language information ????
+	    $value = charset_decode($charset,$value);
+	    $aResults[$key] = $value;
+	}
+	return $aResults;    
+    }
+
     function parseProperties($value) {
         $propArray = explode(';', $value);
         $propResultArray = array();
@@ -519,7 +551,7 @@
                 $propResultArray[$key] = $val;
             }
         }
-        return $propResultArray;
+        return $this->processParameters($propResultArray);
     }
 
     function parseDisposition($value) {



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic