The Serendipity Handbook

You can now read the (german) handbook here: PDF - https://github.com/s9y/Book (LaTeX source).

Forum-Information

Before posting about errors, make sure that the answer cannot already be found in our FAQ or by searching this forum!
Posting is restricted to registered users (registering is free and simple!) due to recent spam attacks. When having trouble with this board, contact garvin(-at)s9y(-dot)org.

Board index Plugins Spambayes

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

Postby danst0 » Fri Mar 04, 2011 7:33 am

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

User avatar
onli
Regular
 
Posts: 1044
Joined: Tue Sep 09, 2008 10:04 pm

Postby onli » Fri Mar 04, 2011 9:52 am

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

Postby danst0 » Tue Apr 05, 2011 7:35 am

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

User avatar
onli
Regular
 
Posts: 1044
Joined: Tue Sep 09, 2008 10:04 pm

Postby onli » Tue Apr 05, 2011 8:42 am

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

Postby danst0 » Tue Apr 05, 2011 10:10 am

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

Postby danst0 » Wed Apr 06, 2011 7:08 am

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?

User avatar
onli
Regular
 
Posts: 1044
Joined: Tue Sep 09, 2008 10:04 pm

Postby onli » Fri Apr 08, 2011 11:03 am

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

Postby danst0 » Fri Apr 08, 2011 2:17 pm

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

User avatar
onli
Regular
 
Posts: 1044
Joined: Tue Sep 09, 2008 10:04 pm

Postby onli » Fri Apr 08, 2011 4:29 pm

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

Postby danst0 » Fri Apr 08, 2011 4:40 pm

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&amp;serendipity[adminAction]=spamblock_bayes&amp;serendipity[subpage]=4&amp;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

User avatar
onli
Regular
 
Posts: 1044
Joined: Tue Sep 09, 2008 10:04 pm

Postby onli » Fri Apr 08, 2011 5:12 pm

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

Postby danst0 » Fri Apr 08, 2011 5:32 pm

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

User avatar
onli
Regular
 
Posts: 1044
Joined: Tue Sep 09, 2008 10:04 pm

Postby onli » Fri Apr 08, 2011 6:17 pm

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

Postby danst0 » Fri Apr 08, 2011 6:43 pm

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

Postby danst0 » Mon Apr 11, 2011 9:35 am

Can I help here somehow to speed up implementation?

Next


Return to Plugins

Who is online

Users browsing this forum: No registered users and 1 guest