This commit has been accessed 564 times via Git panel.
commit 5affc2b2cbef276abaca121ee8fb529e6da93453
tree 7cdd1f5b7867c117d4cdbd2debced5072b2ca843
parent f95c8dc5b392042fdc9e4bf94b7fba7d4e875c8d
author Engels Antonio <engels@majcms.org> 1340375064 +0800
committer Engels Antonio <engels@majcms.org> 1340375064 +0800
Improve multiple Re: and Fwd: cleanup
diff --git a/send.php b/send.php
index e4c50ff..dbaa4d9 100644
--- a/send.php
+++ b/send.php
@@ -59,6 +59,9 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_subject = $header->subject;
+ $reply_subject = str_replace("FWD: ","Fwd: ",$reply_subject);
+ $reply_subject = str_replace("RE: ","Re: ",$reply_subject);
+
if (($_POST['rep'] == 2) or ($_POST['rep'] == 4)) {
$redirect_from = htmlentities($reply_to,ENT_QUOTES);
@@ -69,11 +72,25 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_subject = "Fwd: " . $reply_subject;
}
- $reply_subject = str_replace("Fwd: Fwd: ","Fwd: ",$reply_subject);
+
}
else {
$reply_subject = "Re: " . $reply_subject;
- $reply_subject = str_replace("Re: Re: ","Re: ",$reply_subject);
+
+ }
+
+ if (substr_count($reply_subject, "Fwd: ") > 1) {
+
+ while (substr_count($reply_subject, "Fwd: ") > 1) {
+ $reply_subject = substr_replace($reply_subject,"",strrpos($reply_subject,"Fwd: "),5);
+ }
+ }
+
+ if (substr_count($reply_subject, "Re: ") > 1) {
+
+ while (substr_count($reply_subject, "Re: ") > 1) {
+ $reply_subject = substr_replace($reply_subject,"",strrpos($reply_subject,"Re: "),4);
+ }
}
$reply_from = htmlentities($reply_from,ENT_QUOTES);
tree 7cdd1f5b7867c117d4cdbd2debced5072b2ca843
parent f95c8dc5b392042fdc9e4bf94b7fba7d4e875c8d
author Engels Antonio <engels@majcms.org> 1340375064 +0800
committer Engels Antonio <engels@majcms.org> 1340375064 +0800
Improve multiple Re: and Fwd: cleanup
diff --git a/send.php b/send.php
index e4c50ff..dbaa4d9 100644
--- a/send.php
+++ b/send.php
@@ -59,6 +59,9 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_subject = $header->subject;
+ $reply_subject = str_replace("FWD: ","Fwd: ",$reply_subject);
+ $reply_subject = str_replace("RE: ","Re: ",$reply_subject);
+
if (($_POST['rep'] == 2) or ($_POST['rep'] == 4)) {
$redirect_from = htmlentities($reply_to,ENT_QUOTES);
@@ -69,11 +72,25 @@ if (isset($_POST['msg']) and !empty($_POST['msg']) and is_numeric($_POST['msg'])
$reply_subject = "Fwd: " . $reply_subject;
}
- $reply_subject = str_replace("Fwd: Fwd: ","Fwd: ",$reply_subject);
+
}
else {
$reply_subject = "Re: " . $reply_subject;
- $reply_subject = str_replace("Re: Re: ","Re: ",$reply_subject);
+
+ }
+
+ if (substr_count($reply_subject, "Fwd: ") > 1) {
+
+ while (substr_count($reply_subject, "Fwd: ") > 1) {
+ $reply_subject = substr_replace($reply_subject,"",strrpos($reply_subject,"Fwd: "),5);
+ }
+ }
+
+ if (substr_count($reply_subject, "Re: ") > 1) {
+
+ while (substr_count($reply_subject, "Re: ") > 1) {
+ $reply_subject = substr_replace($reply_subject,"",strrpos($reply_subject,"Re: "),4);
+ }
}
$reply_from = htmlentities($reply_from,ENT_QUOTES);