2.10.10: Using [SIGNATURE] placeholder shows signature twice

Discuss, research, share, find, and solve bugs

2.10.10: Using [SIGNATURE] placeholder shows signature twice

Postby tipichris » 8:36pm, Sun 07 Jun, 2009

This has got me stumped.

I've tried including a [SIGNATURE] placeholder in a template. The signature is added as expected, but a second signature is appended to the message as well. Looking at the code for sendEmail in lists/admin/sendemaillib.php, it looks as if this isn't what's supposed to happen. The sig is only appended if the [SIGNATURE] place holder wasn't found.

What seems to be happening is that [SIGNATURE] is getting replace with the sig first, elsewhere. So when sendEmail checks for the string [SIGNATURE], it isn't there, and the sig is then appended. But I can't for the life of me work out where the initial replacement is taking place. Any clues?

An additional issue is that the default appending of the signature is not smart. My templates include the whole the html, from <html> to </html>. The signature is being appended, along with an extra <br />, after the closing </html> tag.
tipichris
phpLister
 
Posts: 11
Joined: 9:03pm, Wed 03 Jun, 2009

Re: Using the [SIGNATURE] place holder inserts signature twice

Postby H2B2 » 12:20am, Tue 09 Jun, 2009

tipichris wrote: But I can't for the life of me work out where the initial replacement is taking place. Any clues?
Not sure. Have you looked at lib.php, around line 400 ?
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: Using the [SIGNATURE] place holder inserts signature twice

Postby tipichris » 8:15am, Tue 09 Jun, 2009

I've checked there. Doesn't seem to be the source (and I couldn't work out why previewTemplate would be called when sending anyway). grep -r "SIGNATURE" lists doesn't give me any clues either; it's that, around line 300ish in sendemaillib.php or various bits of documentation

Wouldn't be so bad if the default behaviour didn't make such a mess of attaching the signature - appending it after the closing </html> tag. Is there a reason why the same addHTMLFooter() function used footers isn't used, to place it just before the closing </body> tag?
tipichris
phpLister
 
Posts: 11
Joined: 9:03pm, Wed 03 Jun, 2009

Re: Using the [SIGNATURE] place holder inserts signature twice

Postby tipichris » 8:43pm, Tue 09 Jun, 2009

Found it. It's in the 'foreach' block around line 242 of sendemaillib.php.

Just after that is a commented out bit:

Code: Select all
//      unset($html[$item]); //ASK: Why was this done? It breaks placeholders in the footer


I suspect the answer is to stop the signature from getting added twice :)

I've added a mantis report
http://mantis.phplist.com/view.php?id=15303

with this patch
Code: Select all
--- lists/admin/sendemaillib.php.orig   Sun May 31 21:58:10 2009
+++ lists/admin/sendemaillib.php        Tue Jun  9 20:28:03 2009
@@ -239,7 +239,7 @@

 ## Parse placeholders
   #0013076: Blacklisting posibility for unknown users
-  foreach (array("forwardform","subscribe","preferences","unsubscribe","signature", 'blacklist') as $item) {
+  foreach (array("forwardform","subscribe","preferences","unsubscribe", 'blacklist') as $item) {
     if (eregi('\['.$item.'\]',$htmlmessage,$regs)) {
       $htmlmessage = eregi_replace('\['.$item.'\]',$html[$item],$htmlmessage);
 //      unset($html[$item]); //ASK: Why was this done? It breaks placeholders in the footer
@@ -301,7 +301,7 @@
   if (eregi("\[SIGNATURE\]",$htmlmessage))
     $htmlmessage = eregi_replace("\[SIGNATURE\]",$html["signature"],$htmlmessage);
   elseif ($html["signature"])
-    $htmlmessage .= '<br />'.$html["signature"];
+    $htmlmessage = addHTMLFooter($htmlmessage, '<br />'. $html["signature"]);
   if (eregi("\[FOOTER\]",$textmessage))
     $textmessage = eregi_replace("\[FOOTER\]",$text["footer"],$textmessage);
   else
tipichris
phpLister
 
Posts: 11
Joined: 9:03pm, Wed 03 Jun, 2009

Re: Using the [SIGNATURE] place holder inserts signature twice

Postby H2B2 » 10:35pm, Tue 09 Jun, 2009

Nice find!

I'll move this thread to the bug discussion section.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: Using the [SIGNATURE] place holder inserts signature twice

Postby cmacsound » 4:27am, Wed 08 Jul, 2009

i applied the patch, but im still getting the same results - two footers appear at the bottom of messages when using a template - any way to override one of them?
cmacsound
phpList newbie
 
Posts: 1
Joined: 2:55am, Wed 08 Jul, 2009

Re: Using the [SIGNATURE] place holder inserts signature twice

Postby H2B2 » 5:09pm, Sun 30 Aug, 2009

cmacsound wrote:i applied the patch, but im still getting the same results - two footers appear at the bottom of messages when using a template - any way to override one of them?
A signature and a footer are two different things. For the footer, please see other threads, like this one for instance: viewtopic.php?p=46756
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: Using the [SIGNATURE] place holder inserts signature twice

Postby H2B2 » 5:16pm, Sun 30 Aug, 2009

tipichris wrote:I've added a mantis report
http://mantis.phplist.com/view.php?id=15303

with this patch
Code: Select all
--- lists/admin/sendemaillib.php.orig   Sun May 31 21:58:10 2009
+++ lists/admin/sendemaillib.php        Tue Jun  9 20:28:03 2009
@@ -239,7 +239,7 @@

 ## Parse placeholders
   #0013076: Blacklisting posibility for unknown users
-  foreach (array("forwardform","subscribe","preferences","unsubscribe","signature", 'blacklist') as $item) {
+  foreach (array("forwardform","subscribe","preferences","unsubscribe", 'blacklist') as $item) {
     if (eregi('\['.$item.'\]',$htmlmessage,$regs)) {
       $htmlmessage = eregi_replace('\['.$item.'\]',$html[$item],$htmlmessage);
 //      unset($html[$item]); //ASK: Why was this done? It breaks placeholders in the footer
@@ -301,7 +301,7 @@
   if (eregi("\[SIGNATURE\]",$htmlmessage))
     $htmlmessage = eregi_replace("\[SIGNATURE\]",$html["signature"],$htmlmessage);
   elseif ($html["signature"])
-    $htmlmessage .= '<br />'.$html["signature"];
+    $htmlmessage = addHTMLFooter($htmlmessage, '<br />'. $html["signature"]);
   if (eregi("\[FOOTER\]",$textmessage))
     $textmessage = eregi_replace("\[FOOTER\]",$text["footer"],$textmessage);
   else


I can confirm that the above patch solves the issue of an additional signature in the footer.
The patch has been included in the lists/admin/sendemaillib.php file attached here:
Attachments
sendemaillib.zip
patched file: lists/admin/sendemaillib.php
for v2.10.10
(11.87 KiB) Downloaded 587 times
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: 2.10.10: Using [SIGNATURE] placeholder shows signature twice

Postby H2B2 » 9:54pm, Thu 15 Apr, 2010

Fixed in v2.10.11
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006


Return to Bug Discussion

Who is online

Users browsing this forum: No registered users and 2 guests