Bug #3656 ยป 3656.patch
components/com_comprofiler/plugin/user/plug_cbcaptcha/cb.captcha.php | ||
---|---|---|
}
|
||
|
||
class getcaptchaTab extends cbTabHandler {
|
||
var $_captchaSession = null;
|
||
var $_captchaSession = null;
|
||
var $_captchaInput = 0;
|
||
var $_captchaInput = 0;
|
||
var $_captchaCodePrev = null;
|
||
var $_captchaInputNamePrev = null;
|
||
/**
|
||
* Constructor
|
||
*/
|
||
... | ... | |
$cbcaptchaparms['captchaNoiseRGB'] = '100,120,180';
|
||
}
|
||
$cbcaptchaparms['captchaSecurityMode'] = $params->get('captchaSecurityMode', 0);
|
||
|
||
|
||
$captchaSession =& $this->_sessionGet();
|
||
|
||
if ( ( ! $this->_captchaCodePrev ) && isset( $captchaSession['cbcaptchaparams']['captchaCode'] ) ) {
|
||
$this->_captchaCodePrev = $captchaSession['cbcaptchaparams']['captchaCode'];
|
||
}
|
||
|
||
if ( ( ! $this->_captchaInputNamePrev ) && isset( $captchaSession['cbcaptchaparams']['captchaInputName'] ) ) {
|
||
$this->_captchaInputNamePrev = $captchaSession['cbcaptchaparams']['captchaInputName'];
|
||
}
|
||
|
||
$cbcaptchaparms['captchaCode'] = $this->_generateCode( $cbcaptchaparms['captchaNumChars'], $cbcaptchaparms['captchaCharSet'] );
|
||
$cbcaptchaparms['captchaCode'] = $this->_generateCode( $cbcaptchaparms['captchaNumChars'], $cbcaptchaparms['captchaCharSet'] );
|
||
$cbcaptchaparms['captchaInputName'] = $this->_generateCode( mt_rand( 30, 40 ), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' );
|
||
$cbcaptchaparms['captchaInputName'] = $this->_generateCode( mt_rand( 30, 40 ), 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' );
|
||
|
||
$captchaSession =& $this->_sessionGet();
|
||
$captchaSession['cbcaptchaparams'] = $cbcaptchaparms; // this is needed to send data to stand-alone php file
|
||
$this->_sessionSave();
|
||
}
|
||
... | ... | |
|
||
$honeypot = stripslashes( cbGetParam( $_POST, 'full_address', '', _CB_NOTRIM ) );
|
||
$captchaSession =& $this->_sessionGet();
|
||
|
||
// use previous inputname and code only if they exist:
|
||
if ( $this->_captchaInputNamePrev && $this->_captchaCodePrev ) {
|
||
$inputName = $this->_captchaInputNamePrev;
|
||
$captchaCode = $this->_captchaCodePrev;
|
||
$previous = true;
|
||
} else {
|
||
$inputName = $captchaSession['cbcaptchaparams']['captchaInputName'];
|
||
$inputName = $captchaSession['cbcaptchaparams']['captchaInputName'];
|
||
$captchaCode = $captchaSession['cbcaptchaparams']['captchaCode'];
|
||
$previous = false;
|
||
}
|
||
|
||
$typedValue = cbGetParam( $_POST, $inputName );
|
||
if ( ( $captchaSession['cbcaptchaparams']['captchaCode'] == $typedValue )
|
||
&& ( ! empty($captchaSession['cbcaptchaparams']['captchaCode'] ) )
|
||
&& ( $honeypot === '' ) )
|
||
{
|
||
|
||
if ( ( $captchaCode == $typedValue ) && ( ! empty( $captchaCode ) ) && ( $honeypot === '' ) ) {
|
||
// don't delete the session data if we used previous inputname and code so new captcha rendered functions:
|
||
if ( ! $previous ) {
|
||
unset( $captchaSession['cbcaptchaparams'] );
|
||
unset( $captchaSession['cbcaptchaparams'] );
|
||
}
|
||
$this->_sessionSave();
|
||
} else {
|
||
$_PLUGINS->raiseError( 0 );
|