| | |
| | | if (!is_array($COMPOSE)) { |
| | | // Infinite redirect prevention in case of broken session (#1487028) |
| | | if ($COMPOSE_ID) { |
| | | rcube::raise_error(array('code' => 500, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Invalid compose ID"), true, true); |
| | | // if we know the message with specified ID was already sent |
| | | // we can ignore the error and compose a new message (#1490009) |
| | | if ($COMPOSE_ID != $_SESSION['last_compose_session']) { |
| | | rcube::raise_error(array('code' => 450), false, true); |
| | | } |
| | | } |
| | | |
| | | $COMPOSE_ID = uniqid(mt_rand()); |
| | |
| | | $fvalue .= (!empty($fvalue) ? $separator : '') . $v; |
| | | } |
| | | // Use Sender header (#1489011) |
| | | if (($v = $MESSAGE->headers->get('Sender', false)) && strpos($v, '-bounces@') === false) { |
| | | $fvalue .= (!empty($fvalue) ? $separator : '') . $v; |
| | | if ($v = $MESSAGE->headers->get('Sender', false)) { |
| | | // Skip common mailing lists addresses: *-bounces@ and *-request@ (#1490452) |
| | | if (empty($MESSAGE->headers->others['list-post']) || !preg_match('/-(bounces|request)@/', $v)) { |
| | | $fvalue .= (!empty($fvalue) ? $separator : '') . $v; |
| | | } |
| | | } |
| | | |
| | | // When To: and Reply-To: are the same we add From: address to the list (#1489037) |
| | |
| | | |
| | | function rcmail_compose_editor_mode() |
| | | { |
| | | global $RCMAIL; |
| | | global $RCMAIL, $COMPOSE; |
| | | static $useHtml; |
| | | |
| | | if ($useHtml !== null) { |
| | |
| | | if ($bodyIsHtml) { |
| | | $body = rcmail_wash_html($body, array('safe' => 1), $cid_map); |
| | | |
| | | // remove comments (produced by washtml) |
| | | $body = preg_replace('/<!--[^>]+-->/', '', $body); |
| | | // cleanup |
| | | $body = preg_replace(array( |
| | | // remove comments (produced by washtml) |
| | | '/<!--[^>]+-->/', |
| | | // remove <body> tags |
| | | '/<body([^>]*)>/i', |
| | | '/<\/body>/i', |
| | | // convert TinyMCE's empty-line sequence (#1490463) |
| | | '/<p>\xC2\xA0<\/p>/', |
| | | ), |
| | | array( |
| | | '', |
| | | '', |
| | | '', |
| | | '<p><br /></p>', |
| | | ), |
| | | $body |
| | | ); |
| | | |
| | | // replace cid with href in inline images links |
| | | if (!empty($cid_map)) { |