- for ($i = 0; $i < count($msgs); $i++)
- {
- $msg = $msgs[$i];
- if (count($msg->entities) == 0)
- {
- $entity[] = $msg->entity_id;
- } else
- {
- $entity = $msg->findDisplayEntity($entity,$alt_order);
- }
- $found = true;
- }
- } else if ( $this->type0 == 'text' &&
- ( $this->type1 == 'plain' ||
- $this->type1 == 'html' ||
- $this->type1 == 'message') &&
- isset($this->entity_id) )
- {
- if (count($this->entities) == 0)
- {
- if (strtolower($this->header->disposition->name) != 'attachment')
- {
- $entity[] = $this->entity_id;
- }
- }
- }
- $i = 0;
- while ( isset($this->entities[$i]) && !$found &&
- (strtolower($this->entities[$i]->header->disposition->name)
- != 'attachment') &&
- ($this->entities[$i]->type0 != 'message' &&
- $this->entities[$i]->type1 != 'rfc822' )
- )
- {
- $entity = $this->entities[$i]->findDisplayEntity($entity, $alt_order);
- $i++;
- }
- return( $entity );
+ foreach ($msgs as $msg)
+ {
+ if (count($msg->entities) == 0)
+ {
+ $entity[] = $msg->entity_id;
+ } else
+ {
+ $entity = $msg->findDisplayEntity($entity,$alt_order);
+ }
+ }
+ if (count($msgs) > 0) {
+ $found = true;
+ }
+ } else if ($this->type0 == 'text' &&
+ ($this->type1 == 'plain' ||
+ $this->type1 == 'html' ||
+ $this->type1 == 'message') &&
+ isset($this->entity_id) )
+ {
+ if (count($this->entities) == 0)
+ {
+ if (strtolower($this->header->disposition->name) != 'attachment')
+ {
+ $entity[] = $this->entity_id;
+ }
+ }
+ }
+ $i = 0;
+ if(!$found) {
+ foreach ($this->entities as $ent) {
+ if(strtolower($ent->header->disposition->name) != 'attachment' &&
+ ($ent->type0 != 'message' && $ent->type1 != 'rfc822'))
+ {
+ $entity = $ent->findDisplayEntity($entity, $alt_order);
+ }
+ }
+ }
+ /*
+ while ( isset($this->entities[$i]) && !$found &&
+ (strtolower($this->entities[$i]->header->disposition->name)
+ != 'attachment') &&
+ ($this->entities[$i]->type0 != 'message' &&
+ $this->entities[$i]->type1 != 'rfc822' )
+ )
+ {
+ $entity = $this->entities[$i]->findDisplayEntity($entity, $alt_order);
+ $i++;
+ }
+ */
+ return( $entity );