Pārlūkot izejas kodu

extra check for filename/name to achieve we do not show text/plain
attachments inline in case of a missing Disposition mime-header

stekkel 22 gadi atpakaļ
vecāks
revīzija
82c1c23345
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  1. 4 1
      class/mime/Message.class.php

+ 4 - 1
class/mime/Message.class.php

@@ -675,6 +675,8 @@ class Message {
             } else { /* Treat as multipart/mixed */
             } else { /* Treat as multipart/mixed */
                 foreach ($this->entities as $ent) {
                 foreach ($this->entities as $ent) {
                     if((strtolower($ent->header->disposition->name) != 'attachment') &&
                     if((strtolower($ent->header->disposition->name) != 'attachment') &&
+		        (!isset($ent->header->parameters['filename'])) &&
+			(!isset($ent->header->parameters['name'])) &&
                        (($ent->type0 != 'message') && ($ent->type1 != 'rfc822'))) {
                        (($ent->type0 != 'message') && ($ent->type1 != 'rfc822'))) {
                         $entity = $ent->findDisplayEntity($entity, $alt_order, $strict);
                         $entity = $ent->findDisplayEntity($entity, $alt_order, $strict);
                         $found = true;
                         $found = true;
@@ -687,6 +689,8 @@ class Message {
             foreach ($alt_order as $alt) {
             foreach ($alt_order as $alt) {
                 if( ($alt == $type) && isset($this->entity_id) ) {
                 if( ($alt == $type) && isset($this->entity_id) ) {
                     if ((count($this->entities) == 0) && 
                     if ((count($this->entities) == 0) && 
+		        (!isset($ent->header->parameters['filename'])) &&
+			(!isset($ent->header->parameters['name'])) &&
                         (strtolower($this->header->disposition->name) != 'attachment')) {
                         (strtolower($this->header->disposition->name) != 'attachment')) {
                         $entity[] = $this->entity_id;
                         $entity[] = $this->entity_id;
                         $found = true;
                         $found = true;
@@ -702,7 +706,6 @@ class Message {
                     $found = true;
                     $found = true;
                 }
                 }
             }
             }
-	    
         }
         }
         if(!$strict && !$found) {
         if(!$strict && !$found) {
             if (($this->type0 == 'text') &&
             if (($this->type0 == 'text') &&