Mercurial > hg > rc2
comparison program/steps/mail/func.inc @ 22:303b85d5b561
More cleaning up php8 Warnings/deprecations
| author | Charlie Root |
|---|---|
| date | Wed, 15 Oct 2025 14:06:27 -0400 |
| parents | 73124dd49283 |
| children |
comparison
equal
deleted
inserted
replaced
| 21:73124dd49283 | 22:303b85d5b561 |
|---|---|
| 888 $wash_opts['html_attribs'] = $p['html_attribs']; | 888 $wash_opts['html_attribs'] = $p['html_attribs']; |
| 889 | 889 |
| 890 // initialize HTML washer | 890 // initialize HTML washer |
| 891 $washer = new rcube_washtml($wash_opts); | 891 $washer = new rcube_washtml($wash_opts); |
| 892 | 892 |
| 893 if (!$p['skip_washer_form_callback']) { | 893 if (empty($p['skip_washer_form_callback'])) { |
| 894 $washer->add_callback('form', 'rcmail_washtml_callback'); | 894 $washer->add_callback('form', 'rcmail_washtml_callback'); |
| 895 } | 895 } |
| 896 | 896 |
| 897 // allow CSS styles, will be sanitized by rcmail_washtml_callback() | 897 // allow CSS styles, will be sanitized by rcmail_washtml_callback() |
| 898 if (!$p['skip_washer_style_callback']) { | 898 if (empty($p['skip_washer_style_callback'])) { |
| 899 $washer->add_callback('style', 'rcmail_washtml_callback'); | 899 $washer->add_callback('style', 'rcmail_washtml_callback'); |
| 900 } | 900 } |
| 901 | 901 |
| 902 // modify HTML links to open a new window if clicked | 902 // modify HTML links to open a new window if clicked |
| 903 if (!$p['skip_washer_link_callback']) { | 903 if (empty($p['skip_washer_link_callback'])) { |
| 904 $washer->add_callback('a', 'rcmail_washtml_link_callback'); | 904 $washer->add_callback('a', 'rcmail_washtml_link_callback'); |
| 905 $washer->add_callback('area', 'rcmail_washtml_link_callback'); | 905 $washer->add_callback('area', 'rcmail_washtml_link_callback'); |
| 906 | 906 |
| 907 if ($p['safe']) | 907 if ($p['safe']) |
| 908 $washer->add_callback('link', 'rcmail_washtml_link_callback'); | 908 $washer->add_callback('link', 'rcmail_washtml_link_callback'); |
| 1534 if (!empty($style)) { | 1534 if (!empty($style)) { |
| 1535 $body = preg_replace($regexp, rtrim($attrs), $body, 1); | 1535 $body = preg_replace($regexp, rtrim($attrs), $body, 1); |
| 1536 } | 1536 } |
| 1537 | 1537 |
| 1538 // handle body styles related to background image | 1538 // handle body styles related to background image |
| 1539 if ($style['background-image']) { | 1539 if (!empty($style['background-image'])) { |
| 1540 // get body style | 1540 // get body style |
| 1541 if (preg_match('/#'.preg_quote($cont_id, '/').'\s+\{([^}]+)}/i', $body, $m)) { | 1541 if (preg_match('/#'.preg_quote($cont_id, '/').'\s+\{([^}]+)}/i', $body, $m)) { |
| 1542 // get background related style | 1542 // get background related style |
| 1543 $regexp = '/(background-position|background-repeat)\s*:\s*([^;]+);/i'; | 1543 $regexp = '/(background-position|background-repeat)\s*:\s*([^;]+);/i'; |
| 1544 if (preg_match_all($regexp, $m[1], $matches, PREG_SET_ORDER)) { | 1544 if (preg_match_all($regexp, $m[1], $matches, PREG_SET_ORDER)) { |
| 1585 $_SESSION['modcssurls'][$tempurl] = $attrib['href']; | 1585 $_SESSION['modcssurls'][$tempurl] = $attrib['href']; |
| 1586 $attrib['href'] = $RCMAIL->url(array('task' => 'utils', 'action' => 'modcss', 'u' => $tempurl, 'c' => $GLOBALS['rcmail_html_container_id'])); | 1586 $attrib['href'] = $RCMAIL->url(array('task' => 'utils', 'action' => 'modcss', 'u' => $tempurl, 'c' => $GLOBALS['rcmail_html_container_id'])); |
| 1587 $end = ' />'; | 1587 $end = ' />'; |
| 1588 } | 1588 } |
| 1589 else if (preg_match('/^mailto:(.+)/i', $attrib['href'], $mailto)) { | 1589 else if (preg_match('/^mailto:(.+)/i', $attrib['href'], $mailto)) { |
| 1590 list($mailto, $url) = explode('?', html_entity_decode($mailto[1], ENT_QUOTES, 'UTF-8'), 2); | 1590 $url_parts = explode('?', html_entity_decode($mailto[1], ENT_QUOTES, 'UTF-8'), 2); |
| 1591 $mailto = $url_parts[0]; | |
| 1592 $url = $url_parts[1] ?? ''; | |
| 1591 | 1593 |
| 1592 // #6020: use raw encoding for correct "+" character handling as specified in RFC6068 | 1594 // #6020: use raw encoding for correct "+" character handling as specified in RFC6068 |
| 1593 $url = rawurldecode($url); | 1595 $url = rawurldecode($url??''); |
| 1594 $mailto = rawurldecode($mailto); | 1596 $mailto = rawurldecode($mailto??''); |
| 1595 $addresses = rcube_mime::decode_address_list($mailto, null, true); | 1597 $addresses = rcube_mime::decode_address_list($mailto, null, true); |
| 1596 $mailto = array(); | 1598 $mailto = array(); |
| 1597 | 1599 |
| 1598 // do sanity checks on recipients | 1600 // do sanity checks on recipients |
| 1599 foreach ($addresses as $idx => $addr) { | 1601 foreach ($addresses as $idx => $addr) { |
| 2048 'image/x-ms-bmp' => 'image/bmp', // #1490282 | 2050 'image/x-ms-bmp' => 'image/bmp', // #1490282 |
| 2049 ); | 2051 ); |
| 2050 | 2052 |
| 2051 $name = strtolower($name); | 2053 $name = strtolower($name); |
| 2052 | 2054 |
| 2053 if ($alias = $map[$name]) { | 2055 if ($alias = ($map[$name]??null)) { |
| 2054 $name = $alias; | 2056 $name = $alias; |
| 2055 } | 2057 } |
| 2056 // Some versions of Outlook create garbage Content-Type: | 2058 // Some versions of Outlook create garbage Content-Type: |
| 2057 // application/pdf.A520491B_3BF7_494D_8855_7FAC2C6C0608 | 2059 // application/pdf.A520491B_3BF7_494D_8855_7FAC2C6C0608 |
| 2058 else if (preg_match('/^application\/pdf.+/', $name)) { | 2060 else if (preg_match('/^application\/pdf.+/', $name)) { |
