Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
0 + 9 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Akismet implementation for Xoops -- Comments
by Tobias on 2007/3/17 18:17:40

Thanks for thanking. This is also very good in combination with the new version of the XOOPS Protector module, which lets you define the maximum number of links that can be in a POST request. Now I have: XOOPS Protector for a pre-screening, then Netquery's Bad Behavior to have a close look at the HTTP request, then Akismet to look at the post itself. That's pretty thorough, I would think. But amazingly enough, there are still posts which arrive at the Akismet check.
Re: Akismet implementation for Xoops -- Comments
by MikeOConnor on 2007/3/11 20:46:03

Ah! Perfecto.

The only thing I forgot was to pull the Akismet class stuff into the Class directory (read up the thread a little bit for that gizmo).

Once I did that, it worked like a charm just like you've posted it (of course, I'm running PHP5 which is the version of the code you're using -- for most folks, you'll want to substitute the PHP4 version but the mapping should be easy).

I'm loving this hack -- it lets Akismet take a look at all comments in the system, not just the ones coming through AMS.

You da man! Sorry it took me sooo long to try it out. My excuse is that all of the hacking time has been sucked up by studying for the ham-radio license exam. But putting this into my system was a really rewarding 15 minute break from radio.

Thankyou thankyou thankyou!!
Re: Akismet implementation for Xoops -- Comments
by Tobias on 2007/3/2 23:42:37

Ok, this should be a good place to put the entire comment submission routine through Akismet. Again, there're some elements that have to be adapted manually to individual server setups, this seems to be working for the XOOPS version I'm working with (2.2 branch), and I do not know about others. Also, this kills everything Akismet identifies as Spam without further notice. You can send yourself an email without much fuzz, but that's what we're all looking for, isn't it? A little more spam in our email accounts. So not for the faint at heart, and not if your users might hate you for false positives.

You need the Akismet class, API key, and so forth, as per a post above in this thread.

Open /include/comment_post.php in an editor. Depending on your XOOPS version you might find a line

case "post":

somewhere around line 140. Insert the call to the Akismet class immediately following that line. Provided that you're using the version I'm using at the time of writing of the Akismet class for PHP5, it should then look something like this:
le="color: #000000"><?php [color=CCCCCC]case "post":[/color] // start Akismet hack include_once XOOPS_ROOT_PATH . '[color=CC3333]/class/Akismet.class.php[/color]'; $WordPressAPIKey = '[color=CC3333]YourApiKey[/color]'; $MyBlogURL = '[color=CC3333]http://www.yoursite.TLD/[/color]'; $akismet = new Akismet($MyBlogURL ,$WordPressAPIKey); $akismet->setCommentAuthor("anonymous"); $akismet->setCommentAuthorEmail("nobody@nobody.com"); $akismet->setCommentAuthorURL($com_title); $akismet->setCommentContent($com_text); $akismet->setPermalink('[color=CC3333]I think it might be necessary to have here the URL of something that looks like a real blog entry at your site[/color]'); if($akismet->isCommentSpam()){ redirect_header( 'index.php', 2, "[color=CC3333]Smells like Spam[/color]" ); exit(); } // end Akismet, if we're still alive store the comment normally [color=CCCCCC]$doimage = 1;[/color]

The gray bits are from the original script, the red ones the parts you'll have to look into. I've caught a little spam in my sandbox with this, but have not brought it online. I am not saying it works. It's just a suggestion to try out.

*edit: There was a little quirk in my code quote above (a $ lacking in the declaration of $MyBlogURL). I've edited it. There might be others.*
Re: Akismet implementation for Xoops -- AMS
by Tobias on 2007/2/27 16:25:06

I pretty much assume that AMS uses the comment functionality of the core to handle comments. That's what all the other modules seem to be doing anyway. And I do think we should be able to figure out how to hack the core.

If somebody can jump in and give us a lead where to hack... I've had a very brief look and didn't find the obvious place, but I will try to look, perhaps over the weekend. But I'm also not a programmer and don't know a lot about the internals of XOOPS, so if somebody can come up with a quick and authoritative answer, that would be excellent.

The question, again, is: Where in the code does XOOPS (or its different versions) write comments to the DB?
Re: Akismet implementation for Xoops -- AMS
by MikeOConnor on 2007/2/27 14:28:09

Uffda... I need some help from the assembled gang. I went rummaging for the place to put the Akismet call in AMS and can't figure out where to put it. Anybody out there understand AMS well enough to be able to tell me where it actually posts a comment to the database?

There are several layers of included calls in AMS and I'm not enough of a programmer to be able to figure out which is the one that actually does the posting. I have a feeling that AMS may be using XOOPS core code to do the posting, which would be neat because then the hack would catch comment spam in *all* comments, not just the ones in AMS. But, like I said, I can't figure out where to insert the code.

Who's Online

149 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 149


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits