MediaWiki REL1_32
recaptchalib.php File Reference

Go to the source code of this file.

Classes

class  ReCaptchaResponse
 A ReCaptchaResponse is returned from recaptcha_check_answer() More...
 

Functions

 _recaptcha_aes_encrypt ( $val, $ky)
 
 _recaptcha_aes_pad ( $val)
 
 _recaptcha_http_post ( $host, $path, $data, $port=80)
 Submits an HTTP POST to a reCAPTCHA server.
 
 _recaptcha_mailhide_email_parts ( $email)
 
 _recaptcha_mailhide_urlbase64 ( $x)
 
 _recaptcha_qsencode ( $data)
 Encodes the given data into a query string format.
 
 recaptcha_check_answer ( $privkey, $remoteip, $challenge, $response, $extra_params=array())
 Calls an HTTP POST function to verify if the user's guess was correct.
 
 recaptcha_get_html ( $pubkey, $error=null, $use_ssl=false)
 Gets the challenge HTML (javascript and non-javascript version).
 
 recaptcha_get_signup_url ( $domain=null, $appname=null)
 gets a URL where the user can sign up for reCAPTCHA.
 
 recaptcha_mailhide_html ( $pubkey, $privkey, $email)
 Gets html to display an email address given a public an private key.
 
 recaptcha_mailhide_url ( $pubkey, $privkey, $email)
 

Variables

const RECAPTCHA_API_SECURE_SERVER "https://www.google.com/recaptcha/api"
 
const RECAPTCHA_API_SERVER "http://www.google.com/recaptcha/api"
 This is a PHP library that handles calling reCAPTCHA.
 
const RECAPTCHA_VERIFY_SERVER "www.google.com"
 

Function Documentation

◆ _recaptcha_aes_encrypt()

_recaptcha_aes_encrypt ( $val,
$ky )

Definition at line 214 of file recaptchalib.php.

References _recaptcha_aes_pad().

Referenced by recaptcha_mailhide_url().

◆ _recaptcha_aes_pad()

_recaptcha_aes_pad ( $val)

Definition at line 206 of file recaptchalib.php.

Referenced by _recaptcha_aes_encrypt().

◆ _recaptcha_http_post()

_recaptcha_http_post ( $host,
$path,
$data,
$port = 80 )

Submits an HTTP POST to a reCAPTCHA server.

Parameters
string$host
string$path
array$data
intport
Returns
array response

Definition at line 67 of file recaptchalib.php.

References $req, $response, and _recaptcha_qsencode().

Referenced by recaptcha_check_answer().

◆ _recaptcha_mailhide_email_parts()

_recaptcha_mailhide_email_parts ( $email)

Definition at line 248 of file recaptchalib.php.

Referenced by recaptcha_mailhide_html().

◆ _recaptcha_mailhide_urlbase64()

_recaptcha_mailhide_urlbase64 ( $x)

Definition at line 225 of file recaptchalib.php.

Referenced by recaptcha_mailhide_url().

◆ _recaptcha_qsencode()

_recaptcha_qsencode ( $data)

Encodes the given data into a query string format.

Parameters
$data- array of string elements to be encoded
Returns
string - encoded request

Definition at line 47 of file recaptchalib.php.

References $req, and $value.

Referenced by _recaptcha_http_post(), and recaptcha_get_signup_url().

◆ recaptcha_check_answer()

recaptcha_check_answer ( $privkey,
$remoteip,
$challenge,
$response,
$extra_params = array() )

Calls an HTTP POST function to verify if the user's guess was correct.

Parameters
string$privkey
string$remoteip
string$challenge
string$response
array$extra_paramsan array of extra variables to post to the server
Returns
ReCaptchaResponse

Definition at line 152 of file recaptchalib.php.

References $response, _recaptcha_http_post(), array(), and RECAPTCHA_VERIFY_SERVER.

Referenced by ReCaptcha\passCaptcha().

◆ recaptcha_get_html()

recaptcha_get_html ( $pubkey,
$error = null,
$use_ssl = false )

Gets the challenge HTML (javascript and non-javascript version).

This is called from the browser, and the resulting reCAPTCHA HTML widget is embedded within the HTML form it was called from.

Parameters
string$pubkeyA public key for reCAPTCHA
string$errorThe error given by reCAPTCHA (optional, default is null)
boolean$use_sslShould the request be made over ssl? (optional, default is false)
Returns
string - The HTML to be embedded in the user's form.

Definition at line 106 of file recaptchalib.php.

References RECAPTCHA_API_SECURE_SERVER, and RECAPTCHA_API_SERVER.

Referenced by ReCaptcha\getFormInformation(), and HTMLReCaptchaField\getInputHTML().

◆ recaptcha_get_signup_url()

recaptcha_get_signup_url ( $domain = null,
$appname = null )

gets a URL where the user can sign up for reCAPTCHA.

If your application has a configuration page where you enter a key, you should provide a link using this function.

Parameters
string$domainThe domain where the page is hosted
string$appnameThe name of your application

Definition at line 202 of file recaptchalib.php.

References _recaptcha_qsencode(), and array().

Referenced by ConfirmEditHooks\efReCaptcha().

◆ recaptcha_mailhide_html()

recaptcha_mailhide_html ( $pubkey,
$privkey,
$email )

Gets html to display an email address given a public an private key.

to get a key, go to:

http://www.google.com/recaptcha/mailhide/apikey

Definition at line 267 of file recaptchalib.php.

References _recaptcha_mailhide_email_parts(), and recaptcha_mailhide_url().

◆ recaptcha_mailhide_url()

recaptcha_mailhide_url ( $pubkey,
$privkey,
$email )

Definition at line 230 of file recaptchalib.php.

References _recaptcha_aes_encrypt(), and _recaptcha_mailhide_urlbase64().

Referenced by recaptcha_mailhide_html().

Variable Documentation

◆ RECAPTCHA_API_SECURE_SERVER

const RECAPTCHA_API_SECURE_SERVER "https://www.google.com/recaptcha/api"

Definition at line 39 of file recaptchalib.php.

Referenced by recaptcha_get_html().

◆ RECAPTCHA_API_SERVER

const RECAPTCHA_API_SERVER "http://www.google.com/recaptcha/api"

This is a PHP library that handles calling reCAPTCHA.

Copyright (c) 2007 reCAPTCHA – http://recaptcha.net AUTHORS: Mike Crawford Ben Maurer

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. The reCAPTCHA server URL's

Definition at line 38 of file recaptchalib.php.

Referenced by recaptcha_get_html().

◆ RECAPTCHA_VERIFY_SERVER

const RECAPTCHA_VERIFY_SERVER "www.google.com"

Definition at line 40 of file recaptchalib.php.

Referenced by recaptcha_check_answer().