MediaWiki REL1_32
ReCaptchaNoCaptcha Class Reference
Inheritance diagram for ReCaptchaNoCaptcha:
Collaboration diagram for ReCaptchaNoCaptcha:

Public Member Functions

 apiGetAllowedParams (&$module, &$params, $flags)
 
 createAuthenticationRequest ()
 
 describeCaptchaType ()
 
 getCaptcha ()
 Returns an array with 'question' and 'answer' keys.
 
 getCaptchaInfo ( $captchaData, $id)
 
 getError ()
 Return the error from the last passCaptcha* call.
 
 getFormInformation ( $tabIndex=1)
 Get the captcha form.
 
 getMessage ( $action)
 Show a message asking the user to enter a captcha on edit The result will be treated as wiki text.
 
 onAuthChangeFormFields (array $requests, array $fieldInfo, array &$formDescriptor, $action)
 
 retrieveCaptcha ( $index)
 Fetch this session's captcha info.
 
 storeCaptcha ( $info)
 Generate a captcha session ID and save the info in PHP's session storage.
 
- Public Member Functions inherited from SimpleCaptcha
 addFormInformationToOutput (OutputPage $out, array $formInformation)
 Processes the given $formInformation array and adds the options (see getFormInformation()) to the given OutputPage object.
 
 addFormToOutput (OutputPage $out, $tabIndex=1)
 Uses getFormInformation() to get the CAPTCHA form and adds it to the given OutputPage object.
 
 canSkipCaptcha ( $user, Config $config)
 Check whether the user provided / IP making the request is allowed to skip captchas.
 
 captchaTriggers ( $title, $action)
 
 clearCaptcha ( $index)
 Clear out existing captcha info from the session, to ensure it can't be reused.
 
 confirmEditMerged ( $context, $content, $status, $summary, $user, $minorEdit)
 An efficient edit filter callback based on the text after section merging.
 
 confirmEmailUser ( $from, $to, $subject, $text, &$error)
 Check the captcha on Special:EmailUser.
 
 editShowCaptcha ( $editPage)
 Insert the captcha prompt into an edit form.
 
 increaseBadLoginCounter ( $username)
 Increase bad login counter after a failed login.
 
 injectEmailUser (&$form)
 Inject whazawhoo @fixme if multiple thingies insert a header, could break.
 
 isBadLoginPerUserTriggered ( $u)
 Is the per-user captcha triggered?
 
 isBadLoginTriggered ()
 Check if a bad login has already been registered for this IP address.
 
 needCreateAccountCaptcha (User $creatingUser=null)
 Logic to check if we need to pass a captcha for the current user to create a new account, or not.
 
 passCaptchaFromRequest (WebRequest $request, User $user)
 Given a required captcha run, test form input for correct input on the open session.
 
 passCaptchaLimited ( $index, $word, User $user)
 Checks, if the user reached the amount of false CAPTCHAs and give him some vacation or run self::passCaptcha() and clear counter if correct.
 
 passCaptchaLimitedFromRequest (WebRequest $request, User $user)
 Checks, if the user reached the amount of false CAPTCHAs and give him some vacation or run self::passCaptcha() and clear counter if correct.
 
 resetBadLoginCounter ( $username)
 Reset bad login counter after a successful login.
 
 setAction ( $action)
 
 setTrigger ( $trigger)
 
 shouldCheck (WikiPage $page, $content, $section, $context, $oldtext=null)
 
 showEditFormFields (&$editPage, &$out)
 Show error message for missing or incorrect captcha on EditPage.
 
 showHelp ()
 Show a page explaining what this wacky thing is.
 
 triggersCaptcha ( $action, $title=null)
 Checks, whether the passed action should trigger a CAPTCHA.
 

Protected Member Functions

 addCaptchaAPI (&$resultArr)
 
 getCaptchaParamsFromRequest (WebRequest $request)
 
 logCheckError ( $info)
 
 passCaptcha ( $_, $word)
 Check, if the user solved the captcha.
 
- Protected Member Functions inherited from SimpleCaptcha
 isAPICaptchaModule ( $module)
 
 keyMatch ( $answer, $info)
 Check if the submitted form matches the captcha session data provided by the plugin when the form was generated.
 
 log ( $message)
 Log the status and any triggering info for debugging or statistics.
 

Static Protected Attributes

static $messagePrefix = 'renocaptcha-'
 
- Static Protected Attributes inherited from SimpleCaptcha
static $messagePrefix = 'captcha-'
 

Private Attributes

 $error = null
 

Additional Inherited Members

- Protected Attributes inherited from SimpleCaptcha
string $action
 Used to select the right message.
 
string $trigger
 Used in log messages.
 

Detailed Description

Definition at line 5 of file ReCaptchaNoCaptcha.php.

Member Function Documentation

◆ addCaptchaAPI()

ReCaptchaNoCaptcha::addCaptchaAPI ( & $resultArr)
protected
Parameters
array&$resultArr

Reimplemented from SimpleCaptcha.

Definition at line 138 of file ReCaptchaNoCaptcha.php.

References $error, and describeCaptchaType().

◆ apiGetAllowedParams()

ReCaptchaNoCaptcha::apiGetAllowedParams ( & $module,
& $params,
$flags )
Parameters
ApiBase&$module
array&$params
int$flags
Returns
bool

Reimplemented from SimpleCaptcha.

Definition at line 176 of file ReCaptchaNoCaptcha.php.

References $params, SimpleCaptcha\isAPICaptchaModule(), and ApiBase\PARAM_HELP_MSG.

◆ createAuthenticationRequest()

ReCaptchaNoCaptcha::createAuthenticationRequest ( )
Returns
ReCaptchaNoCaptchaAuthenticationRequest

Reimplemented from SimpleCaptcha.

Definition at line 218 of file ReCaptchaNoCaptcha.php.

◆ describeCaptchaType()

ReCaptchaNoCaptcha::describeCaptchaType ( )
Returns
array

Reimplemented from SimpleCaptcha.

Definition at line 146 of file ReCaptchaNoCaptcha.php.

Referenced by addCaptchaAPI().

◆ getCaptcha()

ReCaptchaNoCaptcha::getCaptcha ( )

Returns an array with 'question' and 'answer' keys.

Subclasses might use different structure. Since MW 1.27 all subclasses must implement this method.

Returns
array

Reimplemented from SimpleCaptcha.

Definition at line 201 of file ReCaptchaNoCaptcha.php.

◆ getCaptchaInfo()

ReCaptchaNoCaptcha::getCaptchaInfo ( $captchaData,
$id )
Parameters
array$captchaData
string$id
Returns
Message

Reimplemented from SimpleCaptcha.

Definition at line 211 of file ReCaptchaNoCaptcha.php.

References wfMessage().

◆ getCaptchaParamsFromRequest()

ReCaptchaNoCaptcha::getCaptchaParamsFromRequest ( WebRequest $request)
protected
Parameters
WebRequest$request
Returns
array

Reimplemented from SimpleCaptcha.

Definition at line 82 of file ReCaptchaNoCaptcha.php.

References $request, and $response.

◆ getError()

ReCaptchaNoCaptcha::getError ( )

Return the error from the last passCaptcha* call.

Not implemented but needed by some child classes.

Returns
mixed

Reimplemented from SimpleCaptcha.

Definition at line 186 of file ReCaptchaNoCaptcha.php.

References $error.

◆ getFormInformation()

ReCaptchaNoCaptcha::getFormInformation ( $tabIndex = 1)

Get the captcha form.

Parameters
int$tabIndex
Returns
array

Reimplemented from SimpleCaptcha.

Definition at line 16 of file ReCaptchaNoCaptcha.php.

References $lang, $output, $wgLang, div, and style.

◆ getMessage()

ReCaptchaNoCaptcha::getMessage ( $action)

Show a message asking the user to enter a captcha on edit The result will be treated as wiki text.

Parameters
string$actionAction being performed
Returns
string Wikitext

Reimplemented from SimpleCaptcha.

Definition at line 162 of file ReCaptchaNoCaptcha.php.

References SimpleCaptcha\$action.

◆ logCheckError()

ReCaptchaNoCaptcha::logCheckError ( $info)
protected
Parameters
Status | array | string$info

Definition at line 65 of file ReCaptchaNoCaptcha.php.

References $error, and wfDebugLog().

Referenced by passCaptcha().

◆ onAuthChangeFormFields()

ReCaptchaNoCaptcha::onAuthChangeFormFields ( array $requests,
array $fieldInfo,
array & $formDescriptor,
$action )
Parameters
array$requests
array$fieldInfo
array&$formDescriptor
string$action

Reimplemented from SimpleCaptcha.

Definition at line 228 of file ReCaptchaNoCaptcha.php.

References $formDescriptor, $req, $requests, and ConfirmEditHooks\getInstance().

◆ passCaptcha()

ReCaptchaNoCaptcha::passCaptcha ( $_,
$word )
protected

Check, if the user solved the captcha.

Based on reference implementation: https://github.com/google/recaptcha#php

Parameters
mixed$_Not used (ReCaptcha v2 puts index and solution in a single string)
string$wordcaptcha solution
Returns
bool

Reimplemented from SimpleCaptcha.

Definition at line 100 of file ReCaptchaNoCaptcha.php.

References $request, $response, $wgRequest, logCheckError(), and wfAppendQuery().

◆ retrieveCaptcha()

ReCaptchaNoCaptcha::retrieveCaptcha ( $index)

Fetch this session's captcha info.

Parameters
string$index
Returns
array|false array of info, or false if missing

Reimplemented from SimpleCaptcha.

Definition at line 196 of file ReCaptchaNoCaptcha.php.

◆ storeCaptcha()

ReCaptchaNoCaptcha::storeCaptcha ( $info)

Generate a captcha session ID and save the info in PHP's session storage.

(Requires the user to have cookies enabled to get through the captcha.)

A random ID is used so legit users can make edits in multiple tabs or windows without being unnecessarily hobbled by a serial order requirement. Pass the returned id value into the edit form as wpCaptchaId.

Parameters
array$infodata to store
Returns
string captcha ID key

Reimplemented from SimpleCaptcha.

Definition at line 190 of file ReCaptchaNoCaptcha.php.

Member Data Documentation

◆ $error

ReCaptchaNoCaptcha::$error = null
private

Definition at line 10 of file ReCaptchaNoCaptcha.php.

Referenced by addCaptchaAPI(), getError(), and logCheckError().

◆ $messagePrefix

ReCaptchaNoCaptcha::$messagePrefix = 'renocaptcha-'
staticprotected

Definition at line 8 of file ReCaptchaNoCaptcha.php.


The documentation for this class was generated from the following file: