diff --git a/publish/post.lib.php b/publish/post.lib.php index 2292a7e..99b2c73 100644 --- a/publish/post.lib.php +++ b/publish/post.lib.php @@ -265,8 +265,14 @@ function send_email($title, $author, $story) { $subject = "New submission: $title"; $headers = 'From: x.x.x Queue '."\r\n"; $message = "Please review the queue. $author has sent the following new submission:\n\n"; - if ($story) - $message .= wordwrap(preg_replace("#(|

)#", "\n", strip_tags(html_entity_decode_full($story)))); + if ($story) { + // Turn line and paragraph breaks into new lines before the tags are removed, + // and decode the entities last, so that a decoded "<" is not taken for a tag + $text = preg_replace(array("##i", "#

#i"), array("\n", "\n\n"), $story); + $text = html_entity_decode_full(strip_tags($text)); + $text = preg_replace("#\n{3,}#", "\n\n", trim($text)); + $message .= wordwrap($text); + } else $message .= ""; $message .= "\n\nhttp://xxx.org.za/publish/edit";