DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
Calculating Captcha¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed: | 2009-11-12T20:19:29 |
Author: | Alex Kellner |
Email: | alexander.kellner@einpraegsam.net |
Info 3: | |
Info 4: |
Calculating Captcha¶
Extension Key: wt_calculating_captcha
Copyright 2000-2009, Alex Kellner, <alexander.kellner@einpraegsam.net>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
Calculating Captcha 1
Introduction 2
What does it do: 2
Flexible with: 2
This extensions currently supporting the calculating captcha: 2
Screenshots 3
Users manual 4
Fast installation 4
Manipulation with Typoscript 5
Example inclusion in the TYPO3 standard mailform 7
Example inclusion in powermail 8
Example inclusion in your extension 9
FAQ 10
Todo 11
Change Log 12
Version 0.1.x alpha 12
Additional links 13
Introduction¶
What does it do:¶
This extension offers a calculating captcha image to include in the default mailform or into powermail or in your own extension.
The user has to enter the right result to the small arithmetic problem to proceed the form.
Flexible with:¶
You can define via typoscript:
- font
- font-size
- font-color
- angle
- distance
- background-image
- number delta
This extensions currently supporting the calculating captcha:¶
- Default TYPO3 mailform
- powermail
Do you want to integrate the extension? Just write me an email!
Users manual¶
Fast installation¶
- Install from TER
- Use calculating captcha with powermail: Just select wt_calculating_captcha in powermail constants and add a captcha field to the powermail form
- Use calculating captcha with standard mailform: Add static template, add two lines to the form, that's all (details below)
- Use calculating captcha in your Extension: See coding part below for an integration example
Manipulation with Typoscript¶
Default setup¶
# WT_CALCULATING_CAPTCHA PLUGIN #
plugin.tx_wtcalculatingcaptcha {
# constants
number1.minmax = {$plugin.wt_calculating_captcha.number1.minmax}
number2.minmax = {$plugin.wt_calculating_captcha.number2.minmax}
number.notNegative = {$plugin.wt_calculating_captcha.number.notNegative}
font.color = {$plugin.wt_calculating_captcha.font.color}
font.size = {$plugin.wt_calculating_captcha.font.size}
font.path = {$plugin.wt_calculating_captcha.font.path}
font.angle = {$plugin.wt_calculating_captcha.font.angle}
font.distance_hor = {$plugin.wt_calculating_captcha.font.distance_hor}
font.distance_vert = {$plugin.wt_calculating_captcha.font.distance_vert}
background.image = {$plugin.wt_calculating_captcha.background.image}
operation.number = {$plugin.wt_calculating_captcha.operation.number}
debug = {$plugin.wt_calculating_captcha.debug}
}
Default constants¶
###
# This are the default TS-constants for wt_calculating_captcha
##
plugin.wt_calculating_captcha {
# cat=plugin.wt_calculating_captcha//0010; type=text; label= Delta first number: Define random area for the first number from and up to (e.g. 1,9 means number could be from 1 up to 9)
number1.minmax = 1,9
# cat=plugin.wt_calculating_captcha//0020; type=text; label= Delta second number: Define random area for the second number from and up to (e.g. 1,9 means number could be from 1 up to 9)
number2.minmax = 1,9
# cat=plugin.wt_calculating_captcha//0030; type=boolean; label= No negative results: Disable negative numbers (can happen if 3-5 for example)
number.notNegative = 1
# cat=plugin.wt_calculating_captcha//0040; type=text; label= Captcha font color: Define the font color (e.g. #000000)
font.color = #444444
# cat=plugin.wt_calculating_captcha//0050; type=int; label= Captcha font size: Define the font size (e.g. 25)
font.size = 32
# cat=plugin.wt_calculating_captcha//0060; type=text; label= Captcha font path: Define the captcha font (e.g. fileadmin/font.ttf)
font.path = EXT:wt_calculating_captcha/files/fonts/ARCADE.TTF
# cat=plugin.wt_calculating_captcha//0070; type=text; label= Captcha font angle: Define the maximum font angle from and up to (e.g. -25,25 means from -25 up to 25 degrees angle)
font.angle = -10,10
# cat=plugin.wt_calculating_captcha//0080; type=text; label= Horizontal distance: Define the maximum distance to the left from and up to (e.g. 20,80 means from 20px up to 80px distance to the left picture border)
font.distance_hor = 20,80
# cat=plugin.wt_calculating_captcha//0090; type=text; label= Vertical distance: Define the maximum distance to the top from and up to (e.g. 20,80 means from 20px up to 80px distance to the top picture border)
font.distance_vert = 30,60
# cat=plugin.wt_calculating_captcha//0100; type=text; label= Captcha background image: Background image for captcha (e.g. fileadmin/image.png)
background.image = EXT:wt_calculating_captcha/files/img/bg.png
# cat=plugin.wt_calculating_captcha//0110; type=int; label= Define operations: Define if + than 0 or +- than 1 or +-* than 2 or +-*/ than 3 (e.g. 2)
operation.number = 2
# cat=plugin.wt_calculating_captcha//9999; type=boolean; label= Debug output: Enable debug output (e.g. 1)
debug = 0
}
Constants explanation¶
Name¶
a
Name
b
Explanation
c
Default value
d
Type
number1.minmax¶
a
number1.minmax
b
Delta first number: Define random area for the first number from and up to (e.g. 1,9 means number could be from 1 up to 9)
c
1,9
d
text
number2.minmax¶
a
number2.minmax
b
Delta second number: Define random area for the second number from and up to (e.g. 1,9 means number could be from 1 up to 9)
c
1,9
d
text
number.notNegative¶
a
number.notNegative
b
No negative results: Disable negative numbers (can happen if 3-5 for example)
c
1
d
boolean
font.color¶
a
font.color
b
Captcha font color: Define the font color (e.g. #000000)
c
#444444
d
font.size¶
a
font.size
b
Captcha font size: Define the font size (e.g. 25)
c
32
d
int
font.path¶
a
font.path
b
Captcha font path: Define the captcha font (e.g. fileadmin/font.ttf)
c
EXT:wt_calculating_captcha/files/fonts/ARCADE.TTF
d
text
font.angle¶
a
font.angle
b
Captcha font angle: Define the maximum font angle from and up to (e.g. -25,25 means from -25 up to 25 degrees angle)
c
-10,10
d
text
font.distance_hor¶
a
font.distance_hor
b
Horizontal distance: Define the maximum distance to the left from and up to (e.g. 20,80 means from 20px up to 80px distance to the left picture border)
c
20,80
d
text
font.distance_vert¶
a
font.distance_vert
b
Vertical distance: Define the maximum distance to the top from and up to (e.g. 20,80 means from 20px up to 80px distance to the top picture border)
c
30,60
d
text
background.image¶
a
background.image
b
Captcha background image: Background image for captcha (e.g. fileadmin/image.png)
c
EXT:wt_calculating_captcha/files/img/bg.png
d
text
operation.number¶
a
operation.number
b
Define operations: Define if + than 0 or +- than 1 or +-* than 2 or +-*/ than 3 (e.g. 2)
c
2
d
int
debug¶
a
debug
b
Debug output: Enable debug output (e.g. 1)
c
0
d
boolen
Example inclusion in the TYPO3 standard mailform¶
Add static template¶
Add another page with the error message¶
Example code¶
Add two lines to the form code¶
- Label | *wt_calculating_captcha=input,40
- | wt_calculating_captcha_redirect=hidden | http://domain.com/wrongcaptcha.html
Explanation of the two lines¶
- Add an input field for the captcha code (name must be “wt_calculating_captcha”)
- Add an hidden field and define the full URL of the page, where to redirect, if wrong code
Example inclusion in powermail¶
- Simply install the extension
- Choose “wt_calculating_captcha” in the powermail constants for this captcha extension
- Add a new captcha field to powermail
- That's all
Example inclusion in your extension¶
Get the image¶
require_once(t3lib_extMgm::extPath('wt_calculating_captcha').'class.tx_wtcalculatingcaptcha.php'); // include captcha class
$captcha = t3lib_div::makeInstance('tx_wtcalculatingcaptcha'); // generate object
$content = $captcha->generateCaptcha(); // image return
Check if the code is the right code¶
require_once(t3lib_extMgm::extPath('wt_calculating_captcha').'class.tx_wtcalculatingcaptcha.php'); // include captcha class
$captcha = t3lib_div::makeInstance('tx_wtcalculatingcaptcha'); // generate object
if ($captcha->correctCode($this->piVars['captchaCode'])) { // check if code is correct
$content = 'right code, go on!'; // leave a message
} else {
$content = 'wrong code, go back!'; // leave a message
}
unset($GLOBALS['TSFE']->fe_user->sesData['wt_calculating_captcha_value']); // delete old session value
FAQ¶
- Q: Can I use this extension with the default form of TYPO3?
- A: Yes you can – see example above. Please include static template.
- Q: I want to change the size of the image?
- A: The first background image (manipulation with typoscript) controls the image, so change the background image with an image with the wanted size or just try to chang the image size via css
- Q: Should I integrate this extension in my extension?
- A: This would help to prevent spam and makes me happy
Todo¶
- Enabling html Template
- Removing arithmetic signs from the captcha and write in the text what to do
- Alternative use words from list instead of numbers
Is there something else to do? Just write me!
Change Log¶
Version 0.1.x alpha¶
Update on 12.11.2009 version 0.1.5¶
- Fixed problem if TYPO3 runs in subfolder
- Added hash to image request (for reload in IE)
- Code cleaning
Update on 09.03.2009 version 0.1.4¶
- No negative results (if wanted)
- Improved debug output
Update on 13.01.2009 version 0.1.3¶
- Cache bugfix
- Using static template
- Small code and manual changes
Update on 12.01.2009 version 0.1.2¶
Enabling calculating captcha for the standard mailform
Initial Release to TER on 10.01.2009 version 0.1.1¶
Main functions
Additional links¶
You can use one of the following links, to get more informations about this plugin:
- Authors (Alex Kellner) homepage: http://www.einpraegsam.net
- Tuning parts for your car: http://www.wunschtacho.de
- Stuff for snowboarder and skier: http://www.justpowder.de
Do you need help with this plugin: http://www.typo3.net
Calculating Captcha - 13