Hello,
I noticed Spamassassin module was removed from core Zenphoto package.
Never mind, I downloaded it.
Right now, I have one major error...
When a comment has to be rejected, I have the following error message:
Comment Error "3" not defined
I checked my code.
When the comment is considered as spam, I send a 0.
When it has to be moderated, I send a 1
When it's ok, I send a 2
I checked in zp-core/functions.php, zp-core/plugins/comment_form.php but I didn't find anything about this number 3.
Could someone provide me some tips on how to track down this error?
Here is the end of the (modified) code:
`
if ($isSpam === true) {
$forgive = getOption('SA_Forgiving');
return $forgive;
}
else {
$forgive=2;
}
return $forgive;
`
When comment is OK or needs moderation, everything works as expected.
Comments
Thanks for your quick answer.
var_dump($forgive) provides me the following information:
string(1) "0"
You can see the offending message here:
http://www.hebergement-pro.org/zenphoto/
You can try with the following message:
anatrim furniture sex wedding
I modified the source code to print the $forgive variable when the comment has to be rejected / moderated
I found the bug !
functions.php, postComment(...), line 992:
`$commentobj->setInModeration(2); //mark as not posted`
As the return code of the SpamFilter is 0, This variable is not modified anymore in this file. So, we are getting back to functions-controller.php
with the value "2".
functions-controller.php, zp_handle_comment(...), line 184:
`
$comment_error = $commentadded->getInModeration();
[... the value is 0, so it does not get in the if statement ...]
$comment_error++;
`
So, right now, the $comment_error value is 3.
controller.php:
`$_zp_comment_error = zp_handle_comment();`
$_zp_comment_error is used to determine the error message to send to the spammer.
We have two ways to solve that bug:
- in comment_form.php, getCommentErrors:
`case 3: return gettext("Your comment failed the SPAM filter check.");`
- modify functions.php, functions-controller to handle the case where a spam filter will return a 0 (the comment has to be dropped)
Try and guess what I did
Do you want me to fill a bug with this fix?
That's exactly how I understood the changelog.
There are some bugs remaining. When everything will be cleaned, I will provide you the source code.
Right now, filtering works fine, Minor bugs are still present and need to be fixed, as it's not usable by final users.
I will try to add the socket support.
I hope I will have time to do it this week.