comparison program/lib/Roundcube/rcube_message.php @ 25:bea5a38be938

More cleaning up php8 Warnings/deprecations
author Charlie Root
date Sat, 18 Oct 2025 12:24:31 -0400
parents e53add5ddac5
children c32b53434b47
comparison
equal deleted inserted replaced
24:e53add5ddac5 25:bea5a38be938
44 /** 44 /**
45 * Instance of mime class 45 * Instance of mime class
46 * 46 *
47 * @var rcube_mime 47 * @var rcube_mime
48 */ 48 */
49 private $mime; 49 protected $mime;
50 private $opt = array(); 50
51 private $parse_alternative = false; 51 protected $opt = [];
52 protected $parse_alternative = false;
53 protected $got_html_part = false;
54 protected $tnef_decode = false;
52 55
53 public $uid; 56 public $uid;
54 public $folder; 57 public $folder;
55 public $headers; 58 public $headers;
56 public $sender; 59 public $sender;
306 if (strpos($body, "\x00") !== false) { 309 if (strpos($body, "\x00") !== false) {
307 $body = str_replace("\x00", '', $body); 310 $body = str_replace("\x00", '', $body);
308 } 311 }
309 312
310 // detect charset... 313 // detect charset...
311 if (!$part->charset || strtoupper($part->charset) == 'US-ASCII') { 314 if (empty($part->charset) || strtoupper($part->charset) == 'US-ASCII') {
312 // try to extract charset information from HTML meta tag (#1488125) 315 // try to extract charset information from HTML meta tag (#1488125)
313 if ($part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9-_]+)/i', $body, $m)) { 316 if ($part->ctype_secondary == 'html' && preg_match('/<meta[^>]+charset=([a-z0-9-_]+)/i', $body, $m)) {
314 $part->charset = strtoupper($m[1]); 317 $part->charset = strtoupper($m[1]);
315 } 318 }
316 else if ($default_charset) { 319 else if ($default_charset) {
345 // Skip if part is an attachment, don't use is_attachment() here 348 // Skip if part is an attachment, don't use is_attachment() here
346 if ($part->filename) { 349 if ($part->filename) {
347 continue; 350 continue;
348 } 351 }
349 352
350 if (!$part->size) { 353 if (empty($part->size)) {
351 continue; 354 continue;
352 } 355 }
353 356
354 if (!$this->check_context($part)) { 357 if (!$this->check_context($part)) {
355 continue; 358 continue;
657 // others as attachments (#1489358) 660 // others as attachments (#1489358)
658 661
659 // check if sub part is 662 // check if sub part is
660 if ($is_multipart) 663 if ($is_multipart)
661 $related_part = $p; 664 $related_part = $p;
662 else if ($sub_mimetype == 'text/plain' && !$plain_part) 665 else if ($sub_mimetype == 'text/plain' && empty($plain_part))
663 $plain_part = $p; 666 $plain_part = $p;
664 else if ($sub_mimetype == 'text/html' && !$html_part) { 667 else if ($sub_mimetype == 'text/html' && empty($html_part)) {
665 $html_part = $p; 668 $html_part = $p;
666 $this->got_html_part = true; 669 $this->got_html_part = true;
667 } 670 }
668 else if ($sub_mimetype == 'text/enriched' && !$enriched_part) 671 else if ($sub_mimetype == 'text/enriched' && empty($enriched_part))
669 $enriched_part = $p; 672 $enriched_part = $p;
670 else { 673 else {
671 // add unsupported/unrecognized parts to attachments list 674 // add unsupported/unrecognized parts to attachments list
672 $this->add_part($sub_part, 'attachment'); 675 $this->add_part($sub_part, 'attachment');
673 } 676 }
843 if (preg_match('/^multipart\/(related|relative)/', $mimetype) 846 if (preg_match('/^multipart\/(related|relative)/', $mimetype)
844 && ($mail_part->headers['content-id'] || $mail_part->headers['content-location']) 847 && ($mail_part->headers['content-id'] || $mail_part->headers['content-location'])
845 ) { 848 ) {
846 if ($mail_part->headers['content-id']) 849 if ($mail_part->headers['content-id'])
847 $mail_part->content_id = preg_replace(array('/^</', '/>$/'), '', $mail_part->headers['content-id']); 850 $mail_part->content_id = preg_replace(array('/^</', '/>$/'), '', $mail_part->headers['content-id']);
848 if (!isempty($mail_part->headers['content-location'])) 851 if (!empty($mail_part->headers['content-location']))
849 $mail_part->content_location = $mail_part->headers['content-base'] . $mail_part->headers['content-location']; 852 $mail_part->content_location = $mail_part->headers['content-base'] . $mail_part->headers['content-location'];
850 853
851 $this->add_part($mail_part, 'inline'); 854 $this->add_part($mail_part, 'inline');
852 } 855 }
853 // regular attachment with valid content type 856 // regular attachment with valid content type