1
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');