Small bug in content-type properties, thanks Ryan (hairball57) for reporting.
[squirrelmail.git] / class / mime / Rfc822Header.class.php
index 7b37521670127c86dd6ce1d3fdcd9480920b6731..1326c6c538a353d7bbf2b8afbabe2aa624f472a6 100644 (file)
@@ -260,8 +260,9 @@ class Rfc822Header {
                 if (preg_match('/^(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)(.*)/Ui',substr($address,$pos),$reg)) {
                     $name .= $reg[1];
                     $pos += strlen($reg[1]);
+                } else {
+                    ++$pos;
                 }
-                ++$pos;
                 $addr_start = $pos;
                 $is_encoded = true;
                 break;
@@ -460,7 +461,11 @@ class Rfc822Header {
         } else if ($name == '') {
             $name = trim(substr($address, 0, $addr_start));
         }
-        if (!$name && $comment) $name = $comment;
+        if (!$name && $comment) {
+            $name = $comment;
+        } else if ($name && $comment) {
+            $name = $name .' ('.$comment.')';
+        }
         $at = strpos($addr, '@');
         $addr_structure = new AddressStructure();
         $addr_structure->group = $group;
@@ -519,7 +524,7 @@ class Rfc822Header {
         $props = '';
         if ($pos > 0) {
            $type = trim(substr($value, 0, $pos));
-           $props = trim(substr($type, $pos+1));
+           $props = trim(substr($value, $pos+1));
         } else {
            $type = $value;
         }