[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/extensions/ConfirmEdit/ -> Captcha.php (summary)

(no description)

File Size: 851 lines (24 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

SimpleCaptcha:: (39 methods):
  getCaptcha()
  addCaptchaAPI()
  getForm()
  editCallback()
  getMessage()
  injectEmailUser()
  injectUserCreate()
  injectUserLogin()
  triggerUserLogin()
  isBadLoginTriggered()
  isIPWhitelisted()
  badLoginKey()
  keyMatch()
  captchaTriggers()
  shouldCheck()
  filterLink()
  buildRegexes()
  getLinksFromTracker()
  doConfirmEdit()
  confirmEdit()
  confirmEditMerged()
  confirmEditAPI()
  confirmUserCreate()
  needCreateAccountCaptcha()
  confirmUserLogin()
  confirmEmailUser()
  isAPICaptchaModule()
  APIGetAllowedParams()
  APIGetParamDescription()
  passCaptcha()
  log()
  storeCaptcha()
  retrieveCaptcha()
  clearCaptcha()
  loadText()
  findLinks()
  showHelp()
  addNewAccountApiForm()
  addNewAccountApiResult()


Class: SimpleCaptcha  - X-Ref

getCaptcha()   X-Ref
No description

addCaptchaAPI( &$resultArr )   X-Ref
No description

getForm()   X-Ref
Insert a captcha prompt into the edit form.
This sample implementation generates a simple arithmetic operation;
it would be easy to defeat by machine.

Override this!

return: string HTML

editCallback( &$out )   X-Ref
Insert the captcha prompt into an edit form.

param: OutputPage $out

getMessage( $action )   X-Ref
Show a message asking the user to enter a captcha on edit
The result will be treated as wiki text

param: $action string Action being performed
return: string

injectEmailUser( &$form )   X-Ref
Inject whazawhoo

param: $form HTMLForm
return: bool true to keep running callbacks

injectUserCreate( &$template )   X-Ref
Inject whazawhoo

param: QuickTemplate $template
return: bool true to keep running callbacks

injectUserLogin( &$template )   X-Ref
Inject a captcha into the user login form after a failed
password attempt as a speedbump for mass attacks.

param: $template QuickTemplate
return: bool true to keep running callbacks

triggerUserLogin( $user, $password, $retval )   X-Ref
When a bad login attempt is made, increment an expiring counter
in the memcache cloud. Later checks for this may trigger a
captcha display to prevent too many hits from the same place.

param: User $user
param: string $password
param: int $retval authentication return value
return: bool true to keep running callbacks

isBadLoginTriggered()   X-Ref
Check if a bad login has already been registered for this
IP address. If so, require a captcha.

return: bool

isIPWhitelisted()   X-Ref
Check if the IP is allowed to skip captchas


badLoginKey()   X-Ref
Internal cache key for badlogin checks.

return: string

keyMatch( $answer, $info )   X-Ref
Check if the submitted form matches the captcha session data provided
by the plugin when the form was generated.

Override this!

param: string $answer
param: array $info
return: bool

captchaTriggers( &$editPage, $action )   X-Ref

param: EditPage $editPage
param: string $action (edit/create/addurl...)
return: bool true if action triggers captcha on editPage's namespace

shouldCheck( &$editPage, $newtext, $section, $merged = false )   X-Ref

param: $editPage EditPage
param: $newtext string
param: $section string
param: $merged bool
return: bool true if the captcha should run

filterLink( $url )   X-Ref
Filter callback function for URL whitelisting

param: $url string to check
return: bool true if unknown, false if whitelisted

buildRegexes( $lines )   X-Ref
Build regex from whitelist

param: $lines string from [[MediaWiki:Captcha-addurl-whitelist]]
return: array Regexes

getLinksFromTracker( $title )   X-Ref
Load external links from the externallinks table

param: $title Title
return: Array

doConfirmEdit( $editPage, $newtext, $section, $merged = false )   X-Ref
Backend function for confirmEdit() and confirmEditAPI()

param: $editPage EditPage
param: $newtext string
param: $section
param: $merged bool
return: bool false if the CAPTCHA is rejected, true otherwise

confirmEdit( $editPage, $newtext, $section, $merged = false )   X-Ref
The main callback run on edit attempts.

param: EditPage $editPage
param: string $newtext
param: string $section
param: bool $merged
return: bool true to continue saving, false to abort and show a captcha form

confirmEditMerged( $editPage, $newtext )   X-Ref
A more efficient edit filter callback based on the text after section merging

param: EditPage $editPage
param: string $newtext
return: bool

confirmEditAPI( $editPage, $newtext, &$resultArr )   X-Ref
No description

confirmUserCreate( $u, &$message, &$status = null )   X-Ref
Hook for user creation form submissions.

param: User $u
param: string $message
param: Status $status
return: bool true to continue, false to abort user creation

needCreateAccountCaptcha()   X-Ref
Logic to check if we need to pass a captcha for the current user
to create a new account, or not

return: bool true to show captcha, false to skip captcha

confirmUserLogin( $u, $pass, &$retval )   X-Ref
Hook for user login form submissions.

param: $u User
param: $pass
param: $retval
return: bool true to continue, false to abort user creation

confirmEmailUser( $from, $to, $subject, $text, &$error )   X-Ref
Check the captcha on Special:EmailUser

param: $from MailAddress
param: $to MailAddress
param: $subject String
param: $text String
param: $error String reference
return: Bool true to continue saving, false to abort and show a captcha form

isAPICaptchaModule( $module )   X-Ref

param: $module ApiBase
return: bool

APIGetAllowedParams( &$module, &$params, $flags )   X-Ref

param: $module ApiBase
param: $params array
param: $flags int
return: bool

APIGetParamDescription( &$module, &$desc )   X-Ref

param: $module ApiBase
param: $desc array
return: bool

passCaptcha()   X-Ref
Given a required captcha run, test form input for correct
input on the open session.

return: bool if passed, false if failed or new session

log( $message )   X-Ref
Log the status and any triggering info for debugging or statistics

param: string $message

storeCaptcha( $info )   X-Ref
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.

param: array $info data to store
return: string captcha ID key

retrieveCaptcha()   X-Ref
Fetch this session's captcha info.

return: mixed array of info, or false if missing

clearCaptcha( $info )   X-Ref
Clear out existing captcha info from the session, to ensure
it can't be reused.


loadText( $editPage, $section )   X-Ref
Retrieve the current version of the page or section being edited...

param: EditPage $editPage
param: string $section
return: string

findLinks( &$editpage, $text )   X-Ref
Extract a list of all recognized HTTP links in the text.

param: $editpage EditPage
param: $text string
return: array of strings

showHelp()   X-Ref
Show a page explaining what this wacky thing is.


addNewAccountApiForm( $apiModule, $loginForm )   X-Ref
Pass API captcha parameters on to the login form when using
API account creation.

param: ApiCreateAccount $apiModule
param: LoginForm $loginForm
return: hook return value

addNewAccountApiResult( $apiModule, $loginPage, &$result )   X-Ref
Pass extra data back in API results for account creation.

param: ApiCreateAccount $apiModule
param: LoginForm &loginPage
param: array &$result
return: bool: Hook return value



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1