Keep line breaks in the new-submission email.

This commit is contained in:
tim
2026-09-25 22:12:00 +02:00
parent 601df8a9be
commit 94db52e20d
+8 -2
View File
@@ -265,8 +265,14 @@ function send_email($title, $author, $story) {
$subject = "New submission: $title"; $subject = "New submission: $title";
$headers = 'From: x.x.x Queue <editor@xxx.org.za>'."\r\n"; $headers = 'From: x.x.x Queue <editor@xxx.org.za>'."\r\n";
$message = "Please review the queue. $author has sent the following new submission:\n\n"; $message = "Please review the queue. $author has sent the following new submission:\n\n";
if ($story) if ($story) {
$message .= wordwrap(preg_replace("#(<br.?/?>|</p>)#", "\n", strip_tags(html_entity_decode_full($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("#<br\s*/?>#i", "#</p>#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 else
$message .= "<Submission is an image. Review on the site.>"; $message .= "<Submission is an image. Review on the site.>";
$message .= "\n\nhttp://xxx.org.za/publish/edit"; $message .= "\n\nhttp://xxx.org.za/publish/edit";