This is a Captcha HOWTO for XOOPS 2.2. Maybe you have different versions so I've added the approximatly line and a piece of the code.
[size=x-large]REGISTER[/size]File: modules/profiles/include/forms.php
Line: 331
if ($xoopsModuleConfig['display_disclaimer'] != 0 && $xoopsModuleConfig['disclaimer'] != '') {
$disc_tray = new XoopsFormElementTray(_PROFILE_MA_DISCLAIMER, '
');
$disc_text = new XoopsFormLabel("", "padding: 5px;">".$GLOBALS["myts"]->displayTarea($xoopsModuleConfig['disclaimer'],1)."
");
// Should we define a div.xoopsStatement class in style.css?
$disc_tray->addElement($disc_text);
$agree_chk = new XoopsFormCheckBox('', 'agree_disc');
$agree_chk->addOption(1, _PROFILE_MA_IAGREE);
$disc_tray->addElement($agree_chk);
$reg_form->addElement($disc_tray);
}
$reg_form->addElement(new XoopsFormHidden("op", "newuser"));
[color=CC0000] // Captcha Hack
$reg_form->addElement(new XoopsFormCaptcha());
// Captcha Hack[/color]
$reg_form->addElement(new XoopsFormButton("", "submit", _PROFILE_MA_SUBMIT, "submit"));
return $reg_form;
}
File: modules/profiles/register.php
Line: 81
if ( strcmp(trim($_POST['pass']), trim($_POST['vpass'])) ) {
$stop .= _PROFILE_MA_PASSNOTSAME."
";
}elseif (!empty($xoopsModuleConfig['minpass']) && strlen(trim($_POST['pass'])) < $xoopsModuleConfig['minpass']) {
$stop .= sprintf(_PROFILE_MA_PWDTOOSHORT,$xoopsModuleConfig['minpass'])."
";
}
$stop .= userCheck($newuser);
[color=CC0000] // Captcha Hack
if (@include_once XOOPS_ROOT_PATH."/Frameworks/captcha/captcha.php") {
$xoopsCaptcha = XoopsCaptcha::instance();
if (! $xoopsCaptcha->verify() ) {
$stop .= $xoopsCaptcha->getMessage()."
";
}
}
// Captcha Hack[/color]
if (empty($stop)) {
echo _PROFILE_MA_USERNAME.": ".$newuser->getVar('loginname')."
";
echo _PROFILE_MA_EMAIL.": ".$newuser->getVar('email')."
";
echo _PROFILE_MA_DISPLAYNAME.": ".$newuser->getVar('uname')."
";
[size=x-large]COMMENTS[/size]File: include/comment_form.php
Line: 121
if ('system' != $xoopsModule->getVar('dirname')) {
$comment_config = $xoopsModule->getInfo('comments');
if (isset($comment_config['extraParams']) && is_array($comment_config['extraParams'])) {
$myts =& MyTextSanitizer::getInstance();
foreach ($comment_config['extraParams'] as $extra_param) {
// This routine is included from forms accessed via both GET and POST
if (isset($_REQUEST[$extra_param])) {
$hidden_value = htmlspecialchars($_REQUEST[$extra_param]);
} else {
$hidden_value = '';
}
$cform->addElement(new XoopsFormHidden($extra_param, $hidden_value));
}
}
}
[color=CC0000]// Captcha Hack
$cform->addElement(new XoopsFormCaptcha());
// Captcha Hack[/color]
$button_tray->addElement(new XoopsFormButton('', 'com_dopreview', _PREVIEW, 'submit'));
$button_tray->addElement(new XoopsFormButton('', 'com_dopost', _CM_POSTCOMMENT, 'submit'));
$cform->addElement($button_tray);
$cform->display();
File: include/comment_post.php
Line: 141
} else {
xoops_cp_header();
themecenterposts($com_title, $p_comment);
include XOOPS_ROOT_PATH.'/include/comment_form.php';
xoops_cp_footer();
}
break;
case "post":
[color=CC0000] // Captcha Hack
if(@include_once XOOPS_ROOT_PATH . "/Frameworks/captcha/captcha.php") {
$xoopsCaptcha = XoopsCaptcha::instance();
if(! $xoopsCaptcha->verify(true) ) {
redirect_header($redirect_page.'='.$com_itemid.'&com_id='.$com_id.'&com_mode='.$com_mode.'&com_order='.$com_order, 2, $xoopsCaptcha->getMessage());
}
}
// Captcha Hack[/color]
$doimage = 1;
$comment_handler =& xoops_gethandler('comment');
$add_userpost = false;
$call_approvefunc = false;
$call_updatefunc = false;
// RMV-NOTIFY - this can be set to 'comment' or 'comment_submit'
$notify_event = false;
[size=x-large]SUBMIT NEWS[/size]File: modules/news/include/storyform.inc.php
Line: 185
if (is_object($xoopsUser)) {
$notify_checkbox = new XoopsFormCheckBox('', 'notifypub', $notifypub);
$notify_checkbox->addOption(1, _NW_NOTIFYPUBLISH);
$option_tray->addElement($notify_checkbox);
if ($xoopsUser->isAdmin($xoopsModule->getVar('mid'))) {
$nohtml_checkbox = new XoopsFormCheckBox('', 'nohtml', $nohtml);
$nohtml_checkbox->addOption(1, _DISABLEHTML);
$option_tray->addElement($nohtml_checkbox);
}
}
$smiley_checkbox = new XoopsFormCheckBox('', 'nosmiley', $nosmiley);
$smiley_checkbox->addOption(1, _DISABLESMILEY);
$option_tray->addElement($smiley_checkbox);
$sform->addElement($option_tray);
[color=CC0000]// Captcha Hack
$sform->addElement(new XoopsFormCaptcha());
// Captcha Hack[/color]
//TODO: Approve checkbox + "Move to top" if editing + Edit indicator
//Submit buttons
$button_tray = new XoopsFormElementTray('' ,'');
$preview_btn = new XoopsFormButton('', 'preview', _PREVIEW, 'submit');
$preview_btn->setExtra('accesskey="p"');
$button_tray->addElement($preview_btn);
$submit_btn = new XoopsFormButton('', 'post', _NW_POST, 'submit');
$submit_btn->setExtra('accesskey="s"');
$button_tray->addElement($submit_btn);
$sform->addElement($button_tray);
File: modules/news/include/submit.php
Line: 300
//Display post edit form
$returnside=intval($_POST['returnside']);
include_once XOOPS_ROOT_PATH.'/modules/news/include/storyform.inc.php';
break;
case 'post':
[color=CC0000]// Captcha Hack
if(@include_once XOOPS_ROOT_PATH . "/Frameworks/captcha/captcha.php") {
$xoopsCaptcha = XoopsCaptcha::instance();
if(! $xoopsCaptcha->verify(true) ) {
redirect_header(XOOPS_URL.'/modules/news/submit.php', 2, $xoopsCaptcha->getMessage());
}
}
// Captcha Hack[/color]
$nohtml_db = isset($_POST['nohtml']) ? $_POST['nohtml'] : 1;
if (is_object($xoopsUser) ) {
$uid = $xoopsUser->getVar('uid');
if ($approveprivilege) {
$nohtml_db = empty($_POST['nohtml']) ? 0 : 1;
}
if (isset($_POST['author']) && ($approveprivilege || $xoopsUser->isAdmin($xoopsModule->mid())) ) {
$uid=intval($_POST['author']);
}
} else {
$uid = 0;
}