xoops forums

Catzwolf

Home away from home
Posted on: 2010/7/25 4:59
Catzwolf
Catzwolf (Show more)
Home away from home
Posts: 1392
Since: 2007/9/30
#1

Xoops reCaptcha Class v1.00 beta

What is Xoops reCaptcha?

Xoops reCaptcha is class that will allow users to add and use reCaptcha widget to prevent spam being posted on their website.

This class can be used in conjunction with the Xoops Captcha or it can replace it all together, with just few lines of code.

While this class can be utilized by anyone, it is aim more at Xoops developers wishing to add reCaptcha to their code.

The class is cleanly written and has developer comments to help aid you in it's usage and there is also documentation within the package that will explain how to add the required calls to make it work.

For its usage, you will be required to create a private and public key and these can be entered one of two ways (Again, this is explained in the documentation).

Xoops reCaptcha, can be used in two ways, either within XoopsFormclass or statically through its own API and methods.

There are examples of its usage within the documentation.

Xoops reCaptcha v1.00 is beta and should not be considered ready for a production website, but used to help with further development.

While I have tried to make this as easy to use as possible, it is not for total beginners. If you require help with this class, I am sure people here will only be to glad to help out.

You can download this class from the following:
Xoops reCaptcha v1.00

Please submit bugs and features here:
bugs and feature requests

Mamba

Moderator
Posted on: 2010/7/25 6:17
Mamba
Mamba (Show more)
Moderator
Posts: 10760
Since: 2004/4/23
#2

Re: Xoops reCaptcha Class v1.00 beta

See also this tutorial about installing reCaptcha on your site by Ghia
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

webmystar

Friend of XOOPS
Posted on: 2010/7/25 7:24
webmystar
webmystar (Show more)
Friend of XOOPS
Posts: 415
Since: 2008/6/23
#3

Re: Xoops reCaptcha Class v1.00 beta

Thanks for your work, catzwolf. I will it testing soon.

trabis

Core Developer
Posted on: 2010/7/25 11:48
trabis
trabis (Show more)
Core Developer
Posts: 2268
Since: 2006/9/1 1
#4

Re: Xoops reCaptcha Class v1.00 beta

Thank you :)

Defkon1

Not too shy to talk
Posted on: 2010/8/25 11:06
Defkon1
Defkon1 (Show more)
Not too shy to talk
Posts: 151
Since: 2005/1/27
#5

Re: Xoops reCaptcha Class v1.00 beta

I'm trying to use your reCaptcha class in comment form, without success.

Following the readme.doc I copied your hacked core files and reCaptcha class to my server; so, I modified /include/comment_form.php (around line 92):

$cform->addElement(new XoopsFormCaptcha());   //original


in

$cform->addElement( new XoopsFormRecaptcha$caption$privatekey$publickey ),true );   //hack


Actually the reCaptcha widget is correctly shown (see attachment), but it doesn't perform any validation.
I tried with wrong code and even left blank, but the form is submitted anytime...

what's wrong?

thanks in advance

Resized Image

Defkon1

Not too shy to talk
Posted on: 2010/8/25 13:40
Defkon1
Defkon1 (Show more)
Not too shy to talk
Posts: 151
Since: 2005/1/27
#6

Re: Xoops reCaptcha Class v1.00 beta

i solved this way:

1- modified formrecaptcha.php

$this->reCaptchaHandler->setKeys$private_key$public_key );

changed in
$this->reCaptchaHandler->getConfig();


2 - recaptcha.php, line 135 changed

$this->setError$response->getError() );


in
$this->setError"empty-recaptcha" );


3 - comment_post.php in the "post" case (around line 146) added

//DFK   
      
require_once XOOPS_ROOT_PATH '/class/recaptcha.php';
      
$xoopsRecaptcha =& XoopsRecaptcha::getInstance();
      
$xoopsRecaptcha->getConfig();
       if (! 
$xoopsRecaptcha->doValidate() ) {
        
redirect_header($redirect_page '=' $com_itemid '&com_id=' $com_id '&com_mode=' $com_mode '&com_order=' $com_order1$xoopsRecaptcha->getErrors(true));      
       }
       
//DFK