Extension:VisualMathCaptcha

The VisualMathCaptcha extension gave wikis an (at-best) moderately strong captcha with a math operation generated as image. It did not stop all spam, but did reduce the amount of rubbish which got through.

The extension is now abandoned. It was working up to MW 1.20 and PHP 5.3 or so, but on new MediaWiki installations is now failing with:
 * PHP Fatal error: Call to undefined method SpecialPage::SpecialPage in extensions/VisualMathCaptcha/VisualMathCaptcha.body.php on line 16

Source code
README

LocalSettings.part

VisualMathCaptcha.body.php

VisualMathCaptcha.class.php

VisualMathCaptcha.setup.php

VisualMathConfirmCaptcha.class.php

Installation
This extension requires you have GD module for PHP.

Download VisualMathExtension from here (this is not a direct link; extension can't be located by clicking this link).

To install this extension, add the following to LocalSettings.php:

Configuration parameters

 * $wgVisualMathCaptchaItemMax : [int] max value (included) for each number in operation ; Defaulted to 9. Needs to be increased as a trivial single-digit challenge will let 10% of the spam through.


 * $wgVisualMathCaptchaItemNum : [int] count of number in generated operator; Defaulted to 2.


 * $wgVisualMathCaptchaOperators : [array] operators allowed for generation; Defaulted to { '+', '-' }.

To adjust the minimum/maximum brightness of both the text characters and the random background, one must edit VisualMathCaptcha.body.php as these are not assigned parameters. The $bgCol = imagecolorallocate(...) and $txtCol = imagecolorallocate(...)</tt> lines control background and text colour, respectively.

The last three parameters of each contain a random function for brightness, where each controls one primary colour. The maximum range of each must be within 0 to 255, so (for example) rand(0,255)</tt> would allow any random intensity, rand(0,127)</tt> would be between black and grey,  rand(128,255)</tt> between grey and white.

Adjust the foreground and background intensity to the lowest contrast which is still human-readable.

With ConfirmEdit
This captcha can be used instead of standard captcha of ConfirmEdit extension. To do so :
 * 1) Open ConfirmEdit.php</tt>, in ConfirmEdit extension directory, and change $wgCaptchaClass</tt> value to VisualMathConfirmCaptcha</tt>.
 * 2) Add following line in LocalSettings.php, after content copied from provided file LocalSettings.part</tt> :

With Lockdown extension
VisualMathCaptcha uses a special page: SpecialPage:VisualMathCaptcha.

Add in LocalSettings.php

With CorporateContact

 * VisualMathCaptcha can be used with CorporateContact.