Spambayes

Creating and modifying plugins.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Spambayes

Post by danst0 »

Hi,

at the moment I am experiencing problems with my comment spam filter. Completely legit comments are market with a spam probability of 95% or higher... Is there a bulk method to train the filter with older comments?
I tried the recycler but a) in Safari / Mac the script seems to be overwhelmed by the number of messages and I have to stop it ("slow script" error) and b) there is no possibility to mark multiple messages there as ham?

Daniel
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Spambayes

Post by onli »

I tried the recycler ... b) there is no possibility to mark multiple messages there as ham?
Indeed, there isn't. It's normally mostly spam in the recycler. But you can chose a few comments, restore them, and then use the buttons in the comments-section.
I tried the recycler but a) in Safari / Mac the script seems to be overwhelmed
I can't use or test with that browser. You could try chromium, the javasript-performance is probably better in that browser.
Is there a bulk method to train the filter with older comments?
Yes. Go into the Spamblock-bayes-menu, there to database, and click the button "learn from old". This will learn old comments as ham and comments from your spamlog as spam.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

Another question on the same topic:
At the moment I experience a lot of comment spam, which is assigned a too low probability (eg. 80 % or less).

1) Could I train this as spam to raise the probability?
2) If I click the valid or spam buttons nothing happens (like a confirmation) is this the designed behavior or something wrong with my backend?

Daniel
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Spambayes

Post by onli »

1) Yes.
2) It is not intended. There should be a "load-circle" and spam should vanish afterwards. Have a look in the javascript-messages (strg+shift+j probably) and see if there is an error.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

You are right, i get the following error:

/plugins/serendipity_event_spamblock_bayes/bayes_commentlist.js:222

SyntaxError: Parse error

serendipity_admin.php:740ReferenceError: Can't find variable: spam

Same error for "Valid"
The other links work well (information, edit, approve, ...)

Daniel
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

Ok, I just checked with my test installation of s9y:

Preparation: completely new installation of the spambayes plugin, change of s9y front and backend to serendipity 2.3

Result: Same error as above for spam and ham clicks.

ps: could someone move this thread to the bugs area please?
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Spambayes

Post by onli »

I think this belongs in here, as this is a plugin and not a bug of serendipity itself.

Please show me the line the second errormessage is pointing to, line 740 of your commentpage.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

Ok here is the step by step:
In the Admin Interface I click Comments -> Result:
SyntaxError: Parse error /plugins/serendipity_event_spamblock_bayes/bayes_commentlist.js:222

Then I click "Spam" and the second error appears:

ReferenceError: Can't find variable: spam serendipity_admin.php:731

Which file should I cat? serendipity_admin does not have more than 400 lines. the comments.tpl neiter...

Daniel
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Spambayes

Post by onli »

When you are in the commentlist, the html of that current page is accessible via your browser, probably strg+shift+u. There the line should be present.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

Ahh. Sure here it is (lines 731 and following)

Code: Select all

<a id="ham99"
			class="serendipityIconLink spamblockBayesControls"
			onclick="ham(99)"
			title="Spamblock (Bayes): Valid"><img
			src="/templates/default/admin/img/accept.png"
			alt="" />Valid</a> <a
			id="spam99"
			class="serendipityIconLink spamblockBayesControls"
			onclick="spam(99)"
			title="Spamblock (Bayes): Spam"><img
			src="/plugins/serendipity_event_spamblock_bayes/img/spamblock_bayes.spam.png" 
			alt="" />Spam</a>
            <span class="spamblockBayesRating">
            <a href="serendipity_admin.php?serendipity[adminModule]=event_display&serendipity[adminAction]=spamblock_bayes&serendipity[subpage]=4&serendipity[comments][99]">
                <span id="99_rating">0%</span>
            </a>
I dont know Javascript very well, but isn't the onclick just standard code (maybe a ";" missing) but it just does not find the functions "ham" and "spam"?

Daniel
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Spambayes

Post by onli »

Maybe. But those are functions defined in /plugins/serendipity_event_spamblock_bayes/bayes_commentlist.js. They are probably missing because of the prior parsing-error. But line 222 contains no error i can detect...
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

Ok, the error seems to be limited to safari (most current version). firefox works...

anyone a idea why this does not work in safari? The code below seems to be faulty.

In line 222 of the bayes_commentlist.js is this code:

Code: Select all

//Something like this don't exist in Javascript
function getElementByClass(class, node, tag) {
    if (node == null) {
        node = document;
    }
    if (tag == null) {
        tag = "*";
    }
    var allHTMLTags = node.getElementsByTagName(tag);
    var classes = new Array();
    var length = allHTMLTags.length;
    for (var i=0; i < length; i++) {
        //multiple classes are in the same string, so search carefully
        if (allHTMLTags[i].className.indexOf(class) != -1) {
            classes.push(allHTMLTags[i]);
        }
    }
    return classes;
}
Daniel
onli
Regular
Posts: 3044
Joined: Tue Sep 09, 2008 10:04 pm
Contact:

Re: Spambayes

Post by onli »

It's possible that one of the arguments, maybe class, is a reserved keyword in safari. Try to change the name of the arguments (in the whole function).
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

Great hint!

the "class" parameter seems to be a reserved name. changing it to "_class" or anything else works!

Can you change the source?

Daniel
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Spambayes

Post by danst0 »

Can I help here somehow to speed up implementation?
Post Reply