NP_SpamBayes 1.1.0 done !

Post your new plugins here!
verbaljam
Posts: 666
Joined: Wed Jul 31, 2002 4:58 pm
Location: Amsterdam, The Netherlands
Contact:

Postby verbaljam » Tue Sep 19, 2006 7:31 pm

That was a very thorough reply. Thanks for that, Xiffy!
One thing I noticed after my previous question: I switched on logging and I noticed the log-file already contained logged items. Is it the intention that logging takes place although logging is off? (it's convinient though)
User avatar
xiffy
Nucleus Guru
Nucleus Guru
Posts: 1194
Joined: Wed Mar 27, 2002 6:37 pm
Location: Deventer
Contact:

Postby xiffy » Tue Sep 19, 2006 7:38 pm

Whoops!
No, that's a bug not a feature. Will solve in next release.

solved
verbaljam
Posts: 666
Joined: Wed Jul 31, 2002 4:58 pm
Location: Amsterdam, The Netherlands
Contact:

Postby verbaljam » Tue Sep 19, 2006 10:17 pm

Very useful addition, that 'train new'! No problems with time-outs this time.
One question left: should the plugin be at the top of the plugin list? What's your recommendation?

Once again: very good work, Xiffy! I'm very happy with this plugin! 8)
(and thanks for the credits in the Wakka).
User avatar
xiffy
Nucleus Guru
Nucleus Guru
Posts: 1194
Joined: Wed Mar 27, 2002 6:37 pm
Location: Deventer
Contact:

Postby xiffy » Tue Sep 19, 2006 10:22 pm

I've got spambayes at the top of the spamfighting plugins, it's much faster then blacklist ever was. In fact i've disabled blacklist at the moment. Spam Bayes catches everything now.
But i would recommend high in the list, at least above comment moderation otherwise you're too late.
some other speed considerations.
i've removed all 10.000 ip blocks from my .htaccess. this improved server speed as well.
cyblot
Nucleus Guru
Nucleus Guru
Posts: 399
Joined: Tue Sep 16, 2003 8:49 pm
Location: Netherlands
Contact:

Postby cyblot » Tue Sep 19, 2006 10:32 pm

xiffy wrote:i've removed all 10.000 ip blocks from my .htaccess. this improved server speed as well.


Oh, that's a good idea. I should try that as well, thanks for the tip. So far I'm quite pleased with SpamBayes. The few spams that made it through were caught by CommentControl. It only took me a few days of training (I "only" get around 50 spam entries a day) and since then it's been working like a charm.
Blots of Info
http://www.golb.org
verbaljam
Posts: 666
Joined: Wed Jul 31, 2002 4:58 pm
Location: Amsterdam, The Netherlands
Contact:

Postby verbaljam » Wed Sep 20, 2006 8:18 pm

Xiffy, could you test this please: I'm under the impression that all kinds of operations can be carried out on the admin page of the plugin without being logged in!
User avatar
xiffy
Nucleus Guru
Nucleus Guru
Posts: 1194
Joined: Wed Mar 27, 2002 6:37 pm
Location: Deventer
Contact:

Postby xiffy » Wed Sep 20, 2006 8:30 pm

Nope.
It's a firefox / cookie thingy. Although it looks like you're not logged in, the cookie is still available in firefox. Open IE and try to browse to some page directly like
/nucleus/plugins/spambayes/index.php?page=log
you'll find the message reassuring
cyblot
Nucleus Guru
Nucleus Guru
Posts: 399
Joined: Tue Sep 16, 2003 8:49 pm
Location: Netherlands
Contact:

Postby cyblot » Wed Sep 20, 2006 8:41 pm

xiffy wrote:Whoops!
No, that's a bug not a feature. Will solve in next release.

solved


I have installed version 1.0.3, but I haven't seen any event in my log since installing it. Has anyone else noticed this (i.e. could it be a bug), or have I just been very lucky today?
Blots of Info

http://www.golb.org
User avatar
xiffy
Nucleus Guru
Nucleus Guru
Posts: 1194
Joined: Wed Mar 27, 2002 6:37 pm
Location: Deventer
Contact:

Postby xiffy » Wed Sep 20, 2006 8:46 pm

on my server it's very quiet on the spam front. you should have 1 spam and (sorry for that) 1 ham in your actionlog
cyblot
Nucleus Guru
Nucleus Guru
Posts: 399
Joined: Tue Sep 16, 2003 8:49 pm
Location: Netherlands
Contact:

Postby cyblot » Wed Sep 20, 2006 9:15 pm

xiffy wrote:on my server it's very quiet on the spam front. you should have 1 spam and (sorry for that) 1 ham in your actionlog


That would be the first time I am happy about spam :wink: Unfortunately, the spam made it through, I don't see any ham. Nothing is listed in my log in the spambayes interface. The log table (sp_log) in phpmyadmin is also empty (i.e. I cannot browse it). Thanks for your effort though, maybe I can just install an older version again.
Blots of Info

http://www.golb.org
User avatar
xiffy
Nucleus Guru
Nucleus Guru
Posts: 1194
Joined: Wed Mar 27, 2002 6:37 pm
Location: Deventer
Contact:

Postby xiffy » Wed Sep 20, 2006 9:17 pm

and you have logging enabled in the options? it defaults to no
cyblot
Nucleus Guru
Nucleus Guru
Posts: 399
Joined: Tue Sep 16, 2003 8:49 pm
Location: Netherlands
Contact:

Postby cyblot » Wed Sep 20, 2006 9:22 pm

xiffy wrote:and you have logging enabled in the options? it defaults to no


It is set to 'yes'. In installed 1.0.3 over 1.0.1 I think, by just updating the files. Maybe something went wrong there. Can I see whether or not logging is enabled in phpmyadmin? (i.e. which table/variable)
Blots of Info

http://www.golb.org
User avatar
xiffy
Nucleus Guru
Nucleus Guru
Posts: 1194
Joined: Wed Mar 27, 2002 6:37 pm
Location: Deventer
Contact:

Postby xiffy » Wed Sep 20, 2006 9:53 pm

That's so strange. Updating the files should suffice.
Any errors in /var/log/httpd/error_log ?
the plugin options are stored in nucleus_plugin_option_desc, the actual value is stored in nucleus_plugin_option.
the oid field is the foreign key
if you'd run this query

Code: Select all

SELECT *
FROM `nucleus_plugin_option_desc` left join nucleus_plugin_option on nucleus_plugin_option_desc.oid = nucleus_plugin_option.oid
where oname = 'enableLogging'

you should see a 'yes' on the value field.
perhaps just reupload the files again? (and are the new files in the correct directory?)
cyblot
Nucleus Guru
Nucleus Guru
Posts: 399
Joined: Tue Sep 16, 2003 8:49 pm
Location: Netherlands
Contact:

Postby cyblot » Wed Sep 20, 2006 10:26 pm

xiffy wrote:That's so strange. Updating the files should suffice.


I'll give that a try and see what it looks like tomorrow.

Any errors in /var/log/httpd/error_log ?


Many (now that I know where to look for it). It's filled with "Premature end of script headers: php-script" errors, but that seems to be related to something else (going by a quick Google search) and php-script: line 4: [12345] Segmentation fault. Both from /usr/bin/php

if you'd run this query

Code: Select all

SELECT *
FROM `nucleus_plugin_option_desc` left join nucleus_plugin_option on nucleus_plugin_option_desc.oid = nucleus_plugin_option.oid
where oname = 'enableLogging'

you should see a 'yes' on the value field.


That does show a 'yes'. I'll see what happens with the reinstalled files, thanks for your help.
Blots of Info

http://www.golb.org
User avatar
z3rg
Posts: 179
Joined: Thu Mar 07, 2002 10:55 am
Location: Prague, Czech Republic & Pullman, WA, US
Contact:

Postby z3rg » Thu Sep 21, 2006 1:09 pm

Maybe stupid question but I dont get it ... I've trained plugin to Ham messages, now I recieved some spam and how do I tell the plugin to read that message/comment to teach plugin it is a spam? Do I have to type in all words to teach it?
User avatar
Leng
Nucleus Guru
Nucleus Guru
Posts: 2827
Joined: Sun Sep 19, 2004 2:34 am
Location: Australia
Contact:

Postby Leng » Thu Sep 21, 2006 4:23 pm

z3rg wrote:Maybe stupid question but I dont get it ... I've trained plugin to Ham messages, now I recieved some spam and how do I tell the plugin to read that message/comment to teach plugin it is a spam? Do I have to type in all words to teach it?


If you turned on the logging option, SpamBayes will log all comments, trackbacks, etc and you can individually train each one of them as ham or spam.
Image
deborahlau.com | To-Do List
Questions? See the FAQ, read the docs, or browse our plugins!!
User avatar
z3rg
Posts: 179
Joined: Thu Mar 07, 2002 10:55 am
Location: Prague, Czech Republic & Pullman, WA, US
Contact:

Postby z3rg » Fri Sep 22, 2006 8:51 am

Ahh, got it, thx!
User avatar
pepiino
Posts: 100
Joined: Sat Feb 26, 2005 12:36 am
Location: Czech Republic
Contact:

SpamBayes logging and PHP4

Postby pepiino » Tue Sep 26, 2006 8:59 pm

Hi! Firstly I want to thank you for the great plugin!

Now the problem:
I have noticed problems with logging on a server running PHP4 (with PHP5 it works great).
I looked into the code and found the following problem in the NP_SpamBayes constructor:

Code: Select all

function NP_SpamBayes() {
            ....
   $this->spambayes = new NaiveBayesian($this);
}

In PHP4 this causes, that the NaiveBayesian object gets the copy of $this. But there the NP_SpamBayes object is not completely constructed (check with var_dump). NaiveBayesianStorage can't later get plugin option from the copy of uncompleted object.

I found two possible solutions:
1) Move the NaiveBayesian initialization into the method init() of NP_SpamBayes.


2) (I think better one) Use reference operators in the constructors of both NaiveBayesian and NaiveBayesianStorage classes.
After following modifications logging works with both PHP4 and PHP5:

Code: Select all

 
function NaiveBayesian(&$parent) {             // <== reference operator added
   $this->nbs = new NaiveBayesianStorage($parent);
   $this->parent = &$parent;                // <== reference operator added
   return true;
}



Code: Select all

function NaiveBayesianStorage(&$plugin) {    // <== reference operator added
   $this->table_cat = sql_table('plug_sb_cat'); // categories
   $this->table_wf  = sql_table('plug_sb_wf');  // word frequencies
   $this->table_ref = sql_table('plug_sb_ref'); // references
   $this->table_log = sql_table('plug_sb_log'); // logging
   $this->plugin = &$plugin;                    // <== reference operator added
}
Josef 'pepiino' Adamcik <jabber:josef.adamcik@jabber.cz>,<GTalk: josef.adamcik@gmail.com>
http://blog.pepiino.info
NP_MiniForum - guestbook or shoutbox for your site!
User avatar
xiffy
Nucleus Guru
Nucleus Guru
Posts: 1194
Joined: Wed Mar 27, 2002 6:37 pm
Location: Deventer
Contact:

Postby xiffy » Tue Sep 26, 2006 9:50 pm

And thank you for the clear explanation. Having learned to work with objects and classes in Java, PHP does sometimes amaze me. But I like it so much more then java.
I'll upgrade the plugin so it will work for version 4 as well. I'll use option 2, it's cleaner and involves less changes.
sopo
Posts: 3
Joined: Wed Apr 12, 2006 4:28 am

show ham trained message

Postby sopo » Fri Sep 29, 2006 4:50 am

Just installed SpamBayes, and it catches most of the spams. Normally, a few ham messages got marked as spam, thus it won't let it displayed on the site.

Now, after I trained it as ham, how can I let it be displayed on my site?

Return to “Plugin Development”