1
GlaDiaC
Re: Frameworks Captcha
  • 2007/9/3 12:25

  • GlaDiaC

  • Just popping in

  • Posts: 16

  • Since: 2003/9/21


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'] != && $xoopsModuleConfig['disclaimer'] != '') {
        
$disc_tray = new XoopsFormElementTray(_PROFILE_MA_DISCLAIMER'<br />');
        
$disc_text = new XoopsFormLabel("""<div style="padding5px;">".$GLOBALS["myts"]->displayTarea($xoopsModuleConfig['disclaimer'],1)."</div>");
        
// 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."<br />";
    }elseif (!empty(
$xoopsModuleConfig['minpass']) && strlen(trim($_POST['pass'])) < $xoopsModuleConfig['minpass']) {
        
$stop .= sprintf(_PROFILE_MA_PWDTOOSHORT,$xoopsModuleConfig['minpass'])."<br />";
    }
    
$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()."<br />";
        }
    }
    
// Captcha Hack[/color]
    
if (empty($stop)) {
        echo 
_PROFILE_MA_USERNAME.": ".$newuser->getVar('loginname')."<br />";
        echo 
_PROFILE_MA_EMAIL.": ".$newuser->getVar('email')."<br />";
        echo 
_PROFILE_MA_DISPLAYNAME.": ".$newuser->getVar('uname')."<br />";




[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_order2$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']) ? 1;
            }
            if (isset(
$_POST['author']) && ($approveprivilege || $xoopsUser->isAdmin($xoopsModule->mid())) ) {
                
$uid=intval($_POST['author']);
            }
        } else {
            
$uid 0;
        }



2
GlaDiaC
Re: NewBB Spam Posts - Any simple challenge hack avail?
  • 2006/7/27 7:09

  • GlaDiaC

  • Just popping in

  • Posts: 16

  • Since: 2003/9/21


Here are my bugfixes for PHP 5+

http://www.linux-gamers.net/uploads/securityimage.php.txt

if (defined('SECURITYIMAGE_INCLUDED')) {

    
$security_image = new SecurityImage(_SECURITYIMAGE_GETCODE);
        
$security_image->init();
    if (
$security_image->render()) {
        
$form->addElement($security_imagetrue);
    }
}


include_once(XOOPS_ROOT_PATH "/class/xoopsformloader.php");

$security_image = new SecurityImage(_SECURITYIMAGE_GETCODE);
if ( 
defined('SECURITYIMAGE_INCLUDED') && !$security_image->checkSecurityImage() ) {

    
redirect_header'lien de redirection'2_SECURITYIMAGE_ERROR ) ;

    exit();

}


Xoops should have a securityimage as a core functionality.

-- andreas



3
GlaDiaC
showrblock on redirect page?
  • 2005/8/2 15:32

  • GlaDiaC

  • Just popping in

  • Posts: 16

  • Since: 2003/9/21


Hi,

I think there is a bug in the redirect_header function in include/functions.php

I see a line

$xTheme->tplEngine->assign('xoops_showrblock', 1);

which displays always an empty block column on the right. Looks like a line which shouldn't be there.



4
GlaDiaC
Re: With 2.2RC2, is PHP Debug required?
  • 2005/7/28 17:54

  • GlaDiaC

  • Just popping in

  • Posts: 16

  • Since: 2003/9/21


Disable gzip compression and it will work...



5
GlaDiaC
Missing hspace and vspace opton on images
  • 2003/11/16 21:49

  • GlaDiaC

  • Just popping in

  • Posts: 16

  • Since: 2003/9/21


it would be great, if you could add vspace and hspace option to the images. only the align option isn't usefull.





TopTop



Login

Who's Online

145 user(s) are online (84 user(s) are browsing Support Forums)


Members: 0


Guests: 145


more...

Donat-O-Meter

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

Latest GitHub Commits