.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt =================== 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: Calculating Captcha =================== Extension Key: **wt\_calculating\_captcha** Copyright 2000-2009, Alex Kellner, 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: 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: Introduction ------------ .. _What-does-it-do: 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: 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: This extensions currently supporting the calculating captcha: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Default TYPO3 mailform - powermail Do you want to integrate the extension? Just write me an email! .. _Screenshots: Screenshots ^^^^^^^^^^^ .. _Example-use-in-powermail: Example use in powermail """""""""""""""""""""""" |img-1| .. _Example-use-in-the-default-mailform-of-TYPO3: Example use in the default mailform of TYPO3 """""""""""""""""""""""""""""""""""""""""""" |img-2| Note: For default the image is shown after the submit button. With css it should be possible to change the position! .. _Users-manual: Users manual ------------ .. _Fast-installation: 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: Manipulation with Typoscript ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Default-setup: 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: 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: Constants explanation """"""""""""""""""""" .. ### BEGIN~OF~TABLE ### .. _Name: **Name** ~~~~~~~~ .. container:: table-row a **Name** b **Explanation** c **Default value** d **Type** .. _number1-minmax: number1.minmax ~~~~~~~~~~~~~~ .. container:: table-row 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: number2.minmax ~~~~~~~~~~~~~~ .. container:: table-row 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: number.notNegative ~~~~~~~~~~~~~~~~~~ .. container:: table-row a number.notNegative b No negative results: Disable negative numbers (can happen if 3-5 for example) c 1 d boolean .. _font-color: font.color ~~~~~~~~~~ .. container:: table-row a font.color b Captcha font color: Define the font color (e.g. #000000) c #444444 d .. _font-size: font.size ~~~~~~~~~ .. container:: table-row a font.size b Captcha font size: Define the font size (e.g. 25) c 32 d int .. _font-path: font.path ~~~~~~~~~ .. container:: table-row 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: font.angle ~~~~~~~~~~ .. container:: table-row 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: font.distance\_hor ~~~~~~~~~~~~~~~~~~ .. container:: table-row 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: font.distance\_vert ~~~~~~~~~~~~~~~~~~~ .. container:: table-row 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: background.image ~~~~~~~~~~~~~~~~ .. container:: table-row 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: operation.number ~~~~~~~~~~~~~~~~ .. container:: table-row 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: debug ~~~~~ .. container:: table-row a debug b Debug output: Enable debug output (e.g. 1) c 0 d boolen .. ###### END~OF~TABLE ###### .. _Example-inclusion-in-the-TYPO3-standard-mailform: Example inclusion in the TYPO3 standard mailform ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Add-static-template: Add static template """"""""""""""""""" |img-3| .. _Add-another-page-with-the-error-message: Add another page with the error message """"""""""""""""""""""""""""""""""""""" .. _img-4: |img-4| """"""" .. _Example-code: Example code """""""""""" .. _img-5: |img-5| """"""" .. _Add-two-lines-to-the-form-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: 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: 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: Example inclusion in your extension ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. _Get-the-image: 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: 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: 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: 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: Change Log ---------- .. _Version-0-1-x-alpha: Version 0.1.x alpha ^^^^^^^^^^^^^^^^^^^ .. _Update-on-12-11-2009-version-0-1-5: 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: 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: 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: 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: Initial Release to TER on 10.01.2009 version 0.1.1 """""""""""""""""""""""""""""""""""""""""""""""""" Main functions .. _Additional-links: 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 `_ |img-6| Calculating Captcha - 13 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.jpeg .. :align: left .. :border: 0 .. :height: 226 .. :id: Grafik1 .. :name: Grafik1 .. :width: 600 .. |img-2| image:: img-2.jpeg .. :align: left .. :border: 0 .. :height: 292 .. :id: Grafik2 .. :name: Grafik2 .. :width: 445 .. |img-3| image:: img-3.jpeg .. :align: left .. :border: 0 .. :height: 174 .. :id: Grafik5 .. :name: Grafik5 .. :width: 570 .. |img-4| image:: img-4.jpeg .. :align: left .. :border: 0 .. :height: 51 .. :id: Grafik4 .. :name: Grafik4 .. :width: 179 .. |img-5| image:: img-5.jpeg .. :align: left .. :border: 0 .. :height: 343 .. :id: Grafik3 .. :name: Grafik3 .. :width: 532 .. |img-6| image:: img-6.png .. :align: left .. :border: 0 .. :height: 32 .. :id: Graphic1 .. :name: Graphic1 .. :width: 102