fixed warning
[squirrelmail.git] / functions / mime.php
index c91ea398b8f8054d433cd442030b7b016363738f..f07d5760d111ea057d6bc2e956e13d7d440737c3 100644 (file)
@@ -407,23 +407,34 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
                 $from_name = _("Unknown sender");
             }
             $from_name = decodeHeader(htmlspecialchars($from_name));
+           $description = $from_name;
         } else {
             $default_page = '../src/download.php';
-            $filename = decodeHeader($header->getParameter('filename'));
-            if (trim($filename) == '') {
-                $name = decodeHeader($header->getParameter('name'));
-                if (trim($name) == '') {
-                    if ( trim( $header->id ) == '' )
+           if (is_object($header->disposition)) {
+               $filename = decodeHeader($header->disposition->getProperty('filename'));
+               if (trim($filename) == '') {
+                  $name = decodeHeader($header->disposition->getProperty('name'));
+                  if (trim($name) == '') {
+                     if ( trim( $header->id ) == '' )
                         $filename = 'untitled-[' . $ent . ']' ;
-                    else
+                     else
                         $filename = 'cid: ' . $header->id;
-                } else {
-                    $filename = $name;
-                }
-            }
-            if ($message->header->description) {
-                $from_name = htmlspecialchars(_($header->description));
-            }
+                  } else {
+                     $filename = $name;
+                  }
+               }
+           } else {
+              if ( trim( $header->id ) == '' )
+                  $filename = 'untitled-[' . $ent . ']' ;
+               else
+                  $filename = 'cid: ' . $header->id;
+           }
+
+            if ($header->description) {
+                $description = htmlspecialchars($header->description);
+            } else {
+               $description = '';
+           }
         }
 
         $display_filename = $filename;
@@ -454,7 +465,7 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
                         '</b>&nbsp;&nbsp;</small></TD>' .
                         "<TD><SMALL>[ $type0/$type1 ]&nbsp;</SMALL></TD>" .
                         '<TD><SMALL>';
-        $attachments .= '<b>' . $from_name . '</b>';
+        $attachments .= '<b>' . $description . '</b>';
         $attachments .= '</SMALL></TD><TD><SMALL>&nbsp;';
 
         $SkipSpaces = 1;