...
 
Commits (46)
$Id$
### CAPTCHA Readme
......
This diff is collapsed.
; $Id$
name = CAPTCHA
description = Base CAPTCHA module for adding challenges to arbitrary forms.
package = "Spam control"
......
<?php
// $Id$
/**
* Implementation of hook_schema().
*/
*/
function captcha_schema() {
$schema['captcha_points'] = array(
'fields' => array(
'form_id' => array(
'type' => 'varchar',
'length' => 128,
'not null' => TRUE
'not null' => TRUE,
),
'module' => array(
'type' => 'varchar',
'length' => 64,
'default' => NULL
),
'type' => array(
'type' => 'varchar',
'length' => 64,
'default' => NULL
),
),
'primary key' => array('form_id'),
......@@ -33,13 +30,15 @@ function captcha_schema() {
*/
function captcha_install() {
drupal_install_schema('captcha');
// 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('You can now <a href="!captcha_admin">configure the CAPTCHA module</a> for your site.',
array('!captcha_admin' => url('admin/user/captcha'))), 'status');
}
/**
......
<?php
// $Id$
/**
* @file
......@@ -37,8 +36,8 @@ function captcha_help($path, $arg) {
case 'admin/user/captcha/captcha/settings':
$output = '<p>'. t('A CAPTCHA can be added to virtually each Drupal form. Some default forms are already provided in the form list, but arbitrary forms can be easily added and managed when the option "%adminlinks" is enabled.',
array('%adminlinks' => t('Add CAPTCHA administration links to forms'))) .'</p>';
$output .= '<p>' . t('Users with the "%skipcaptcha" <a href="@perm">permission</a> won\'t be offered a challenge. Be sure to grant this permission to the trusted users (e.g. site administrators). If you want to test a protected form, be sure to do it as a user without the "%skipcaptcha" permission (e.g. as anonymous user).',
array('%skipcaptcha' => 'skip CAPTCHA', '@perm' => url('admin/user/permissions'))) .'</p>';
$output .= '<p>'. t('Users with the "%skipcaptcha" <a href="@perm">permission</a> won\'t be offered a challenge. Be sure to grant this permission to the trusted users (e.g. site administrators). If you want to test a protected form, be sure to do it as a user without the "%skipcaptcha" permission (e.g. as anonymous user).',
array('%skipcaptcha' => t('skip CAPTCHA'), '@perm' => url('admin/user/permissions'))) .'</p>';
return $output;
}
}
......@@ -53,8 +52,8 @@ function captcha_menu() {
'title' => 'CAPTCHA',
'description' => 'Administer how and where CAPTCHAs are used.',
'file' => 'captcha.admin.inc',
'page callback' => 'captcha_admin',
'page arguments' => array(3, 4),
'page callback' => 'drupal_get_form',
'page arguments' => array('captcha_admin_settings'),
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_NORMAL_ITEM,
);
......@@ -62,11 +61,13 @@ function captcha_menu() {
// alternative CAPTCHA types and their own configuration page as local task)
$items['admin/user/captcha/captcha'] = array(
'title' => 'CAPTCHA',
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -20,
);
$items['admin/user/captcha/captcha/settings'] = array(
'title' => 'General settings',
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 0,
);
......@@ -76,9 +77,18 @@ function captcha_menu() {
'file' => 'captcha.admin.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('captcha_examples', 5, 6),
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_LOCAL_TASK,
'weight' => 5,
);
$items['admin/user/captcha/captcha/captcha_point'] = array(
'title' => 'CAPTCHA point administration',
'file' => 'captcha.admin.inc',
'page callback' => 'captcha_point_admin',
'page arguments' => array(5, 6),
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_CALLBACK,
);
return $items;
}
......@@ -102,6 +112,16 @@ function captcha_requirements($phase) {
'value' => $t('Already @counter blocked form submissions', array('@counter' => variable_get('captcha_wrong_response_counter', 0))),
'severity' => REQUIREMENT_INFO,
);
// Check if there is an entry for uid=0 in the users table, this is required
// to have working a $_SESSION variable for anonymous users.
if (!db_result(db_query('SELECT COUNT(*) FROM {users} WHERE uid=%d', 0))) {
$requirements['captcha_no_sessions_for_anonymous'] = array(
'title' => $t('CAPTCHA'),
'value' => $t('No sessions for anonymous users.'),
'description' => $t('There is no entry for uid 0 in the %users table of the database. This disables persistent session data for anonymous users. Because the CAPTCHA module depends on this session data, CAPTCHAs will not work for anonymous users. Add a row for uid 0 to the %users table to resolve this.', array('%users' => 'users')),
'severity' => REQUIREMENT_ERROR,
);
}
}
return $requirements;
}
......@@ -252,7 +272,7 @@ function captcha_form_alter(&$form, $form_state, $form_id) {
);
// Add pre_render function for additional CAPTCHA processing.
$form['captcha']['#pre_render'] = array('captcha_pre_render');
$form['#pre_render'][] = 'captcha_pre_render';
// Add pre_render function for placement of CAPTCHA formt element (above submit buttons).
$form['#pre_render'][] = 'captcha_pre_render_place_captcha';
......@@ -283,14 +303,14 @@ function captcha_form_alter(&$form, $form_state, $form_id) {
'#value' => t('"@type" by module "@module" (!change, !disable)', array(
'@type' => $captcha_point->type,
'@module' => $captcha_point->module,
'!change' => l(t('change'), "admin/user/captcha/$form_id", array('query' => drupal_get_destination())),
'!disable' => l(t('disable'), "admin/user/captcha/$form_id/disable", array('query' => drupal_get_destination())),
'!change' => l(t('change'), "admin/user/captcha/captcha/captcha_point/$form_id", array('query' => drupal_get_destination())),
'!disable' => l(t('disable'), "admin/user/captcha/captcha/captcha_point/$form_id/disable", array('query' => drupal_get_destination())),
)),
);
}
else {
$form['captcha']['add_captcha'] = array(
'#value' => l(t('Place a CAPTCHA here for untrusted users.'), "admin/user/captcha/$form_id/enable", array('query' => drupal_get_destination()))
'#value' => l(t('Place a CAPTCHA here for untrusted users.'), "admin/user/captcha/captcha/captcha_point/$form_id", array('query' => drupal_get_destination()))
);
}
// Add pre_render function for placement of CAPTCHA formt element (above submit buttons).
......@@ -302,9 +322,15 @@ function captcha_form_alter(&$form, $form_state, $form_id) {
* Implementation of form #validate.
*/
function captcha_validate($form, &$form_state) {
// Check if there is CAPTCHA data available in $_SESSION.
// If not, the visitor has most likely disabled cookies.
if (!isset($_SESSION['captcha'])) {
form_set_error('captcha_response', t('Cookies should be enabled in your browser for CAPTCHA validation.'));
return;
}
// Get answer and preprocess if needed
$captcha_response = $form_state['values']['captcha_response'];
$captcha_info = $form['captcha_info']['#value'];
$captcha_info = $form_state['values']['captcha_info'];
if ($captcha_info['preprocess']) {
$captcha_response = module_invoke($captcha_info['module'], 'captcha', 'preprocess', $captcha_info['type'], $captcha_response);
}
......@@ -312,7 +338,7 @@ function captcha_validate($form, &$form_state) {
// not that we use $form_state['clicked_button']['#post']['captcha_token']
// here instead of $form_state['values']['captcha_token'], because the latter
// contains the captcha_token of the new form, while the former contains
// not the captcha token of the posted form.
// the captcha token of the posted form.
$captcha_token = $form_state['clicked_button']['#post']['captcha_token'];
// Check if captcha_token exists
if (!isset($_SESSION['captcha'][$form_id][$captcha_token])) {
......@@ -362,7 +388,7 @@ function captcha_validate($form, &$form_state) {
* in the $_SESSION variable.
*/
function captcha_pre_render($form) {
$form_id = $form['captcha_info']['#value']['form_id'];
$form_id = $form['captcha']['captcha_info']['#value']['form_id'];
// Unset the CAPTCHA if non-CAPTCHA persistent and the CAPTCHA has
// already been successfully solved for this form.
// This needs to be done in this pre_render phase when previewing for example
......@@ -381,18 +407,22 @@ function captcha_pre_render($form) {
return $form;
}
// count the number of unsolved CAPTCHAs and flush those if too many
// count the number of unsolved CAPTCHAs and unset the oldest if too many
// minus 1 is needed because 'success' is also an item of $_SESSION['captcha'][$form_id]
if (isset($_SESSION['captcha'][$form_id]) && count($_SESSION['captcha'][$form_id]) - 1 > CAPTCHA_UNSOLVED_CHALLENGES_MAX) {
unset($_SESSION['captcha'][$form_id]);
drupal_set_message(t('You can\'t request more than @num challenges without solving them. Your previous challenges were flushed.', array('@num' => CAPTCHA_UNSOLVED_CHALLENGES_MAX)));
foreach (array_keys($_SESSION['captcha'][$form_id]) as $captcha_token) {
if ($captcha_token != 'success') {
unset($_SESSION['captcha'][$form_id][$captcha_token]);
break;
}
}
}
// store the current CAPTCHA solution in $_SESSION
$captcha_token = $form['captcha_token']['#value'];
$_SESSION['captcha'][$form_id][$captcha_token] = $form['captcha_solution']['#value'];
$captcha_token = $form['captcha']['captcha_token']['#value'];
$_SESSION['captcha'][$form_id][$captcha_token] = $form['captcha']['captcha_solution']['#value'];
$_SESSION['captcha'][$form_id]['success'] = FALSE;
// empty the value of the captcha_response form item before rendering
$form['captcha_response']['#value'] = '';
$form['captcha']['captcha_response']['#value'] = '';
return $form;
}
......
<?php
// $Id$
/**
* function to get a list of available fonts
......@@ -87,6 +86,43 @@ function image_captcha_settings_form() {
),
);
// color settings
$form['image_captcha_color_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Color settings'),
'#description' => t('Configuration of the background and text colors in the image CAPTCHA.'),
);
$form['image_captcha_color_settings']['image_captcha_background_color'] = array(
'#type' => 'textfield',
'#title' => t('Background color'),
'#description' => t('Enter the hexadecimal code for the background color (e.g. #FFF or #FFCE90).'),
'#default_value' => variable_get('image_captcha_background_color', '#ffffff'),
'#maxlength' => 7,
'#size' => 8,
);
$form['image_captcha_color_settings']['image_captcha_foreground_color'] = array(
'#type' => 'textfield',
'#title' => t('Text color'),
'#description' => t('Enter the hexadecimal code for the text color (e.g. #000 or #004283).'),
'#default_value' => variable_get('image_captcha_foreground_color', '#000000'),
'#maxlength' => 7,
'#size' => 8,
);
$form['image_captcha_color_settings']['image_captcha_foreground_color_randomness'] = array(
'#type' => 'select',
'#title' => t('Additional variation of text color'),
'#options' => array(
0 => t('none'),
50 => t('small'),
100 => t('moderate'),
150 => t('high'),
200 => t('very high'),
),
'#default_value' => (int) variable_get('image_captcha_foreground_color_randomness', 100),
'#description' => t('The different characters will have randomized colors in the specified range around the text color.'),
);
// distortion and noise settings
$form['image_captcha_distortion_and_noise'] = array(
'#type' => 'fieldset',
......@@ -112,19 +148,19 @@ function image_captcha_settings_form() {
'#type' => 'checkbox',
'#title' => t('Smooth distortion'),
'#default_value' => variable_get('image_captcha_bilinair_interpolation', FALSE),
'#description' => t('This option enables bilineair interpolation of the distortion which makes the image look smoother, but it is more CPU intensive.'),
'#description' => t('This option enables bilinear interpolation of the distortion which makes the image look smoother, but it is more CPU intensive.'),
);
//double vision
$form['image_captcha_distortion_and_noise']['image_captcha_double_vision'] = array(
'#type' => 'checkbox',
'#title' => t('Double vision'),
'#default_value' => variable_get('image_captcha_double_vision', 0),
'#description' => t('When enabled, characters appear twice in the image, overlayed onto each other.'),
'#description' => t('When enabled, characters appear twice in the image, overlaid onto each other.'),
);
// noise
$form['image_captcha_distortion_and_noise']['image_captcha_dot_noise'] = array(
'#type' => 'checkbox',
'#title' => t('Add salt and peper noise'),
'#title' => t('Add salt and pepper noise'),
'#default_value' => variable_get('image_captcha_dot_noise', 0),
'#description' => t('This option adds randomly colored point noise.'),
);
......@@ -178,4 +214,12 @@ function image_captcha_settings_form_validate($form, &$form_state) {
elseif ($font != 'BUILTIN' && (!is_file($font) || !is_readable($font))) {
form_set_error('image_captcha_font', t('Font does not exist or is not readable.'));
}
// check color settings
if (!preg_match('/^#([0-9a-fA-F]{3}){1,2}$/', $form_state['values']['image_captcha_background_color'])){
form_set_error('image_captcha_background_color', t('Background color is not a valid hexadecimal color value.'));
}
if (!preg_match('/^#([0-9a-fA-F]{3}){1,2}$/', $form_state['values']['image_captcha_foreground_color'])){
form_set_error('image_captcha_foreground_color', t('Text color is not a valid hexadecimal color value.'));
}
}
; $Id$
name = "Image CAPTCHA"
description = "Provides an image based CAPTCHA."
package = "Spam control"
......
<?php
// $Id$
/**
* On uninstall: remove module variables and clear variable cache
......
<?php
// $Id$
/**
* Implementation of image CAPTCHA for use with the CAPTCHA module
......@@ -13,7 +12,7 @@ define('IMAGE_CAPTCHA_ALLOWED_CHARACTERS', 'aAbBCdEeFfGHhijKLMmNPQRrSTtWXYZ23456
function image_captcha_help($path, $arg) {
switch ($path) {
case 'admin/user/captcha/image_captcha':
$output = '<p>'. t('The image CAPTCHA is a popular challenge where a random textual code is obfuscated in an image. The image is generated on the fly for each request, which is rather CPU intensive for the server. Be carefull with the size and computation related settings.') .'</p>';
$output = '<p>'. t('The image CAPTCHA is a popular challenge where a random textual code is obfuscated in an image. The image is generated on the fly for each request, which is rather CPU intensive for the server. Be careful with the size and computation related settings.') .'</p>';
if (in_array('Image', image_captcha_captcha('list'))) {
$result = image_captcha_captcha('generate', 'Image');
$img = $result['form']['captcha_image']['#value'];
......@@ -34,6 +33,7 @@ function image_captcha_menu() {
'file' => 'image_captcha.admin.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('image_captcha_settings_form'),
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_LOCAL_TASK,
);
// callback for generating an image
......@@ -136,7 +136,7 @@ function image_captcha_captcha($op, $captcha_type='') {
$result['solution'] = $code;
$result['form']['captcha_image'] = array(
'#type' => 'markup',
'#value' => '<img src="'. check_url(url("image_captcha/$seed")) .'" />',
'#value' => '<img src="'. check_url(url("image_captcha/$seed")) .'" alt="'. t('Image CAPTCHA') .'" title="'. t('Image CAPTCHA') .'" />',
'#weight' => -2,
);
$result['form']['captcha_response'] = array(
......
<?php
// $Id$
/**
* Implementation of image CAPTCHA for use with the CAPTCHA module
......@@ -15,12 +14,11 @@ function image_captcha_image($seed=NULL) {
if (!$seed) {
return;
}
// get the code to draw from $_SESSION
$code = $_SESSION['image_captcha'][$seed];
// unset the code from $_SESSION to prevent rerendering the CAPTCHA
unset($_SESSION['image_captcha'][$seed]);
// only generate an image if there is an code
if ($code) {
// Only generate captcha if code exists in the session.
if (isset($_SESSION['image_captcha'][$seed])) {
$code = $_SESSION['image_captcha'][$seed];
// Unset the code from $_SESSION to prevent rerendering the CAPTCHA.
unset($_SESSION['image_captcha'][$seed]);
// generate the image
$image = @_image_captcha_generate_image($code);
// check of generation was successful
......@@ -43,6 +41,24 @@ function image_captcha_image($seed=NULL) {
}
}
/**
* small helper function for parsing a hexadecimal color to a RGB tuple
*/
function _image_captcha_hex_to_rgb($hex) {
// handle #RGB format
if (strlen($hex) == 4) {
$hex = $hex[1] . $hex[1] . $hex[2] . $hex[2] . $hex[3] . $hex[3];
}
$c = hexdec($hex);
$rgb = array();
for ($i = 16; $i >= 0; $i -= 8) {
$rgb[] = ($c >> $i) & 0xFF;
}
return $rgb;
}
/**
* base function for generating a image CAPTCHA
*/
......@@ -67,8 +83,9 @@ function _image_captcha_generate_image($code) {
return FALSE;
}
// background
$background_color = imagecolorallocate($image, 255, 255, 255);
// get background color and paint
$background_rgb = _image_captcha_hex_to_rgb(variable_get('image_captcha_background_color', '#ffffff'));
$background_color = imagecolorallocate($image, $background_rgb[0], $background_rgb[1], $background_rgb[2]);
imagefilledrectangle($image, 0, 0, $width, $height, $background_color);
// draw text
......@@ -115,7 +132,7 @@ function _image_captcha_generate_image($code) {
}
if (variable_get('image_captcha_bilinair_interpolation', FALSE)) {
// distortion with bilineair interpolation
// distortion with bilinear interpolation
for ($x = 0; $x < $width; $x++) {
for ($y = 0; $y < $height; $y++) {
// get distorted sample point in source image
......@@ -129,7 +146,7 @@ function _image_captcha_generate_image($code) {
$color = $background_color;
}
else {
// bilineair interpolation: sample at four corners
// bilinear interpolation: sample at four corners
$color_00 = imagecolorat($image, $sxf , $syf );
$color_00_r = ($color_00 >> 16) & 0xFF;
$color_00_g = ($color_00 >> 8) & 0xFF;
......@@ -205,49 +222,87 @@ function _image_captcha_image_generator_add_dots(&$image, $width, $height, $colo
}
}
function _image_captcha_image_generator_print_string(&$image, $width, $height, $font, $font_size, $text, $light_colors=FALSE) {
/**
* Helper function for drawing text on the image
*
* @param $background_mode if the text is for the background of the double vision mode
*/
function _image_captcha_image_generator_print_string(&$image, $width, $height, $font, $font_size, $text, $background_mode=FALSE) {
// get characters
$characters = _image_captcha_utf8_split($text);
$character_quantity = count($characters);
// get total width
// get character width for builtin font
if ($font == 'BUILTIN') {
$character_width = imagefontwidth(5);
$character_height = imagefontheight(5);
$textwidth = $character_quantity * $character_width;
$bbox = array(0, $character_height, $character_width, $character_height, $character_width, 0, 0, 0);
}
else {
$bbox = imagettfbbox($font_size, 0, realpath($font), $text);
if (!$bbox) {
return FALSE;
// get colors
$background_rgb = _image_captcha_hex_to_rgb(variable_get('image_captcha_background_color', '#ffffff'));
$foreground_rgb = _image_captcha_hex_to_rgb(variable_get('image_captcha_foreground_color', '#000000'));
// correct foreground for background mode (double vision)
if ($background_mode) {
for ($i=0; $i<3; $i++) {
$foreground_rgb[$i] = 0.75 * $background_rgb[$i] + 0.25 * $foreground_rgb[$i];
}
$textwidth = $bbox[2] - $bbox[0];
}
// calculate spacing
$spacing = ($width - $textwidth) / ($character_quantity + 1);
// character jittering
$jittering_x = .3 * $font_size;
$jittering_y = .3 * $font_size;
// start cursor
$x = $spacing;
foreach ($characters as $character) {
// get character dimensions
if ($font != 'BUILTIN') {
$bbox = imagettfbbox($font_size, 0, realpath($font), $character);
$character_width = $bbox[2] - $bbox[0];
$character_height = $bbox[5] - $bbox[3];
$background_color = imagecolorallocate($image, $background_rgb[0], $background_rgb[1], $background_rgb[2]);
$foreground_color = imagecolorallocate($image, $foreground_rgb[0], $foreground_rgb[1], $foreground_rgb[2]);
// precalculate the value ranges for color randomness
$foreground_randomness = (int)(variable_get('image_captcha_foreground_color_randomness', 100));
if ($foreground_randomness) {
if ($background_mode) {
$foreground_randomness *= .25;
}
// calculate y position
$y = .5 * ($height - $character_height);
// generate random color
if ($light_colors) {
$color = imagecolorallocate($image, mt_rand(128, 255), mt_rand(128, 255), mt_rand(128, 255));
$foreground_color_range = array();
for ($i=0; $i<3; $i++) {
$foreground_color_range[$i] = array(max(0, $foreground_rgb[$i] - $foreground_randomness), min(255, $foreground_rgb[$i] + $foreground_randomness));
}
else {
$color = imagecolorallocate($image, mt_rand(0, 127), mt_rand(0, 127), mt_rand(0, 127));
}
// set default text color
$color = $foreground_color;
// the image is seperated in different character cages, one for each character
// each character will be somewhere inside that cage
$ccage_width = $width / $character_quantity;
$ccage_height = $height;
foreach ($characters as $c => $character) {
// initial position of character: in the center of its cage
$center_x = ($c+.5) * $ccage_width;
$center_y = .5 * $height;
// get character dimensions for ttf fonts
if ($font != 'BUILTIN') {
$bbox = imagettfbbox($font_size, 0, realpath($font), $character);
}
// determine print position: at what coordinate should the character be
// printed so that the bounding box would be nicely centered in the cage?
$pos_x = $center_x - .5 * ($bbox[0] + $bbox[2]);
$pos_y = $center_y - .5 * ($bbox[1] + $bbox[7]);
// calculate available room to jitter: how much can the character be moved
// so that it stays inside its cage?
$dev_x = .5 * max(0, $ccage_width - ($bbox[2] - $bbox[0]));
$dev_y = .5 * max(0, $ccage_height - ($bbox[1] - $bbox[7]));
// add jitter to position
$pos_x = $x + mt_rand(-$jittering_x, $jittering_x);
$pos_y = $y + mt_rand(-$jittering_y, $jittering_y);
$pos_x = $pos_x + mt_rand(-$dev_x, $dev_x);
$pos_y = $pos_y + mt_rand(-$dev_y, $dev_y);
// calculate text color in case of randomness
if ($foreground_randomness) {
$color = imagecolorallocate($image,
mt_rand($foreground_color_range[0][0], $foreground_color_range[0][1]),
mt_rand($foreground_color_range[1][0], $foreground_color_range[1][1]),
mt_rand($foreground_color_range[2][0], $foreground_color_range[2][1])
);
}
// draw character
if ($font == 'BUILTIN') {
imagestring($image, 5, $pos_x, $pos_y, $character, $color);
......@@ -255,9 +310,12 @@ function _image_captcha_image_generator_print_string(&$image, $width, $height, $
else {
imagettftext($image, $font_size, 0, $pos_x, $pos_y, $color, realpath($font), $character);
}
// shift cursor
$x += $character_width + $spacing;
// for debugging purposes: draw character bounding box
// imagerectangle($image, $pos_x + $bbox[0], $pos_y + $bbox[1], $pos_x + $bbox[2], $pos_y + $bbox[7], $color);
}
// return a sign of success
return TRUE;
}
This diff is collapsed.
# 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
#
# Jakub Suchy <jakub.suchy@drupal.cz>, 2007.
msgid ""
msgstr ""
"Project-Id-Version: cs\n"
"POT-Creation-Date: 2007-03-16 22:01-0400\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-Transfer-Encoding: 8bit\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 "Přidává do ruzných formulářů Captchu pro zabránění spamu."
#: captcha.module:27 captcha.info:0
msgid "Captcha"
msgstr "Captcha"
#: captcha.module:28
msgid "Administer how and where Captchas are used."
msgstr "Nastavit kde a jak je Captcha zobrazována."
#: captcha.module:45
msgid "Comment form"
msgstr "Komentářový formulář"
#: captcha.module:46
msgid "User login form"
msgstr "Přihlášení uživatele"
#: captcha.module:47
msgid "User login form block"
msgstr "Přihlášení uživatele z bloku"
#: captcha.module:48
msgid "User edit form"
msgstr "Úprava nastavení účtu uživatele"
#: captcha.module:49
msgid "User registration form"
msgstr "Registrační formulář"
#: captcha.module:50
msgid "User forgot password form"
msgstr "Formulář pro zaslání hesla"
#: captcha.module:51
msgid "User contact form"
msgstr "Kontaktní formulář uživatele"
#: captcha.module:52
msgid "Sitewide contact form"
msgstr "Kontaktní formulář celého webu"
#: captcha.module:53
msgid "Create a node"
msgstr "Vytvořit obsah"
#: captcha.module:62
msgid "Captcha points for the role @role"
msgstr "Captcha body pro roli @role"
#: captcha.module:83
msgid "Type of captcha to use"
msgstr "Typ captchy"
#: captcha.module:86
msgid "Select what kind of challenge you want to pose to the user."
msgstr "Vyberte, jaký typ úkolu bude zobrazen uživateli."
#: captcha.module:91
msgid "Additional response description text"
msgstr "Dodatečný text popisující odpověď"
#: captcha.module:93
msgid "This text will be added below the captcha response field."
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 "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 "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 "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 "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 "Odpověď na zadaný matematický problém je nesprávná."
#: captcha.module:0 captcha.info:0
msgid "captcha"
msgstr "captcha"
#: captcha.info:0
msgid "5.x-1.x-dev"
msgstr "5.x-1.x-dev"
#: captcha.info:0
msgid "Implements a captcha to registration, comment, contact and node entry forms."
msgstr "Umožňuje zobrazovat captchu pro registrační, komentářový, kontaktní a obsahový formulář."
#: captcha.info:0
msgid "SPAM Control"
msgstr "Obrana proti SPAMu"
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.24 2006/05/19 15:00:51 wundo
#
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"POT-Creation-Date: 2006-10-29 02:23+0100\n"
"PO-Revision-Date: 2007-07-10 12:42+0100\n"
"Last-Translator: olax <olax@olax.net>\n"
"Language-Team: German <nf@fuerstentum.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: captcha.module:15
msgid "Adds a Captcha to the registration form."
msgstr "Legger til en Captcha på registreringsskjemaet."
#: captcha.module:26
msgid "Comment Form"
msgstr "Kommentar felt"
#: captcha.module:27
msgid "User Login Form"
msgstr "Pålogging"
#: captcha.module:28
msgid "User Login Form Block"
msgstr "Blokk for pålogging"
#: captcha.module:29
msgid "User Edit Form"
msgstr "Skjema for brukerinstillinger"
#: captcha.module:30
msgid "User Registration Form"
msgstr "Skjema for å opprette ny konto"
#: captcha.module:31
msgid "User Forgot Password Form"
msgstr "\"Bestill nytt passord\"-skjema"
#: captcha.module:32
msgid "User Contact Form"
msgstr "Personlig kontaktskjema"
#: captcha.module:33
msgid "Sitewide Contact Form"
msgstr "Webside-kontaktskjema"
#: captcha.module:34
msgid "Create a node"
msgstr "Opprett innhold"
#: captcha.module:59
msgid "Type of captcha to use"
msgstr "Type Captcha som skal brukes"
#: captcha.module:62
msgid "Select what kind of challenge you want to pose to the user"
msgstr "Velg hva slags problem brukeren skal løse"
#: captcha.module:141
msgid "Math Question: What is %problem?"
msgstr "Mattespørsmål: Hva er %problem?"
#: captcha.module:143
msgid "Please solve the math problem above and type in the result. e.g. for 1+1, type 2"
msgstr "Vennligst løs mattespørsmålet over og skriv inn resultatet. F.eks. for 1+1 så skriver du inn 2"
#: captcha.module:158
msgid "The answer you entered to the math problem is incorrect."
msgstr "Svaret du ga på mattesprøsmålet var feil."
#: captcha.module:0
msgid "captcha"
msgstr "captcha"
# Russian translation of Drupal (captcha.module)
# Copyright 2007 vadbars <vadbars@mail.ru>
# Generated from file: captcha.module,v 1.32 2007/01/30 19:44:46 wundo
#
msgid ""
msgstr ""
"Project-Id-Version: Drupal 5.0\n"
"POT-Creation-Date: 2007-02-24 21:31+0500\n"
"PO-Revision-Date: 2007-02-24 22:29+0500\n"
"Last-Translator: Вадим Барсуков <vadbars@mail.ru>\n"
"Language-Team: Russian Drupal Translation Team (RDTT) <translators@drupal.ru>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=((($n%10==1) && ($n%100!=11))?(0):((((($n%10)>=2)&&(($n%10)<=4))&&((($n%100)<10)||(($n%100)>=20)))?(1):2))\n"
"X-Poedit-Language: Russian\n"
"X-Poedit-Country: RUSSIAN FEDERATION\n"
#: captcha.module:12
msgid "Adds a Captcha to various forms to help prevent spam submissions."
msgstr "Добавляет captcha в различные формы ввода информации для предотвращения спама."
#: captcha.module:28
msgid "Administer how and where Captchas are used."
msgstr "Определяет, как и где использовать captcha (проверку на \"человечность\" при вводе информации)."
#: captcha.module:45
msgid "Comment form"
msgstr "Форма комментариев"
#: captcha.module:46
msgid "User login form"
msgstr "Форма входа на сайт"
#: captcha.module:47
msgid "User login form block"
msgstr "Блок формы входа на сайт"
#: captcha.module:48
msgid "User edit form"
msgstr "Форма редактирования пользователя"
#: captcha.module:49
msgid "User registration form"
msgstr "Форма регистрации пользователя"
#: captcha.module:50
msgid "User forgot password form"
msgstr "Форма \"забыл пароль\""
#: captcha.module:51
msgid "User contact form"
msgstr "Форма контактной информации о пользователе"
#: captcha.module:52
msgid "Sitewide contact form"
msgstr "Форма контактной информации для всего сайта"
#: captcha.module:53
msgid "Create a node"
msgstr "Создание материала"
#: captcha.module:62
msgid "Captcha points for the role @role"
msgstr "Где применять captcha для роли @role"
#: captcha.module:83
msgid "Type of captcha to use"
msgstr "Использовать тип captcha"
#: captcha.module:86
msgid "Select what kind of challenge you want to pose to the user."
msgstr "Выберите, какого типа проверку вы хотите устроить пользователю."
#: captcha.module:91
msgid "Additional response description text"
msgstr "Дополнительный текст"
#: captcha.module:93
msgid "This text will be added below the captcha response field."
msgstr "Это текст будет добавлен ниже поля запроса captcha."
#: captcha.module:98
msgid "Override module's form item description"
msgstr "Заменить стандартное описание."
#: captcha.module:100
msgid "Override the captcha module's form item description to the one set above."
msgstr "Заменить стандартное для модуля описание поля ввода информации на вышеуказанное."
#: captcha.module:197
msgid "Math Question: What is %problem?"
msgstr "Задача: Сколько будет %problem?"
#: captcha.module:198
msgid "Please solve the math problem above and type in the result. e.g. for 1+1, type 2."
msgstr "Пожалуйста, решите математическую задачку и напишите ответ."
#: captcha.module:216
msgid "The answer you entered to the math problem is incorrect."
msgstr "Ваш ответ неверен."
#: captcha.module:27
#: captcha.info:0
msgid "Captcha"
msgstr "Captcha"
#: captcha.module:0
#: captcha.info:0
msgid "captcha"
msgstr "captcha"
#: captcha.info:0
msgid "Implements a captcha to registration, comment, contact and node entry forms."
msgstr "Добавляет captcha (проверку на \"человечность\") при регистрации, комментировании, добавлении материалов и контактной информации."
#: captcha.info:0
msgid "SPAM Control"
msgstr "Контроль СПАМа"
<?php
// $Id$
/**
* Administration form
......
; $Id$
name = "Text CAPTCHA"
description = "Provides a simple text based CAPTCHA."
package = "Spam control"
......
<?php
// $Id$
/**
* On uninstall: remove module variables and clear variable cache
......
<?php
// $Id$
/**
* Implementation of a simple text based CAPTCHA, for use with the CAPTCHA module
......@@ -29,6 +28,7 @@ function text_captcha_menu() {
'file' => 'text_captcha.admin.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('text_captcha_settings_form'),
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_LOCAL_TASK,
);
return $items;
......@@ -57,6 +57,7 @@ function text_captcha_captcha($op, $captcha_type='') {
'#type' => 'textfield',
'#title' => t('What is the @nth word in the phrase "@words"?', array('@nth' => _text_captcha_ordinal($key+1), '@words' => implode(' ', $words))),
'#weight' => 0,
'#size' => 15,
'#required' => TRUE,
);
return $result;
......
<?php
// $Id$
/**
* function for generating a random nonsense word of a given number of characters
......