Commit 594ed963 authored by RobLoach's avatar RobLoach

#176265: Setup of HEAD branch for Drupal 6.

parent 98f9774c
$Id$
##Captcha Readme##
### CAPTCHA Readme
To Install:
Enable the module, and then go to admin/settings/captcha to enable captchas
for various actions and captcha types.
captcha.module is the basic CAPTCHA module that offers general CAPTCHA
adminstration and a simple math challenge.
Default, and Image Captchas:
This new version of captcha.module uses a simple math question as the
default captcha challenge. However, this is NOT as powerful as the original
image captcha, in case you are looking for foolproof protection.
text_captcha offers another simple text based challenge.
The image captcha facility has been shifted to an additional submodule called
"textimage". You will need to install captcha.module AND textimage.module to
get image captchas working.
image_captcha offers an image based challenge.
Installation:
Installation is like all normal modules (e.g. extract in the directory sites/all/modules)
The basic CAPTCHA module has no dependencies, so nothing special is required.
Configuration:
The configuration page is at admin/user/captcha, here you can configure
the CAPTCHA module and enable challenges for the desired forms.
Using the Image CAPTCHA:
If you plan on using image_captcha, you will have to install TTF fonts into
the image_captcha/fonts or files directory. You can find free fonts
available at a number of different locations:
- DejaVu:
http://dejavu.sourceforge.net/wiki/index.php/Download
- Gentium:
http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=Gentium
- Redhat:
https://www.redhat.com/promo/fonts
- Matt's Free Fonts Page:
http://www.theory.org/~matt/strthrwr/fonts/free
; $Id$
name = Captcha
description = "Implements a captcha to registration, comment, contact and node entry forms."
package = SPAM Control
; $Id$
name = CAPTCHA
description = "Base CAPTCHA module for adding challenges to arbitrary forms."
package = "Spam control"
<?php
// $Id$
/**
* Create tables on install
*/
function captcha_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {captcha_points} (
form_id varchar(128) NOT NULL,
module varchar(64) default NULL,
type varchar(64) default NULL,
PRIMARY KEY (form_id)
) /*!40100 DEFAULT CHARACTER SET utf8 */;"
);
$succes = TRUE;
break;
case 'pgsql':
db_query("CREATE TABLE {captcha_points} (
form_id varchar(128) NOT NULL,
module varchar(64) default NULL,
type varchar(64) default NULL,
PRIMARY KEY (form_id)
);"
);
$succes = TRUE;
break;
default:
drupal_set_message(t('Unsupported database.'), 'error');
$succes = FALSE;
}
if ($succes) {
// insert some defaults
$form_ids = array('comment_form', 'contact_mail_user', 'contact_mail_page',
'user_register', 'user_pass', 'user_login', 'user_login_block');
foreach ($form_ids as $form_id) {
db_query("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('%s', NULL, NULL)", $form_id);
}
drupal_set_message(t('The installation of the captcha_points table and some default entries was successful'), 'status');
}
else {
drupal_set_message(t('The installation of the CAPTCHA module failed'), 'error');
}
}
/**
* Implementation of hook_update_N()
*/
function captcha_update_1() {
$items = array();
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
$items[] = update_sql("CREATE TABLE {captcha_points} (
form_id varchar(128) NOT NULL,
module varchar(64) default NULL,
type varchar(64) default NULL,
PRIMARY KEY (form_id)
) /*!40100 DEFAULT CHARACTER SET utf8 */;"
);
$succes = TRUE;
break;
case 'pgsql':
$items[] = update_sql("CREATE TABLE {captcha_points} (
form_id varchar(128) NOT NULL,
module varchar(64) default NULL,
type varchar(64) default NULL,
PRIMARY KEY (form_id)
);"
);
$succes = TRUE;
break;
default:
drupal_set_message(t('Unsupported database.'), 'error');
$succes = FALSE;
break;
}
if ($succes) {
// insert some defaults
$form_ids = array('comment_form', 'contact_mail_user', 'contact_mail_page',
'user_register', 'user_pass');
foreach ($form_ids as $form_id) {
$items[] = update_sql("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('$form_id', NULL, NULL)");
}
}
return $items;
}
/**
* Implementation of hook_update_N()
*/
function captcha_update_2() {
$items = array();
// insert some defaults
$form_ids = array('user_login', 'user_login_block');
foreach ($form_ids as $form_id) {
$items[] = update_sql("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('$form_id', NULL, NULL)");
}
return $items;
}
/**
* Remove tables on uninstall.
*/
function captcha_uninstall() {
db_query("DROP TABLE {captcha_points}");
db_query("DELETE FROM {variable} WHERE name LIKE 'captcha_%'");
cache_clear_all('variables', 'cache');
}
This diff is collapsed.
This documentation is for developers that want to implement their own
challenge type and integrate it with the base CAPTCHA module.
=== Required: hook_captcha($op, $captcha_type='') ===
The hook_captcha() hook is the only required function if you want to integrate
with the base CAPTCHA module.
Functionality depends on the first argument $op:
* 'list': you should return an array of possible challenge types
that your module implements.
* 'generate': generate a challenge.
You should return an array that offers form elements and the solution
of your challenge, defined by the second argument $captcha_type.
The returned array $captcha should have the following items:
$captcha['solution']: this is the solution of your challenge
$captcha['form']: an array of the form elements you want to add to the form.
There should be a key 'captcha_response' in this array, which points to
the form element where the user enters his answer.
Let's give a simple example to make this more clear.
We create the challenge 'Foo CAPTCHA', which requires the user to
enter "foo" in a textfield.
"""
/**
* Implementation of hook_captcha().
*/
function foo_captcha_captcha($op, $captcha_type='') {
switch ($op) {
case 'list':
return array('Foo CAPTCHA');
case 'generate':
if ($captcha_type == 'Foo CAPTCHA') {
$captcha = array();
$captcha['solution'] = 'foo';
$captcha['form']['captcha_response'] = array(
'#type' => 'textfield',
'#title' => t('Enter "foo"'),
);
return $captcha;
}
break;
}
}
"""
Validation of the answer against the solution and other stuff is done by the
base CAPTCHA module.
=== Required: the .info file ===
You should specify that your module depends on the base CAPTCHA module.
Optionally you could put your module in the "Spam control" package.
For our simple foo CAPTCHA module this would mean the following lines in the
file foo_captcha.info:
"""
name = "Foo CAPTCHA"
description = "The foo CAPTCHA requires the user to enter the word 'foo'."
package = "Spam control"
dependencies = captcha
"""
=== Recommended: hook_menu($may_cache) ===
More advanced CAPTCHA modules probably want some configuration page.
To integrate nicely with the base CAPTCHA module you should offer your
configuration page as a MENU_LOCAL_TASK menu entry under 'admin/user/captcha/'.
For our simple foo CAPTCHA module this would mean:
"""
/**
* Implementation of hook_menu().
*/
function foo_captcha_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/user/captcha/foo_captcha',
'title' => t('Foo CAPTCHA'),
'callback' => 'drupal_get_form',
'callback arguments' => array('foo_captcha_settings_form'),
'type' => MENU_LOCAL_TASK,
);
}
return $items;
}
"""
You should of course implement a function foo_captcha_settings_form() which
returns the form of your configuration page.
=== Optional: hook_help($section) ===
To offer a description/explanation of your challenge, you can use the
normal hook_help() system.
For our simple foo CAPTCHA module this would mean:
"""
/**
* Implementation of hook_help().
*/
function foo_captcha_help($section) {
switch ($section) {
case 'admin/user/captcha/foo_captcha':
return '<p>'. t('This is a very simple challenge, which requires users to enter "foo" in a textfield.') .'</p>';
}
}
"""
=== Optional: preprocess the response ===
In some situations it could be necessary to preprocess the response before
letting the CAPTCHA module validate it. For example: if you want the validation
to be case insensitive, you could convert the reponse to lower case.
To enable response preprocessing:
* Add a non zero 'preprocess' entry to $captcha in the 'generate' part of
hook_captcha(). E.g.:
"""
function foo_captcha_captcha($op, $captcha_type='') {
switch($op) {
...
case 'generate':
if ($captcha_type == 'Foo CAPTCHA') {
...
$captcha['preprocess'] = TRUE,
...
"""
* Add a 'preprocess' operation to hook_captcha() and add a $response argument
to the function signature. E.g.:
"""
function foo_captcha_captcha($op, $captcha_type='', $response='') {
switch($op) {
...
case 'preprocess':
if ($captcha_type == 'Foo CAPTCHA') {
return strtolower($response);
}
break;
...
"""
You should install TTF fonts in this directory.
; $Id$
name = "Image CAPTCHA"
description = "Provides an image based CAPTCHA."
package = "Spam control"
dependencies = captcha
<?php
// $Id$
/**
* On uninstall: remove module variables and clear variable cache
*/
function image_captcha_uninstall() {
db_query("DELETE FROM {variable} WHERE name LIKE 'image_captcha_%'");
cache_clear_all('variables', 'cache');
}
This diff is collapsed.
# LANGUAGE translation of Drupal (captcha.module)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# translation of cs.po to Czech
# Czech translation of Drupal (captcha.module)
# Copyright 2007 Jakub Suchy <jakub.suchy@drupal.cz>
# Generated from file: captcha.module,v 1.30 2007/01/13 17:48:05 wundo
#
#, fuzzy
# Jakub Suchy <jakub.suchy@drupal.cz>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Project-Id-Version: cs\n"
"POT-Creation-Date: 2007-03-16 22:01-0400\n"
"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
"Last-Translator: NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
"PO-Revision-Date: 2007-05-29 23:38+0200\n"
"Last-Translator: Jakub Suchy <redakce@drupal.cz>\n"
"Language-Team: Czech <redakce@drupal.cz>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Plural-forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;X-Generator: KBabel 1.11.4\n"
"X-Generator: KBabel 1.11.4\n"
#: captcha.module:12
msgid "Adds a Captcha to various forms to help prevent spam submissions."
msgstr ""
msgstr "Přidává do ruzných formulářů Captchu pro zabránění spamu."
#: captcha.module:27 captcha.info:0
msgid "Captcha"
msgstr ""
msgstr "Captcha"
#: captcha.module:28
msgid "Administer how and where Captchas are used."
msgstr ""
msgstr "Nastavit kde a jak je Captcha zobrazována."
#: captcha.module:45
msgid "Comment form"
msgstr ""
msgstr "Komentářový formulář"
#: captcha.module:46
msgid "User login form"
msgstr ""
msgstr "Přihlášení uživatele"
#: captcha.module:47
msgid "User login form block"
msgstr ""
msgstr "Přihlášení uživatele z bloku"
#: captcha.module:48
msgid "User edit form"
msgstr ""
msgstr "Úprava nastavení účtu uživatele"
#: captcha.module:49
msgid "User registration form"
msgstr ""
msgstr "Registrační formulář"
#: captcha.module:50
msgid "User forgot password form"
msgstr ""
msgstr "Formulář pro zaslání hesla"
#: captcha.module:51
msgid "User contact form"
msgstr ""
msgstr "Kontaktní formulář uživatele"
#: captcha.module:52
msgid "Sitewide contact form"
msgstr ""
msgstr "Kontaktní formulář celého webu"
#: captcha.module:53
msgid "Create a node"
msgstr ""
msgstr "Vytvořit obsah"
#: captcha.module:62
msgid "Captcha points for the role @role"
msgstr ""
msgstr "Captcha body pro roli @role"
#: captcha.module:83
msgid "Type of captcha to use"
msgstr ""
msgstr "Typ captchy"
#: captcha.module:86
msgid "Select what kind of challenge you want to pose to the user."
msgstr ""
msgstr "Vyberte, jaký typ úkolu bude zobrazen uživateli."
#: captcha.module:91
msgid "Additional response description text"
msgstr ""
msgstr "Dodatečný text popisující odpověď"
#: captcha.module:93
msgid "This text will be added below the captcha response field."
msgstr ""
msgstr "Tento text bude přidán pod políčko s místem pro odpověď uživatele."
#: captcha.module:98
msgid "Override module's form item description"
msgstr ""
msgstr "Přepsat popis políčka z modulu"
#: captcha.module:100
msgid "Override the captcha module's form item description to the one set above."
msgstr ""
msgstr "Zde můžete přepsat popis políčka, který je nastaven originálním modulem."
#: captcha.module:200
msgid "Math Question: What is %problem?"
msgstr ""
msgstr "Matematická otázka: Kolik je %problem?"
#: captcha.module:201
msgid "Please solve the math problem above and type in the result. e.g. for 1+1, type 2."
msgstr ""
msgstr "Prosím vyřešte výše uvedenou otázku a napište odpověď. Např. pro 1+1 napište 2."
#: captcha.module:218
msgid "The answer you entered to the math problem is incorrect."
msgstr ""
msgstr "Odpověď na zadaný matematický problém je nesprávná."
#: captcha.module:0 captcha.info:0
msgid "captcha"
msgstr ""
msgstr "captcha"
#: captcha.info:0
msgid "5.x-1.x-dev"
msgstr ""
msgstr "5.x-1.x-dev"
#: captcha.info:0
msgid "Implements a captcha to registration, comment, contact and node entry forms."
msgstr ""
msgstr "Umožňuje zobrazovat captchu pro registrační, komentářový, kontaktní a obsahový formulář."
#: captcha.info:0
msgid "SPAM Control"
msgstr ""
msgstr "Obrana proti SPAMu"
# Danish translation of Drupal (captcha.module)
# Copyright 2007 Morten Wulff <wulff@ratatosk.net>
msgid ""
msgstr ""
"Project-Id-Version: Danish translation of Drupal (captcha.module) $Id$\n"
"POT-Creation-Date: 2007-09-11 15:26+0200\n"
"PO-Revision-Date: 2007-09-11 15:37+0100\n"
"Last-Translator: Morten Wulff <wulff@ratatosk.net>\n"
"Language-Team: Danish <l10n@drupaldanmark.dk>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-Language: Danish\n"
"X-Poedit-Country: DENMARK\n"
#: captcha.module:12
msgid "Adds a Captcha to various forms to help prevent spam submissions."
msgstr "Tilføj en Captcha til bestemte formularer for at mindske mængden af spam."
#: captcha.module:27;36
#: captcha.info:0
msgid "Captcha"
msgstr "Captcha"
#: captcha.module:28;37
msgid "Administer how and where Captchas are used."
msgstr "Bestem hvor og hvordan Captchas bruges."
#: captcha.module:43
msgid "Captcha Points"
msgstr "Captcha point"
#: captcha.module:44
msgid "Administer in what forms Captchas are applied."
msgstr "Bestem hvilke formularer, der skal bruge Captchas."
#: captcha.module:81
msgid "Comment form"
msgstr "Kommentarformular"
#: captcha.module:82
msgid "User contact form"
msgstr "Personlig kontaktformular"
#: captcha.module:83
msgid "Sitewide contact form"
msgstr "Global kontaktformular"
#: captcha.module:98
msgid "Enable/Disable captcha points."
msgstr "Aktiver/deaktiver captcha point."
#: captcha.module:111
msgid "Unable to find Form Store module, Captcha needs it to allow you to change the capcha points."
msgstr "Kan ikke finde modulet 'Form Store'. Modulet er nødvendigt for at kunne ændre captcha point."
#: captcha.module:126
msgid "Your captcha points were sucessful updated, please configure the challenge options in the other tab."
msgstr "Captcha point opdateret. Konfigurer udfordringer på næste faneblad."
#: captcha.module:142
msgid "Captcha points for the role @role"
msgstr "Captcha point for rollen @role"
#: captcha.module:143
msgid "Select what kind of challenge you want to pose to the user in each captcha point."
msgstr "Vælg hvilken opgave brugeren skal løse i hver Captcha."
#: captcha.module:151
msgid "@point"
msgstr "@point"
#: captcha.module:197
msgid "Problems when trying to retrieve captcha %challenge challenge from %module"
msgstr "Kan ikke hente opgaven %challenge fra %module"
#: captcha.module:233
msgid "The answer you entered to the captcha challenge is incorrect."
msgstr "Det indtastede svar er forkert."
#: captcha.module:271
msgid "Math Question: What is %problem?"
msgstr "Matematik: Hvad er %problem?"
#: captcha.module:272
msgid "Please solve the math problem above and type in the result. e.g. for 1+1, type 2."
msgstr "Løs matematikopgaven ovenfor og indtast resultatet (hvis opgaven er 1+1 indtaster du 2)."
#: captcha.module:196;0
msgid "captcha"
msgstr "captcha"
#: captcha.info:0
msgid "Implements a captcha to registration, comment, contact and node entry forms."
msgstr "Implmenterer Captchas for kommentar-, kontakt- og indholds-formularer."
#: captcha.info:0
msgid "SPAM Control"
msgstr "SPAM kontrol"
This diff is collapsed.
This diff is collapsed.
# LANGUAGE translation of Drupal (captcha.module)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from file: captcha.module,v 1.25 2006/07/26 19:32:02 wundo
#
msgid ""
msgstr ""
"Project-Id-Version: Captcha\n"
"POT-Creation-Date: 2006-10-03 13:47-0300\n"
"PO-Revision-Date: 2006-10-03 22:16+0100\n"
"Last-Translator: Juan Diego Gutiérrez Gallardo <enreas@gmail.com>\n"
"Language-Team: Castellano <drupal@wundo.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-Country: SPAIN\n"
#: captcha.module:15
msgid "Adds a Captcha to the registration form."
msgstr "Añade un control Captcha al formulario de registro."
#: captcha.module:26
msgid "Comment Form"
msgstr "Formulario de comentarios"
#: captcha.module:27
msgid "User Login Form"
msgstr "Formulario de identificación de usuarios"
#: captcha.module:28
msgid "User Login Form Block"
msgstr "Formulario de bloqueo de usuarios"
#: captcha.module:29
msgid "User Edit Form"
msgstr "Formulario de edición de usuarios"
#: captcha.module:30
msgid "User Registration Form"
msgstr "Formulario de alta de usuarios"
#: captcha.module:31
msgid "User Forgot Password Form"
msgstr "Formulario de recuperación de contraseñas"
#: captcha.module:32
msgid "User Contact Form"
msgstr "Formulario de contacto con el usuario"
#: captcha.module:33
msgid "Sitewide Contact Form"
msgstr "Formulario de contacto para todo el sitio"
#: captcha.module:34
msgid "Create a node"
msgstr "Creación de nodos"
#: captcha.module:41
msgid "Captcha Points for the role %role"
msgstr "Puntos de control Captcha para el rol %role"
#: captcha.module:59
msgid "Type of captcha to use"
msgstr "Tipo de control Captcha"
#: captcha.module:62
msgid "Select what kind of challenge you want to pose to the user"
msgstr "Indique qué tipo de reto quiere plantear al usuario"
#: captcha.module:141
msgid "Math Question: What is %problem?"
msgstr "Problema matemático: ¿Cuál es el resultado de %problem?"
#: captcha.module:143
msgid "Please solve the math problem above and type in the result. e.g. for 1+1, type 2"
msgstr "Por favor, solucione el problema matemático anterior y escriba el resultado. Por ejemplo, si el problema es 1+1 escriba 2"
#: captcha.module:158
msgid "The answer you entered to the math problem is incorrect."
msgstr "La solución que ha dado al problema matemático no es correcta."
#: captcha.module:0
msgid "captcha"
msgstr "captcha"
# LANGUAGE translation of Drupal (captcha.module)
# Copyright YEAR NAME <EMAIL@ADDRESS>
# Generated from file: captcha.module,v 1.15 2005/07/15 06:49:24 arnabdotorg
#
msgid ""
msgstr ""
"Project-Id-Version: Drupal 4.6 - Module Captcha\n"
"POT-Creation-Date: 2007-03-16 22:01-0400\n"
"PO-Revision-Date: 2007-03-17 02:12-0400\n"
"Last-Translator: Erik de Zeeuw <erik@syllance.fr>\n"
"Language-Team: French <drupal@syllance.fr>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-Language: French\n"
#: captcha.info:0
msgid "5.x-1.x-dev"
msgstr ""
#: captcha.info:0 captcha.module:27
msgid "Captcha"
msgstr "Captcha"
#: captcha.info:0
msgid ""
"Implements a captcha to registration, comment, contact and node entry forms."
msgstr "Fournit un captcha pour l'inscription, l'ajout de commentaires, le formulaire de contact et l'édition de contenus."
#: captcha.info:0
msgid "SPAM Control"
msgstr "Contrôle anti-spam"
#: captcha.info:0 captcha.module:0
msgid "captcha"
msgstr "captcha"
#: captcha.module:12
msgid "Adds a Captcha to various forms to help prevent spam submissions."
msgstr "Ajoute un captcha à divers formulaires afin de prévenir le spam."
#: captcha.module:28
msgid "Administer how and where Captchas are used."
msgstr "Gérer l'utilisation des captcha."
#: captcha.module:45
msgid "Comment form"
msgstr "Formulaire de commentaire"
#: captcha.module:46
msgid "User login form"
msgstr "Formulaire d'ouverture de session"
#: captcha.module:47
msgid "User login form block"
msgstr "Bloc d'ouverture de session"
#: captcha.module:48
msgid "User edit form"
msgstr "Formulaire d'édition d'utilisateur"
#: captcha.module:49
msgid "User registration form"
msgstr "Formulaire d'inscription d'utilisateur"
#: captcha.module:50
msgid "User forgot password form"
msgstr "Formulaire de demande de nouveau mot de passe"
#: captcha.module:51
msgid "User contact form"
msgstr "Formulaire de contact personnel"
#: captcha.module:52
msgid "Sitewide contact form"
msgstr "Formulaire de contact du site"
#: captcha.module:53
msgid "Create a node"
msgstr "Créer un contenu"
#: captcha.module:62
msgid "Captcha points for the role @role"
msgstr "Points de captcha pour le rôle @role"
#: captcha.module:83
msgid "Type of captcha to use"
msgstr "Type de captcha à utiliser"
#: captcha.module:86