mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-09-23 18:30:21 +00:00
File missing from r86820. Actually these changes should have been committed in r86813...
This commit is contained in:
parent
e28655e124
commit
f856872f83
22
Captcha.php
22
Captcha.php
|
@ -218,20 +218,6 @@ abstract class Captcha {
|
||||||
|
|
||||||
class SimpleCaptcha {
|
class SimpleCaptcha {
|
||||||
|
|
||||||
/**
|
|
||||||
* @var CaptchaStore
|
|
||||||
*/
|
|
||||||
protected $storage;
|
|
||||||
|
|
||||||
function __construct() {
|
|
||||||
global $wgCaptchaStorageClass;
|
|
||||||
if( in_array( 'CaptchaStore', class_implements( $wgCaptchaStorageClass ) ) ) {
|
|
||||||
$this->storage = new $wgCaptchaStorageClass;
|
|
||||||
} else {
|
|
||||||
throw new MWException( "Invalid CaptchaStore class $wgCaptchaStorageClass" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCaptcha() {
|
function getCaptcha() {
|
||||||
$a = mt_rand( 0, 100 );
|
$a = mt_rand( 0, 100 );
|
||||||
$b = mt_rand( 0, 10 );
|
$b = mt_rand( 0, 10 );
|
||||||
|
@ -835,7 +821,7 @@ class SimpleCaptcha {
|
||||||
// Assign random index if we're not udpating
|
// Assign random index if we're not udpating
|
||||||
$info['index'] = strval( mt_rand() );
|
$info['index'] = strval( mt_rand() );
|
||||||
}
|
}
|
||||||
$this->storage->store( $info['index'], $info );
|
CaptchaStore::get()->store( $info['index'], $info );
|
||||||
return $info['index'];
|
return $info['index'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -846,7 +832,7 @@ class SimpleCaptcha {
|
||||||
function retrieveCaptcha() {
|
function retrieveCaptcha() {
|
||||||
global $wgRequest;
|
global $wgRequest;
|
||||||
$index = $wgRequest->getVal( 'wpCaptchaId' );
|
$index = $wgRequest->getVal( 'wpCaptchaId' );
|
||||||
return $this->storage->retrieve( $index );
|
return CaptchaStore::get()->retrieve( $index );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -854,7 +840,7 @@ class SimpleCaptcha {
|
||||||
* it can't be reused.
|
* it can't be reused.
|
||||||
*/
|
*/
|
||||||
function clearCaptcha( $info ) {
|
function clearCaptcha( $info ) {
|
||||||
$this->storage->clear( $info['index'] );
|
CaptchaStore::get()->clear( $info['index'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -901,7 +887,7 @@ class SimpleCaptcha {
|
||||||
global $wgOut;
|
global $wgOut;
|
||||||
$wgOut->setPageTitle( wfMsg( 'captchahelp-title' ) );
|
$wgOut->setPageTitle( wfMsg( 'captchahelp-title' ) );
|
||||||
$wgOut->addWikiText( wfMsg( 'captchahelp-text' ) );
|
$wgOut->addWikiText( wfMsg( 'captchahelp-text' ) );
|
||||||
if ( $this->storage->cookiesNeeded() ) {
|
if ( CaptchaStore::get()->cookiesNeeded() ) {
|
||||||
$wgOut->addWikiText( wfMsg( 'captchahelp-cookies-needed' ) );
|
$wgOut->addWikiText( wfMsg( 'captchahelp-cookies-needed' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue