1
robstockley
Xoops 2.4.1 + Liaise 1.5 + Captcha = Working

Xoops Version: 2.4.1
Liaise Version: 1.5

Only tested with the above versions.

Captcha is built into XOOPS 2.4.1 so only two small changes required in Liaise form handlers. I've set it up so that only anonymous users will be prompted for the captcha security code. Logged in users will not see it.

Future development: Enable per-form disabling of the captcha security code. For now it appears on all forms for anonymous users.

One known bug: Errors on the form including captcha errors are handled properly and redirected back to the form for correction. The captcha security code must be re-entered even though the captcha code may have been correct and still appears to match.

All comments welcome.
Rob

modules/liaise/include/form_render.php following line 57
$form_output->addElement(new XoopsFormHidden('form_id'$form->getVar('form_id')));

# Captcha Security Hack by Rob Stockley ------------------------------------
xoops_load("XoopsFormCaptcha");
if( !
is_object($GLOBALS['xoopsUser'])) {
    
$form_output->addElement(new XoopsFormCaptcha(), true);
}
# Captcha Security Hack by Rob Stockley ------------------------------------

$form_output->addElement(new XoopsFormButton('''submit'$form->getVar('form_submit_text'), 'submit'));


modules/liaise/include/form_execute.php following line 58
if( isset($_POST['xoops_upload_file']) && is_array($_POST['xoops_upload_file']) ){
    foreach( 
$_POST['xoops_upload_file'] as $k => $v ){
        
$n explode("_"$v);
        
$ele[$n[1]] = $v;
    }
}

# Captcha Security Hack by Rob Stockley ------------------------------------
xoops_load("captcha");
$xoopsCaptcha XoopsCaptcha::getInstance();
if (!
$xoopsCaptcha->verify()) {
    
$err[] = $xoopsCaptcha->getMessage();
}
# Captcha Security Hack by Rob Stockley ------------------------------------

foreach( $elements as $i ){
    
$ele_id $i->getVar('ele_id');
    
$ele_type $i->getVar('ele_type');


2
robstockley
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working

Oh yeah. To get the admin pages in Liaise 1.5 to work under 2.4.1 I had to comment out line 41 in modules/liaise/admin/admin_header.php in accordance with this post.
Rob

3
bjuti
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working
  • 2009/12/11 15:16

  • bjuti

  • Just can't stay away

  • Posts: 871

  • Since: 2009/1/7 2


Why don't you use xForms module? It's Liaise clone, but it works well to me. :)

4
robstockley
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working

Thanks for the tip regards xForms. I've been away from XOOPS for a long time so simply went with what I've used before. I just downloaded xForms from here and installed it on my test site. Captcha is displayed on the form alright but there is no code in form_execute.php to check whether the key entered is correct. The form succeeds regardless of the captcha element. The code in form_render.php is close to what I came up with.

I don't speak German so perhaps the link was a development version. I couldn't find xForms in the module repository.

licence.txt points to http://www.dylian.melgert.net/ but I can't find a copy of xForms there either. Again that could be my lack of language skills.

I prefer main trunk modules in active development to (potentially) version specific clones. Only exception is where the necessary hacks are significant.

5
ghia
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working
  • 2009/12/12 1:53

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


See this.

6
robstockley
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working

Thanks. That's a different version of xForms than the one I found searching this forum. Perhaps I'm going blind but I still can't find any code to authenticate the captcha element. All I see is the element included on the form.

7
frankblack
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working
  • 2009/12/12 7:43

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


A bit OT: I found somewhere an interesting discussion (can't remember where) about the benefits and drawbacks of javascript based captchas. Since my module is nearly one third javascript I thought it would be a good idea to build in a javascript solution.

Benefit: bots don't know javascript (yet) and don't click (yet)
Drawback: you need javascript and you have to click

I found another (more nice) solution, but THIS is working without a flaw. I adapted it for my use. If anyone wants to have code examples, just tell me.

HERE is the other captcha

8
robstockley
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working

That is way cool. I've just implemented recaptcha from here and here.

I especially like the second one where you drag the object. Looks as though I'm not finished for the evening yet.

9
Dylian
Re: Xoops 2.4.1 + Liaise 1.5 + Captcha = Working
  • 2009/12/13 14:04

  • Dylian

  • Friend of XOOPS

  • Posts: 237

  • Since: 2007/7/21


Updated the package (Thanks for reporting).

DOWNLOAD: http://www.dylian.eu/downloads/xoops.modules/xforms

Greets Dylian.

BTW Final version of xforms will have rewrite options (somelike in my download url)

Login

Who's Online

203 user(s) are online (66 user(s) are browsing Support Forums)


Members: 0


Guests: 203


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits