| | |
| | | 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()); |
| | |
| | | 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)) { |