| | |
| | | { |
| | | // check all message parts |
| | | foreach ($this->mime_parts as $part) { |
| | | if (!$this->check_context($part)) { |
| | | continue; |
| | | } |
| | | |
| | | if ($part->mimetype == 'text/html' || ($enriched && $part->mimetype == 'text/enriched')) { |
| | | // Skip if part is an attachment, don't use is_attachment() here |
| | | if ($part->filename) { |
| | | continue; |
| | | } |
| | | |
| | | if (!$part->size) { |
| | | continue; |
| | | } |
| | | |
| | | if (!$this->check_context($part)) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | $parent = $this->mime_parts[join('.', $level)]; |
| | | $max_delta = $depth - (1 + ($last == 'multipart/alternative' ? 1 : 0)); |
| | | $last = $parent->mimetype; |
| | | $parent = $this->mime_parts[join('.', $level)]; |
| | | |
| | | if (!preg_match('/^multipart\/(alternative|related|signed|encrypted|mixed)$/', $parent->mimetype) |
| | | || ($parent->mimetype == 'multipart/mixed' && $parent_depth < $max_delta)) { |
| | | if (!$this->check_context($parent)) { |
| | | return true; |
| | | } |
| | | |
| | | $max_delta = $depth - (1 + ($last == 'multipart/alternative' ? 1 : 0)); |
| | | $last = $parent->real_mimetype ?: $parent->mimetype; |
| | | |
| | | if (!preg_match('/^multipart\/(alternative|related|signed|encrypted|mixed)$/', $last) |
| | | || ($last == 'multipart/mixed' && $parent_depth < $max_delta)) { |
| | | continue 2; |
| | | } |
| | | } |
| | | |
| | | if ($part->size) { |
| | | return true; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (!$part->size) { |
| | | continue; |
| | | } |
| | | |
| | | if (!$this->check_context($part)) { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | |
| | | $parent = $this->mime_parts[join('.', $level)]; |
| | | |
| | | if (!$this->check_context($parent)) { |
| | | return true; |
| | | } |
| | | |
| | | if ($parent->mimetype != 'multipart/alternative' && $parent->mimetype != 'multipart/related') { |
| | | continue 2; |
| | | } |
| | | } |
| | | |
| | | if ($part->size) { |
| | | return true; |
| | | } |
| | | return true; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * Return message parts in current context |
| | | */ |
| | | public function mime_parts() |
| | | { |
| | | if ($this->context === null) { |
| | | return $this->mime_parts; |
| | | } |
| | | |
| | | $parts = array(); |
| | | |
| | | foreach ($this->mime_parts as $part_id => $part) { |
| | | if ($this->check_context($part)) { |
| | | $parts[$part_id] = $part; |
| | | } |
| | | } |
| | | |
| | | return $parts; |
| | | } |
| | | |
| | | /** |
| | | * Checks if part of the message is an attachment (or part of it) |
| | | * |
| | | * @param rcube_message_part $part Message part |