Commit 0f807cf7 authored by soxofaan's avatar soxofaan

various minor tweaks (syncing some stuff back from DRUPAL-7--1 branch)

parent 3d35420c
......@@ -26,6 +26,7 @@ Conflicts/known issues:
error: unknown CAPTCHA session ID'.
Configuration:
The configuration page is at admin/user/captcha, here you can configure
the CAPTCHA module and enable challenges for the desired forms.
The configuration page is at admin/user/captcha,
where you can configure the CAPTCHA module
and enable challenges for the desired forms.
You can also tweak the image CAPTCHA to your liking.
<?php
// $Id$
/**
* @file
* Functionality and helper functions for CAPTCHA administration.
*/
/**
* Return an array with the available CAPTCHA types, for use as options array
* for a select form elements.
......
<?php
// $Id$
/**
* @file
* General CAPTCHA functionality and helper functions.
*/
/**
* Helper function for adding/updating a CAPTCHA point.
*
......
<?php
// $Id$
/**
* @file
* Install, update and uninstall functions for the CAPTCHA module.
*/
/**
* Implementation of hook_schema().
*/
......@@ -132,8 +137,12 @@ 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', 'forum_node_form');
$form_ids = array(
'comment_form',
'contact_mail_user', 'contact_mail_page',
'user_register', 'user_pass', 'user_login', 'user_login_block',
'forum_node_form'
);
foreach ($form_ids as $form_id) {
db_query("INSERT INTO {captcha_points} (form_id, module, type) VALUES ('%s', NULL, NULL)", $form_id);
}
......
......@@ -316,7 +316,7 @@ function captcha_form_alter(&$form, $form_state, $form_id) {
$captcha_point = captcha_get_form_id_setting($form_id);
if ($captcha_point && $captcha_point->type) {
module_load_include('inc', 'captcha');
# Build CAPTCHA form element.
// Build CAPTCHA form element.
$captcha_element = array(
'#type' => 'captcha',
'#captcha_type' => $captcha_point->module .'/'. $captcha_point->type,
......@@ -326,7 +326,7 @@ function captcha_form_alter(&$form, $form_state, $form_id) {
$captcha_element['#description'] = _captcha_get_description();
}
# Get placement in form and insert in form.
// Get placement in form and insert in form.
$captcha_placement = _captcha_get_captcha_placement($form_id, $form);
_captcha_insert_captcha_element($form, $captcha_placement, $captcha_element);
......@@ -376,14 +376,15 @@ function captcha_form_alter(&$form, $form_state, $form_id) {
'#captcha_admin_mode' => TRUE,
);
}
} else {
}
else {
$captcha_element['#title'] = t('CAPTCHA: no challenge enabled');
$captcha_element['add_captcha'] = array(
'#value' => l(t('Place a CAPTCHA here for untrusted users.'), "admin/user/captcha/captcha/captcha_point/$form_id", array('query' => drupal_get_destination()))
);
}
# Get placement in form and insert in form.
// Get placement in form and insert in form.
$captcha_placement = _captcha_get_captcha_placement($form_id, $form);
_captcha_insert_captcha_element($form, $captcha_placement, $captcha_element);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment