fix for displaying attachment names
[squirrelmail.git] / functions / mime.php
index e8b7664f30fc0a2de88776af36e110f1b66a79cd..8717a5b639d4015abf09ff98a8306756f56271ba 100644 (file)
@@ -57,8 +57,8 @@ function mime_structure ($bodystructure, $flags=array()) {
               }
               break;
             case 'M':
-              if (strtolower($flag) == '\$mdnsent') {
-                 $msg->is_mdn = true;
+              if (strtolower($flag) == '$mdnsent') {
+                 $msg->is_mdnsent = true;
               }
               break;
             default:
@@ -211,6 +211,33 @@ function listEntities ($message) {
   } 
 }
 
+function getPriorityStr($priority) {
+   $priority_level = substr($priority,0,1);
+
+   switch($priority_level) {
+     /* check for a higher then normal priority. */
+     case '1':
+     case '2':
+        $priority_string = _("High");
+        break;
+
+      /* check for a lower then normal priority. */
+     case '4':
+     case '5':
+        $priority_string = _("Low");
+        break;
+
+     /* check for a normal priority. */
+     case '3':
+     default:
+        $priority_level = '3';
+        $priority_string = _("Normal");
+        break;
+
+   }
+   return $priority_string;
+}
+
 /* returns a $message object for a particular entity id */
 function getEntity ($message, $ent_id) {
     return $message->getEntity($ent_id);
@@ -381,7 +408,7 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
                         "<TD><SMALL>[ $type0/$type1 ]&nbsp;</SMALL></TD>" .
                         '<TD><SMALL>';
            $from_o = $header->from;
-           if (isset($from_o)) {
+           if (is_object($from_o)) {
                $from_name = $from_o->getAddress(false);
            } else {
                $from_name = _("Unknown sender");
@@ -403,6 +430,7 @@ function formatAttachments($message, $exclude_id, $mailbox, $id) {
         } else {
             $filename = decodeHeader($header->filename);
             if (trim($filename) == '') {
+               $name = decodeHeader($header->name);
                 if (trim($name) == '') {
                     if ( trim( $header->id ) == '' )
                         $display_filename = 'untitled-[' . $ent . ']' ;