Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Mod Requests => Topic started by: H on June 28, 2006, 12:28:54 PM

Title: Anti-spam mod request
Post by: H on June 28, 2006, 12:28:54 PM
Was wondering if anyone could write a mod that stops spam using: http://akismet.com/

Could have options to use it only for guests or for some membergroups.
Title: Re: Anti-spam mod request
Post by: Scubasteve on June 28, 2006, 12:33:47 PM
 something like this?

http://mods.simplemachines.org/index.php?mod=107
Title: Re: Anti-spam mod request
Post by: anunlike on June 28, 2006, 01:09:32 PM
I'd really love that mod.

It needs to be updated, though, as the latest version says it's compatable with 1.0.2.
Title: Re: Anti-spam mod request
Post by: winrules on June 28, 2006, 01:16:31 PM
Quote from: anunlike on June 28, 2006, 01:09:32 PM
I'd really love that mod.

It needs to be updated, though, as the latest version says it's compatable with 1.0.2.
Look through the mod's thread. On the last couple pages there is a download link for 1.1 RC2.
Title: Re: Anti-spam mod request
Post by: H on June 28, 2006, 01:27:07 PM
Quote from: Scubasteve on June 28, 2006, 12:33:47 PM
something like this?

http://mods.simplemachines.org/index.php?mod=107

No.

Have a look the the FAQ (http://akismet.com/faq/) and see what akismet is all about
Title: Re: Anti-spam mod request
Post by: anunlike on June 28, 2006, 03:36:46 PM
Quote from: winrules on June 28, 2006, 01:16:31 PM
Quote from: anunlike on June 28, 2006, 01:09:32 PMI'd really love that mod.

It needs to be updated, though, as the latest version says it's compatable with 1.0.2.
Look through the mod's thread. On the last couple pages there is a download link for 1.1 RC2.

OK. Thanks.
Title: Re: Anti-spam mod request
Post by: Skipdawg on September 18, 2006, 12:49:08 AM
Someone else mentioned this Akismet to me and was happy to see it mentioned in a search.
I see punBB made a mod for it so a good SMF coder should be able to make one. Apparently it works allot like spamassasin but you don't have the bother of updating the filters yourself. KEWL!  8)

Check out the development (http://akismet.com/development/) page. I think this could be a great mod for many. I know I have blocked a heck of allot of spam-bots and spammer. And this would help in that area big time.  ;)
Title: Re: Anti-spam mod request
Post by: gamesmad on September 18, 2006, 02:18:50 AM
Ill take a look into how it connects with WP, and see what I can do for SMF.  Ill keep ya'll posted :)

Will
Title: Re: Anti-spam mod request
Post by: Skipdawg on September 18, 2006, 07:37:14 PM
Great!  ;D Hope you can come up with something on this.  ;)
Title: Re: Anti-spam mod request
Post by: gamesmad on September 19, 2006, 01:49:02 PM
Akismet seems to have very little documentation available on exactly how it works, and there are no forums.  I'm trying to figure it out though ;D

Will
Title: Re: Anti-spam mod request
Post by: H on September 19, 2006, 04:00:51 PM
Quote from: gamesmad on September 19, 2006, 01:49:02 PM
Akismet seems to have very little documentation available on exactly how it works, and there are no forums.  I'm trying to figure it out though ;D

Will

Look at the wordpress mod. Hopefully their mods are commented :P
Title: Re: Anti-spam mod request
Post by: gamesmad on September 19, 2006, 04:33:58 PM
They aren't commented :P  If only someone from the SMF team had coded it!

Will
Title: Re: Anti-spam mod request
Post by: winrules on September 19, 2006, 04:37:15 PM
Quote from: gamesmad on September 19, 2006, 04:33:58 PM
They aren't commented :P  If only someone from the SMF team had coded it!

Will
I might try my hand at it.
Title: Re: Anti-spam mod request
Post by: gamesmad on September 19, 2006, 04:38:34 PM
winrules you got MSN or AIM?  PM me if you do, Id like to talk to you about this.

Will
Title: Re: Anti-spam mod request
Post by: winrules on September 19, 2006, 04:53:49 PM
Quote from: gamesmad on September 19, 2006, 04:38:34 PM
winrules you got MSN or AIM?  PM me if you do, Id like to talk to you about this.

Will
Could you come to #simplemachines on irc.villageirc.net?
Title: Re: Anti-spam mod request
Post by: gamesmad on September 20, 2006, 01:51:35 AM
Sure, Ill stick in there, sorry I didn't read this post before.

Will
Title: Re: Anti-spam mod request
Post by: Skipdawg on September 26, 2006, 03:03:26 PM
Any further progress with this?
Title: Re: Anti-spam mod request
Post by: winrules on September 26, 2006, 04:23:31 PM
Quote from: Skipdawg on September 26, 2006, 03:03:26 PM
Any further progress with this?
I'll get around to it in a little bit.
Title: Re: Anti-spam mod request
Post by: Dannii on October 02, 2006, 07:11:35 AM
This looks like a great mod to have.
Title: Re: Anti-spam mod request
Post by: Daniel15 on November 06, 2006, 01:02:11 AM
Since nobody's started coding this, I'll see if I can do it ;)
Title: Re: Anti-spam mod request
Post by: winrules on November 06, 2006, 03:42:43 PM
Quote from: Daniel15 on November 06, 2006, 01:02:11 AM
Since nobody's started coding this, I'll see if I can do it ;)
Daniel, it's a really easy mod to do, the problem is where to put the messages that are marked for spam. You can't just delete them, because they might be a false positive.
Title: Re: Anti-spam mod request
Post by: Daniel15 on November 06, 2006, 09:03:11 PM
Well, if I do work on this, it may not be for a few weeks, as I have exams next week.
Quote
Daniel, it's a really easy mod to do, the problem is where to put the messages that are marked for spam. You can't just delete them, because they might be a false positive.

I was thinking add an additional field in the {$db_prefix}messages table, named 'spam'. If the message is (possibly) spam, set that field to '1'. Then, edit the queries which retrieve the posts (not sure what file, I can't check at the moment) to have WHERE ........ AND spam='0' on the end... Basically, don't retrieve any of the spam messages.

There would also be an admin panel, quite similar to the WordPress one. Spam messages would automatically be deleted after 15 days.
Title: Re: Anti-spam mod request
Post by: winrules on November 07, 2006, 05:21:04 PM
Yeah, that's preetu much what I was doing (I had started the mod, but got busy. I might finish it).
Title: Re: Anti-spam mod request
Post by: Daniel15 on November 09, 2006, 11:24:14 PM
Well, if you're going to do this, then I won't :P
I really want to do this MOD, but I have exams at the moment, so I can't (currently, I have 4 exams left, which I'm doing next week).
Title: Re: Anti-spam mod request
Post by: Daniel15 on November 15, 2006, 06:13:24 AM
OK, I just started this about 2 hours ago. Here's what I've done so far:
NOTE: It doesn't yet connect to Akismet to check if the message is actually spam (this is probably the easiest bit). At the moment, it treats all replies as spam, for testing purposes :P

If someone posts a reply which is considered by Akismet to be spam, they'll be returned to the topic, and notified about it (see the message at the top of the page, and next to the reply's subject):
(http://img183.imageshack.us/img183/2536/spamsubmitts8.th.jpg) (http://img183.imageshack.us/my.php?image=spamsubmitts8.jpg)
Members browsing the forum won't see the replies marked as spam, they will be hidden.

The admin panel so far looks like this (note that it doesn't actually do anything yet):
(http://img175.imageshack.us/img175/1378/spamcontrolpanelxk5.th.jpg) (http://img175.imageshack.us/my.php?image=spamcontrolpanelxk5.jpg)

So, this is what's done so far:

Here's what I need to do:

What do you think so far? :D
Title: Re: Anti-spam mod request
Post by: H on November 15, 2006, 03:23:26 PM
Looks good :D
Title: Re: Anti-spam mod request
Post by: winrules on November 15, 2006, 03:40:50 PM
Looks Good. You'll have to remember to hide posts marked as spam in other places too though.

/me thinks you have WAY too many icons in the notification area of the taskbar
Title: Re: Anti-spam mod request
Post by: Daniel15 on November 15, 2006, 07:26:16 PM
QuoteLooks Good. You'll have to remember to hide posts marked as spam in other places too though.
Like where? You mean like on the recent posts list?

Quote* winrules thinks you have WAY too many icons in the notification area of the taskbar
Yeah, this is my "play around with random stuff" computer :P. I usually use my laptop running Ubuntu Linux :)

Anyways... Let's see:
It is a bit much, isn't it :P

EDIT: First beta version released! Until I get a proper webpage set up, please see http://www.dansoftaustralia.net/downloads/file/26/SMF-Akismet-0.1-BETA.html to download it.
Note that I haven't tested it in SMF 1.1, but it should work (the MOD should apply successfully). Also, there's bound to be some bugs in this release, so please tell me if you find any!
Title: Re: Anti-spam mod request
Post by: Jacen on November 16, 2006, 04:59:15 PM
Looks good, I'm not going to install it now... but I will when it's out of beta :)
Title: Re: Anti-spam mod request
Post by: Col on November 22, 2006, 01:35:53 PM
I'm curious: what happens with posts when Akismet is down or plain slow?
Title: Re: Anti-spam mod request
Post by: Laibeus Lord on December 09, 2006, 01:07:28 AM
Bug report in your 1.1rc3.xml installation

You got the same code twice as shown below:  (in SSI.php)

<operation>
<search position="before"><![CDATA[
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
]]></search>
<add><![CDATA[
AND t.spam = 0
]]></add>
</operation>

<operation>
<search position="before"><![CDATA[
WHERE t.ID_LAST_MSG >= " . ($modSettings['maxMsgID'] - 35 * min($num_recent, 5)) . "
AND t.ID_LAST_MSG = m.ID_MSG
AND b.ID_BOARD = t.ID_BOARD" . (empty($exclude_boards) ? '' : "
AND b.ID_BOARD NOT IN (" . implode(', ', $exclude_boards) . ")") . "
AND $user_info[query_see_board]
AND ms.ID_MSG = t.ID_FIRST_MSG
]]></search>
<add><![CDATA[
AND t.spam = 0



Also, you forgot to put the search "position" in this line:

<file name="$sourcedir/Post.php">
<operation>
<search><![CDATA[
if (!empty($_POST['move']) && allowedTo('move_any'))
redirectexit('action=movetopic;topic=' . $topic . '.0' . (empty($_REQUEST['goback']) ? '' : ';goback'));
]]></search>


So far only those ^_^
Hope it helps :)

(I prefer installing mods manually that's why I saw those ^^ )

back to installation of SMF Akismet..


UPDATE:
search position ^_^

<file name="$sourcedir/Profile.php">
<operation>
<search position=""><![CDATA[
AND m.ID_TOPIC = t.ID_TOPIC
AND t.ID_BOARD = b.ID_BOARD" . (empty($range_limit) ? '' : "
AND $range_limit") . "
AND $user_info[query_see_board]
]]></search>


Title: Re: Anti-spam mod request
Post by: Daniel15 on December 09, 2006, 02:25:56 AM
Thanks for the bug report, Laibeus Lord. I did no testing on SMF 1.1 RC3 at all, so I was expecting some errors :P
When I have more spare time, I'll update the mod to fully support SMF 1.1 (do all modifications to the SMF files from scratch) :)
Title: Re: Anti-spam mod request
Post by: Laibeus Lord on December 09, 2006, 02:38:32 AM
Quote from: Daniel15 on December 09, 2006, 02:25:56 AM
Thanks for the bug report, Laibeus Lord. I did no testing on SMF 1.1 RC3 at all, so I was expecting some errors :P
When I have more spare time, I'll update the mod to fully support SMF 1.1 (do all modifications to the SMF files from scratch) :)

np ^_^  Glad to be of help.

I have it installed to my SMF1.1Final template installation (which I will use to upgrade my other SMF1.1 RC3 forums), so far so good.  I'm not getting spam reports yet tho.  Anyway, I posted another bug here ->

http://www.simplemachines.org/community/index.php?topic=127326.new#new

For some weird reason, the thread above (link) didn't show up when I did a search of "Akismet" here in SMF Forums hehe.  So I posted the latest report there instead (of here).

^_^

Title: Re: Anti-spam mod request
Post by: Daniel15 on December 10, 2006, 05:03:00 AM
Laibeus Lord, the redundant bit in SSI.php has been removed now, in the latest development version :D And I also added the search position on where I forgot it :P
Diff: http://server.daniel15.com/cgi-bin/viewvc.cgi/smf-akismet/trunk/install-smf1.1rc3.xml?r1=2&r2=10 (http://server.daniel15.com/cgi-bin/viewvc.cgi/smf-akismet/trunk/install-smf1.1rc3.xml?r1=2&r2=10)

I'm thinking of making this MOD SMF 1.1-only, as then it will have less bugs in it (stupid mistakes and assumptions by me mainly). Would this disadvantage one (is anyone still using SMF 1.0)?
Title: Re: Anti-spam mod request
Post by: chougard on December 11, 2006, 01:57:39 AM
Is this supposed to take more than 30 seconds to install? After hitting apply mod it loads for 30 seconds and then displays
Fatal error: Maximum execution time of 30 seconds exceeded in /home2/chougard/public_html/forum/Sources/Subs-Package.php on line 2915
Title: Re: Anti-spam mod request
Post by: Daniel15 on December 11, 2006, 02:21:09 AM
No, that's not normal chougard.
Do other MODs install correctly? What version of SMF are you using?
Title: Re: Anti-spam mod request
Post by: chougard on December 11, 2006, 04:18:24 PM
Never mind. I edited a line of code. That messed it up.
Title: Re: Anti-spam mod request
Post by: Daniel15 on December 11, 2006, 05:08:14 PM
My new version of this MOD will be coming out soon (I've been working on it, doing various things). The main things are SMF 1.1 compatibility ("official" compatibility :P), and updates to make it comply with the SMF coding standards (indentation style, and other small things).


EDIT: Akismet mod 1.0 now out! Until it's approved, you'll need to download it from my site at http://www.dansoftaustralia.net/downloads/file/27/Akismet-1.0.html

Release announcement:


Akismet Spam Protection for SMF

What is it?
This is a SMF modification implementing the Akismet (http://www.akismet.com/) spam protection service. The MOD requires SMF 1.1 Final (but it may still work on SMF 1.1 RC3, that was not tested).
NOTE: If you were testing out the Beta version of this mod, you'll need to uninstall it before installing version 1.0!

How do I use it?
Firstly, you'll need to sign up for a free API key at http://wordpress.com/api-keys/. Then, install this mod via the SMF Package Manager. Once it's installed, there will be a new 'Akismet Configuration' option in the admin panel, under the 'Forum' section. Enter your API key in, and you're all set!

How do I know it's working?
You test it, of course! Simply write a new topic with the subject of 'akismet-test-123', and it will be classified as spam by the mod. This tests that the mod is installed correctly. An additional test is writing a guest post with a name of 'viagra-test-123'. Any message with this name will be marked as spam by the Akismet service. If this message is also detected as spam, then everything is working perfectly :)

CHANGELOG from 0.1 Beta --> 1.0
- Updated MOD files to comply with SMF standards
- Now parses BBCode in posts in the Akismet admin panel
- Added version information to admin section
- Now marks any posts with subject of 'akismet-test-123' as spam (for testing purposes)
- In Subs-Post.php, use $posterOptions and $msgOptions arrays rather than $_POST variables
- Moved 'Akismet Configuration' option from Configuration heading to Forum heading
- Moved position of Spam warning above the topic buttons
- Moved 'Flagged as spam' message next to subject, rather than under it

Known Issues
- Only admins can moderate the spam comments (Delete all spam, Mark as 'Not Spam'). This may change in a future release, to also allow moderators access.
- Statistics may be incorrect after deleting spam messages. Recounting all the statistics should fix this
- There is currently no way to mark existing posts as spam (false negatives).


(c) 2006 DanSoft Australia - http://www.dansoftaustralia.net/. This mod is released under the same license agreement as SMF itself.
Version: 1.0 (Build 2)
Release Date: 12th December 2006

Title: Re: Anti-spam mod request
Post by: chougard on December 12, 2006, 06:25:53 PM
Thanks! For anyone that is getting timeout errors, go into the options part of the package manager, and make all files writable. Then install. After installing, make it that the standard files are writable.

Edit: After installing and giving it my key, when posting I am presented with a white screen when I hit post. It is this mod because it will work when I uninstall it. I can only post akismet-test-123. Everything else does not work!
Mods Installed
1.     Admin Notepad      1.0
2.    Global Headers Footers    1.3
3.    Global Announcements    1.0
4.    SMF Arcade    1.3.1-MOD-E1.5
5.    SMFShop    2.3

Here are the errors I got
Error connecting to host: rest.akismet.com Error number: 113 Error message: No route to host
File: /home2/chougard/public_html/forum/Sources/Akismet.class.php
Line: 322

fsockopen(): unable to connect to rest.akismet.com:80
File: /home2/chougard/public_html/forum/Sources/Akismet.class.php
Line: 319

Those were in the error log.
Title: Re: Anti-spam mod request
Post by: Jacen on December 13, 2006, 01:27:25 AM
Looks to me like the mod is unable to connect to the spam database and doesn't have an error handling routine for that.
Title: Re: Anti-spam mod request
Post by: Daniel15 on December 13, 2006, 03:57:59 AM
Hmmm... I never thought of error handling in the Akismet class, as I thought it was controlled by the class I used (a freely-available Akismet PHP4 class). I'll look into implementing better error handling.

Thanks for reporting it :)
Title: Re: Anti-spam mod request
Post by: Laibeus Lord on December 13, 2006, 04:22:30 AM
Cool.  All seems well with the new version :D

Glad to see it into fruition :D

Die spammers!!

Title: Re: Anti-spam mod request
Post by: Jacen on December 13, 2006, 06:43:21 AM
Quote from: Daniel15 on December 13, 2006, 03:57:59 AM
Hmmm... I never thought of error handling in the Akismet class, as I thought it was controlled by the class I used (a freely-available Akismet PHP4 class). I'll look into implementing better error handling.

Thanks for reporting it :)

I think I'll wait for this to be fixed before trying it :)
Title: Re: Anti-spam mod request
Post by: Daniel Hofverberg on December 13, 2006, 07:38:16 AM
Same here. It's a great idea, but something needs to be done so that the forum still works if the Askismet server is down.
Title: Re: Anti-spam mod request
Post by: Daniel15 on December 14, 2006, 04:22:42 AM
Yeah, very sorry about that guys, I'll fix it as soon as possible...
If the server's down (very rarely happens), should the posts just be marked as non-spam, and allowed to be posted? Or should they be marked as spam, and then it asks you to check them?
Title: Re: Anti-spam mod request
Post by: Daniel Hofverberg on December 14, 2006, 04:49:23 AM
Personally, I think it makes most sense to mark messages as non-spam if the server can't be reached. After all, there are probably much more legitimate posts then spam, so it makes more sense to me.
Title: Re: Anti-spam mod request
Post by: Daniel15 on December 14, 2006, 04:56:35 AM
Yeah, thanks for the suggestion Daniel, I'll do that then

QuoteAfter all, there are probably much more legitimate posts then spam
Yeah, I forgot it was a forum... My blog is completely different (about 400 spam comments, and about 10 legitimate :P)
Title: Re: Anti-spam mod request
Post by: Jacen on December 14, 2006, 07:23:35 AM
I have a couple of seperate ideas.

1: Fall back on the moderation system. Mark them as reported to a moderator.
2: Allow them tobe posted but mark them as need to be checked.
Title: Re: Anti-spam mod request
Post by: Dannii on December 14, 2006, 07:25:47 AM
I'd borrow/remake some code from the visual warning mod and put those posts into a moderation queue.
Title: Re: Anti-spam mod request
Post by: Col on December 18, 2006, 10:13:26 AM
Using a queue or flags is a good idea for some, but if you have busy forum, and the Akismet server cannot be reached for some time, there will be an awful lot of posts to check. It might be better to have options to handle this, and maybe even a maximum number in the queue before they are allowed to be posted as usual. All configureable, of course.

Oh, how about this! What if when the Akismet server cannot be reached, the posts are allowed to be posted, flagged (visually, and with code), so that when Akismet is back up, the posts are then checked, and if need be, removed retrospectively. I'd suggest that there should be a delay between each post being checked, so that Akismet is not flooded from many SMF forums catching up with spam-filtering.