Guestbook mail bug(s)
Posted: Fri Nov 17, 2006 7:56 am
Hi!
I am using the Guestbook plugin (version 2.1) and have had problems with notifying admin with email on the guestbook entries.
I just took a peek in the code and noticed this code segment.
I think I have found two error in it:
Error 1:
if (serendipity_db_bool($this->get_config('emailadmin'))) {
The error here is a missing ! which makes the guestbook send emails when email notification is turned off and I that was not the plan.
Error 2:
return @serendipity_sendMail($this->get_config('targetmail'), TEXT_EMAILSUBJECT, sprintf(TEXT_EMAILTEXT,$name, $homepage, $comment), $email);
The error here is an additional string to sprintf which makes the format of the mail incorrect. If you take a look in the lang-files you can see that it expects 2 strings to sprintf (not 3 as in the current code). So I guess this error is either fixed in php-code or in lang file.
The code should look like this:[/code]
I am using the Guestbook plugin (version 2.1) and have had problems with notifying admin with email on the guestbook entries.
I just took a peek in the code and noticed this code segment.
Code: Select all
if ($dbdone) {
/*if set, send an Email to the Admin $serendipity['email'] */
if (serendipity_db_bool($this->get_config('emailadmin'))) {
return false;
} elseif ($this->get_config('targetmail') != '') {
return @serendipity_sendMail($this->get_config('targetmail'), TEXT_EMAILSUBJECT, sprintf(TEXT_EMAILTEXT,$name, $homepage, $comment ), $email);
}
return true;
}
Error 1:
if (serendipity_db_bool($this->get_config('emailadmin'))) {
The error here is a missing ! which makes the guestbook send emails when email notification is turned off and I that was not the plan.
Error 2:
return @serendipity_sendMail($this->get_config('targetmail'), TEXT_EMAILSUBJECT, sprintf(TEXT_EMAILTEXT,$name, $homepage, $comment), $email);
The error here is an additional string to sprintf which makes the format of the mail incorrect. If you take a look in the lang-files you can see that it expects 2 strings to sprintf (not 3 as in the current code). So I guess this error is either fixed in php-code or in lang file.
The code should look like this:
Code: Select all
if ($dbdone) {
/*if set, send an Email to the Admin $serendipity['email'] */
if (!serendipity_db_bool($this->get_config('emailadmin'))) {
return false;
} elseif ($this->get_config('targetmail') != '') {
return @serendipity_sendMail($this->get_config('targetmail'), TEXT_EMAILSUBJECT, sprintf(TEXT_EMAILTEXT,$name, $comment), $email);
}
return true;
}