Commit 96fe5ba2 authored by sanchiz's avatar sanchiz Committed by podarok
Browse files

Issue #2364775 by sanchiz: Fix notices from CodeSniffer.

parent 9b39e1b3
......@@ -6,16 +6,17 @@
*/
/**
* Return an array with the available CAPTCHA types, for use as options array
* for a select form elements.
* Return an array with the available CAPTCHA types, for use as options array for a select form elements.
*
* @param $add_special_options if true: also add a 'none' and 'default' option
* @param bool $add_special_options
* if true: also add a 'none' and 'default' option
*
* @return an associative array mapping "$module/$type" to
* @return array
* Mapping "$module/$type" to
* "$type (from module $module)" with $module the module name implementing the CAPTCHA
* and $type the name of the CAPTCHA type.
*/
function _captcha_available_challenge_types($add_special_options=TRUE) {
function _captcha_available_challenge_types($add_special_options = TRUE) {
$captcha_types = array();
if ($add_special_options) {
$captcha_types['none'] = t('- No challenge -');
......@@ -35,7 +36,7 @@ function _captcha_available_challenge_types($add_special_options=TRUE) {
}
/**
* Form builder function for the general CAPTCHA configuration
* Form builder function for the general CAPTCHA configuration.
*/
function captcha_admin_settings() {
module_load_include('inc', 'captcha');
......@@ -88,7 +89,7 @@ function captcha_admin_settings() {
$form['captcha_form_protection']['captcha_form_id_overview']['captcha_captcha_points'][$captcha_point->form_id]['operations'] = array(
'#markup' => implode(", ", array(
l(t('delete'), "admin/config/people/captcha/captcha/captcha_point/{$captcha_point->form_id}/delete"),
))
)),
);
}
......@@ -197,14 +198,10 @@ function captcha_admin_settings() {
'#title' => t('Persistence'),
'#default_value' => variable_get('captcha_persistence', CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_INSTANCE),
'#options' => array(
CAPTCHA_PERSISTENCE_SHOW_ALWAYS =>
t('Always add a challenge.'),
CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_INSTANCE =>
t('Omit challenges in a multi-step/preview workflow once the user successfully responds to a challenge.'),
CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_TYPE =>
t('Omit challenges on a form type once the user successfully responds to a challenge on a form of that type.'),
CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL =>
t('Omit challenges on all forms once the user successfully responds to any challenge on the site.'),
CAPTCHA_PERSISTENCE_SHOW_ALWAYS => t('Always add a challenge.'),
CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_INSTANCE => t('Omit challenges in a multi-step/preview workflow once the user successfully responds to a challenge.'),
CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_TYPE => t('Omit challenges on a form type once the user successfully responds to a challenge on a form of that type.'),
CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL => t('Omit challenges on all forms once the user successfully responds to any challenge on the site.'),
),
'#description' => t('Define if challenges should be omitted during the rest of a session once the user successfully responds to a challenge.'),
);
......@@ -236,7 +233,7 @@ function captcha_admin_settings() {
}
/**
* Custom theme function for a table of (form_id -> CAPTCHA type) settings
* Custom theme function for a table of (form_id -> CAPTCHA type) settings.
*/
function theme_captcha_admin_settings_captcha_points($variables) {
$form = $variables['form'];
......@@ -282,7 +279,7 @@ function captcha_admin_settings_submit($form, &$form_state) {
variable_set('captcha_default_challenge', $form_state['values']['captcha_default_challenge']);
variable_set('captcha_default_challenge_on_nonlisted_forms', $form_state['values']['captcha_default_challenge_on_nonlisted_forms']);
// Process CAPTCHA points
// Process CAPTCHA points.
if (isset($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'])) {
foreach ($form_state['values']['captcha_form_id_overview']['captcha_captcha_points'] as $captcha_point_form_id => $data) {
captcha_set_form_id_setting($captcha_point_form_id, $data['captcha_type']);
......@@ -332,9 +329,6 @@ function captcha_admin_settings_submit($form, &$form_state) {
drupal_set_message(t('The CAPTCHA settings have been saved.'), 'status');
}
/**
* Submit callback; clear CAPTCHA placement cache.
*/
......@@ -343,33 +337,36 @@ function captcha_clear_captcha_placement_cache_submit($form, &$form_state) {
drupal_set_message(t('Cleared the CAPTCHA placement cache.'));
}
/**
* Central handler for CAPTCHA point administration (adding, disabling, deleting)
* Central handler for CAPTCHA point administration (adding, disabling, deleting).
*/
function captcha_point_admin($captcha_point_form_id=NULL, $op=NULL) {
function captcha_point_admin($captcha_point_form_id = NULL, $op = NULL) {
module_load_include('inc', 'captcha');
// if $captcha_point_form_id and action $op given: do the action
// If $captcha_point_form_id and action $op given: do the action.
if ($captcha_point_form_id) {
switch ($op) {
case 'disable':
return drupal_get_form('captcha_point_disable_confirm', $captcha_point_form_id, FALSE);
case 'delete':
return drupal_get_form('captcha_point_disable_confirm', $captcha_point_form_id, TRUE);
}
// return edit form for CAPTCHA point
// Return edit form for CAPTCHA point.
return drupal_get_form('captcha_point_admin_form', $captcha_point_form_id);
}
// return add form for CAPTCHA point
// Return add form for CAPTCHA point.
return drupal_get_form('captcha_point_admin_form');
}
function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NULL) {
/**
* Admin form.
*/
function captcha_point_admin_form($form, $form_state, $captcha_point_form_id = NULL) {
$form = array();
$default_captcha_type = 'none';
if (isset($captcha_point_form_id)) {
// use given CAPTCHA point form_id
// Use given CAPTCHA point form_id.
$form['captcha_point_form_id'] = array(
'#type' => 'textfield',
'#title' => t('Form ID'),
......@@ -383,14 +380,14 @@ function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NUL
}
}
else {
// textfield for CAPTCHA point form_id
// Textfield for CAPTCHA point form_id.
$form['captcha_point_form_id'] = array(
'#type' => 'textfield',
'#title' => t('Form ID'),
'#description' => t('The Drupal form_id of the form to add the CAPTCHA to.'),
);
}
// select widget for CAPTCHA type
// Select widget for CAPTCHA type.
$form['captcha_type'] = array(
'#type' => 'select',
'#title' => t('Challenge type'),
......@@ -398,9 +395,9 @@ function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NUL
'#default_value' => $default_captcha_type,
'#options' => _captcha_available_challenge_types(),
);
// redirect to general CAPTCHA settings page after submission
// Redirect to general CAPTCHA settings page after submission.
$form['#redirect'] = 'admin/config/people/captcha';
// submit button
// Submit button.
$form['actions'] = array('#type' => 'actions');
$form['actions']['submit'] = array(
'#type' => 'submit',
......@@ -409,9 +406,8 @@ function captcha_point_admin_form($form, $form_state, $captcha_point_form_id=NUL
return $form;
}
/**
* validation function for captcha_point_admin_form
* Validation function for captcha_point_admin_form.
*/
function captcha_point_admin_form_validate($form, $form_state) {
if (!preg_match('/^[a-z0-9_]+$/', $form_state['values']['captcha_point_form_id'])) {
......@@ -419,7 +415,6 @@ function captcha_point_admin_form_validate($form, $form_state) {
}
}
/**
* Submit function for captcha_point_admin_form.
*/
......@@ -431,7 +426,7 @@ function captcha_point_admin_form_submit($form, $form_state) {
}
/**
* Confirm dialog for disabling/deleting a CAPTCHA point
* Confirm dialog for disabling/deleting a CAPTCHA point.
*/
function captcha_point_disable_confirm($form, &$form_state, $captcha_point_form_id, $delete) {
$form = array();
......@@ -496,12 +491,12 @@ function captcha_examples($form, $form_state, $module, $challenge) {
$form = array();
if ($module && $challenge) {
// Generate 10 example challenges.
for ($i=0; $i<10; $i++) {
for ($i = 0; $i < 10; $i++) {
$form["challenge_{$i}"] = _captcha_generate_example_challenge($module, $challenge);
}
}
else {
// generate a list with examples of the available CAPTCHA types
// Generate a list with examples of the available CAPTCHA types.
$form['info'] = array(
'#markup' => t('This page gives an overview of all available challenge types, generated with their current settings.'),
);
......
......@@ -8,14 +8,16 @@
/**
* Helper function for adding/updating a CAPTCHA point.
*
* @param $form_id the form ID to configure.
* @param captcha_type the setting for the given form_id, can be:
* @param string $form_id
* the form ID to configure.
*
* @param string $captcha_type
* the setting for the given form_id, can be:
* - 'none' to disable CAPTCHA,
* - 'default' to use the default challenge type
* - NULL to remove the entry for the CAPTCHA type
* - something of the form 'image_captcha/Image'
* - an object with attributes $captcha_type->module and $captcha_type->captcha_type
* @return nothing
*/
function captcha_set_form_id_setting($form_id, $captcha_type) {
// Handle 'none'.
......@@ -52,32 +54,41 @@ function captcha_set_form_id_setting($form_id, $captcha_type) {
->execute();
}
else {
drupal_set_message(t('Failed to set a CAPTCHA type for form %form_id: could not interpret value "@captcha_type"',
array('%form_id' => $form_id, '@captcha_type' => (string)$captcha_type)), 'warning');
drupal_set_message(
t('Failed to set a CAPTCHA type for form %form_id: could not interpret value "@captcha_type"',
array(
'%form_id' => $form_id,
'@captcha_type' => (string) $captcha_type,
)
),
'warning'
);
}
}
/**
* Get the CAPTCHA setting for a given form_id.
*
* @param $form_id the form_id to query for
* @param $symbolic flag to return as (symbolic) strings instead of object.
* @param string $form_id
* the form_id to query for
*
* @param bool $symbolic
* flag to return as (symbolic) strings instead of object.
*
* @return NULL if no setting is known
* @return NULL
* if no setting is known
* or a captcha_point object with fields 'module' and 'captcha_type'.
* If argument $symbolic is true, returns (symbolic) as 'none', 'default'
* or in the form 'captcha/Math'.
*/
function captcha_get_form_id_setting($form_id, $symbolic=FALSE) {
function captcha_get_form_id_setting($form_id, $symbolic = FALSE) {
// Fetch setting from database.
$result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id",
array(':form_id' => $form_id));
$result = db_query("SELECT module, captcha_type FROM {captcha_points} WHERE form_id = :form_id", array(':form_id' => $form_id));
$captcha_point = $result->fetchObject();
// If no setting is available in database for the given form,
// but 'captcha_default_challenge_on_nonlisted_forms' is enabled, pick the default type anyway
if (!$captcha_point && variable_get('captcha_default_challenge_on_nonlisted_forms', FALSE))
{
// but 'captcha_default_challenge_on_nonlisted_forms' is enabled, pick the default type anyway.
if (!$captcha_point && variable_get('captcha_default_challenge_on_nonlisted_forms', FALSE)) {
$captcha_point = (object) array('captcha_type' => 'default');
}
......@@ -104,15 +115,19 @@ function captcha_get_form_id_setting($form_id, $symbolic=FALSE) {
return $captcha_point;
}
/**
* Helper function for generating a new CAPTCHA session.
*
* @param $form_id the form_id of the form to add a CAPTCHA to.
* @param $status the initial status of the CAPTHCA session.
* @return the session ID of the new CAPTCHA session.
* @param string $form_id
* the form_id of the form to add a CAPTCHA to.
*
* @param int $status
* the initial status of the CAPTHCA session.
*
* @return int
* the session ID of the new CAPTCHA session.
*/
function _captcha_generate_captcha_session($form_id=NULL, $status=CAPTCHA_STATUS_UNSOLVED) {
function _captcha_generate_captcha_session($form_id = NULL, $status = CAPTCHA_STATUS_UNSOLVED) {
global $user;
// Initialize solution with random data.
$solution = md5(mt_rand());
......@@ -135,8 +150,11 @@ function _captcha_generate_captcha_session($form_id=NULL, $status=CAPTCHA_STATUS
/**
* Helper function for updating the solution in the CAPTCHA session table.
*
* @param $captcha_sid the CAPTCHA session ID to update.
* @param $solution the new solution to associate with the given CAPTCHA session.
* @param int $captcha_sid
* the CAPTCHA session ID to update.
*
* @param string $solution
* the new solution to associate with the given CAPTCHA session.
*/
function _captcha_update_captcha_session($captcha_sid, $solution) {
db_update('captcha_sessions')
......@@ -149,8 +167,9 @@ function _captcha_update_captcha_session($captcha_sid, $solution) {
}
/**
* Helper function for checking if CAPTCHA is required for user,
* based on the CAPTCHA persistence setting, the CAPTCHA session ID and
* Helper function for checking if CAPTCHA is required for user.
*
* Based on the CAPTCHA persistence setting, the CAPTCHA session ID and
* user session info.
*/
function _captcha_required_for_user($captcha_sid, $form_id) {
......@@ -174,10 +193,11 @@ function _captcha_required_for_user($captcha_sid, $form_id) {
return TRUE;
}
else {
$captcha_success_form_ids = isset($_SESSION['captcha_success_form_ids']) ? (array)($_SESSION['captcha_success_form_ids']) : array();
$captcha_success_form_ids = isset($_SESSION['captcha_success_form_ids']) ? (array) ($_SESSION['captcha_success_form_ids']) : array();
switch ($captcha_persistence) {
case CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL:
return (count($captcha_success_form_ids) == 0);
case CAPTCHA_PERSISTENCE_SKIP_ONCE_SUCCESSFUL_PER_FORM_TYPE:
return !isset($captcha_success_form_ids[$form_id]);
}
......@@ -189,17 +209,19 @@ function _captcha_required_for_user($captcha_sid, $form_id) {
/**
* Get the CAPTCHA description as configured on the general CAPTCHA
* settings page.
* Get the CAPTCHA description as configured on the general CAPTCHA settings page.
*
* If the locale module is enabled, the description will be returned
* for the current language the page is rendered for. This language
* can optionally been overriden with the $lang_code argument.
* can optionally been overridden with the $lang_code argument.
*
* @param $lang_code an optional language code to get the descripion for.
* @return a string with (localized) CAPTCHA description.
* @param string|null $lang_code
* an optional language code to get the description for.
*
* @return string
* String with (localized) CAPTCHA description.
*/
function _captcha_get_description($lang_code=NULL) {
function _captcha_get_description($lang_code = NULL) {
// If no language code is given: use the language of the current page.
global $language;
$lang_code = isset($lang_code) ? $lang_code : $language->language;
......@@ -217,9 +239,13 @@ function _captcha_get_description($lang_code=NULL) {
/**
* Parse or interpret the given captcha_type.
* @param $captcha_type string representation of the CAPTCHA type,
*
* @param string $captcha_type
* string representation of the CAPTCHA type,
* e.g. 'default', 'none', 'captcha/Math', 'image_captcha/Image'
* @return list($captcha_module, $captcha_type)
*
* @return array
* list($captcha_module, $captcha_type)
*/
function _captcha_parse_captcha_type($captcha_type) {
if ($captcha_type == 'none') {
......@@ -233,11 +259,17 @@ function _captcha_parse_captcha_type($captcha_type) {
/**
* Helper function to get placement information for a given form_id.
* @param $form_id the form_id to get the placement information for.
* @param $form if a form corresponding to the given form_id, if there
*
* @param string $form_id
* the form_id to get the placement information for.
*
* @param array $form
* if a form corresponding to the given form_id, if there
* is no placement info for the given form_id, this form is examined to
* guess the placement.
* @return placement info array (@see _captcha_insert_captcha_element() for more
*
* @return array
* placement info array (@see _captcha_insert_captcha_element() for more
* info about the fields 'path', 'key' and 'weight'.
*/
function _captcha_get_captcha_placement($form_id, $form) {
......@@ -298,8 +330,11 @@ function _captcha_get_captcha_placement($form_id, $form) {
/**
* Helper function for searching the buttons in a form.
*
* @param $form the form to search button elements in
* @return an array of paths to the buttons.
* @param array $form
* the form to search button elements in
*
* @return array
* an array of paths to the buttons.
* A path is an array of keys leading to the button, the last
* item in the path is the weight of the button element
* (or NULL if undefined).
......@@ -328,8 +363,12 @@ function _captcha_search_buttons($form) {
/**
* Helper function to insert a CAPTCHA element in a form before a given form element.
* @param $form the form to add the CAPTCHA element to.
* @param $placement information where the CAPTCHA element should be inserted.
*
* @param array $form
* the form to add the CAPTCHA element to.
*
* @param array $placement
* information where the CAPTCHA element should be inserted.
* $placement should be an associative array with fields:
* - 'path': path (array of path items) of the container in the form where the
* CAPTCHA element should be inserted.
......@@ -339,7 +378,9 @@ function _captcha_search_buttons($form) {
* - 'weight': if 'key' is not NULL: should be the weight of the element defined by 'key'.
* If 'key' is NULL and weight is not NULL: set the weight property of the CAPTCHA element
* to this value.
* @param $captcha_element the CAPTCHA element to insert.
*
* @param array $captcha_element
* the CAPTCHA element to insert.
*/
function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
// Get path, target and target weight or use defaults if not available.
......@@ -367,7 +408,7 @@ function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
if ($target_weight != NULL) {
$captcha_element['#weight'] = $target_weight;
}
$form_stepper['captcha'] = $captcha_element;
$form_stepper['captcha'] = $captcha_element;
}
// If there is a target available: make sure the CAPTCHA element comes right before it.
else {
......@@ -375,7 +416,7 @@ function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
// and just append the CAPTCHA: sorting will fix the ordering anyway.
if ($target_weight != NULL) {
$captcha_element['#weight'] = $target_weight - .1;
$form_stepper['captcha'] = $captcha_element;
$form_stepper['captcha'] = $captcha_element;
}
else {
// If we can't play with weights: insert the CAPTCHA element at the right position.
......@@ -384,11 +425,10 @@ function _captcha_insert_captcha_element(&$form, $placement, $captcha_element) {
// chop of the end, append the CAPTCHA element and put the end back.
$offset = array_search($target_key, array_keys($form_stepper));
$end = array_splice($form_stepper, $offset);
$form_stepper['captcha'] = $captcha_element;
$form_stepper['captcha'] = $captcha_element;
foreach ($end as $k => $v) {
$form_stepper[$k] = $v;
}
}
}
}
......@@ -97,7 +97,7 @@ function captcha_schema() {
'type' => 'int',
'not null' => TRUE,
'default' => 0,
)
),
),
'primary key' => array('csid'),
'indexes' => array(
......@@ -109,7 +109,7 @@ function captcha_schema() {
}
/**
* Implementation of hook_requirements().
* Implements of hook_requirements().
*/
function captcha_requirements($phase) {
$requirements = array();
......@@ -130,7 +130,7 @@ function captcha_requirements($phase) {
}
/**
* Implementation of hook_install().
* Implements of hook_install().
*/
function captcha_install() {
$t = get_t();
......@@ -138,7 +138,7 @@ function captcha_install() {
$form_ids = array(
'contact_site_form', 'contact_personal_form',
'user_register_form', 'user_pass', 'user_login', 'user_login_block',
'forum_node_form'
'forum_node_form',
);
// Add form_ids of all currently known node types too.
foreach (node_type_get_names() as $type => $name) {
......@@ -167,7 +167,7 @@ function captcha_install() {
}
/**
* Implementation of hook_uninstall().
* Implements of hook_uninstall().
*/
function captcha_uninstall() {
drupal_uninstall_schema('captcha');
......@@ -176,7 +176,7 @@ function captcha_uninstall() {
}
/**
* Implementation of hook_update_N()
* Implements of hook_update_N().
*/
function captcha_update_6200() {
$items = array();
......@@ -239,7 +239,7 @@ function captcha_update_6200() {
'type' => 'int',
'not null' => TRUE,
'default' => 0,
)
),
),
'primary key' => array('csid'),
'indexes' => array(
......@@ -253,7 +253,8 @@ function captcha_update_6200() {
}
/**
* Implementation of hook_update_N()
* Implements of hook_update_N().
*
* Change the captcha points with the old text CAPTCHA, which was
* removed from the 6.x-2.x branch, to the simple math CAPTCHA.
*/
......@@ -264,7 +265,8 @@ function captcha_update_6201() {
}
/**
* Implementation of hook_update_N()
* Implements of hook_update_N().
*
* Add a CAPTCHA token column to captcha_sessions table.
*/
function captcha_update_6202() {
......@@ -274,7 +276,8 @@ function captcha_update_6202() {
}
/**
* Implementation of hook_update_N()
* Implements of hook_update_N().
*
* Rename the type field to captcha_type in captcha_points.
*/
function captcha_update_6203() {
......
......@@ -46,6 +46,7 @@ function captcha_help($path, $arg) {
) . '</p>';
$output .= '<p>' . t('CAPTCHA is a trademark of Carnegie Mellon University.') . '</p>';
return $output;
case 'admin/config/people/captcha':
case 'admin/config/people/captcha/captcha':
case 'admin/config/people/captcha/captcha/settings':
......@@ -56,11 +57,11 @@ function captcha_help($path, $arg) {
}
/**
* Implementation of hook_menu().
* Implements of hook_menu().
*/
function captcha_menu() {
$items = array();
// main configuration page of the basic CAPTCHA module
// Main configuration page of the basic CAPTCHA module.
$items['admin/config/people/captcha'] = array(
'title' => 'CAPTCHA',
'description' => 'Administer how and where CAPTCHAs are used.',
......@@ -70,8 +71,8 @@ function captcha_menu() {
'access arguments' => array('administer CAPTCHA settings'),
'type' => MENU_NORMAL_ITEM,
);
// the default local task (needed when other modules want to offer
// alternative CAPTCHA types and their own configuration page as local task)
// The default local task (needed when other modules want to offer,
// alternative CAPTCHA types and their own configuration page as local task).
$items['admin/config/people/captcha/captcha'] = array(
'title' => 'CAPTCHA',
'access arguments' => array('administer CAPTCHA settings'),
......@@ -106,7 +107,7 @@ function captcha_menu() {
}
/**
* Implementation of hook_permission().
* Implements of hook_permission().
*/
function captcha_permission() {
return array(
......@@ -121,7 +122,7 @@ function captcha_permission() {
}
/**
* Implementation of hook_theme().
* Implements of hook_theme().
*/
function captcha_theme() {
return array(
......@@ -135,27 +136,26 @@ function captcha_theme() {
}
/**
* Implementation of hook_cron().
* Implements of hook_cron().
*
* Remove old entries from captcha_sessions table.
*/
function captcha_cron() {
// Remove challenges older than 1 day.
db_delete('captcha_sessions')
->condition('timestamp', REQUEST_TIME - 60*60*24, '<')
->condition('timestamp', REQUEST_TIME - 60 * 60 * 24, '<')
->execute();
}
/**
* Implementation of hook_element_info().
* Implements of hook_element_info().
*/
function captcha_element_info() {
// Define the CAPTCHA form element with default properties.
$captcha_element = array(
'#input' => TRUE,
'#process' => array('captcha_element_process'),
// The type of challenge: e.g. 'default', 'none', 'captcha/Math', 'image_captcha/Image', ...
// The type of challenge: e.g. 'default', 'none', 'captcha/Math', 'image_captcha/Image'.
'#captcha_type' => 'default',
'#default_value' => '',
// CAPTCHA in admin mode: presolve the CAPTCHA and always show it (despite previous successful responses).
......@@ -254,7 +254,6 @@ function captcha_element_process($element, &$form_state, $complete_form) {
'captcha_sid' => $captcha_sid,
);
if (_captcha_required_for_user($captcha_sid, $this_form_id) || $element['#captcha_admin_mode']) {
// Generate a CAPTCHA and its solution
// (note that the CAPTCHA session ID is given as third argument).
......@@ -263,7 +262,11 @@ function captcha_element_process($element, &$form_state, $complete_form) {
// The selected module did not return what we expected: log about it and quit.
watchdog('CAPTCHA',
'CAPTCHA problem: unexpected result from hook_captcha() of module %module when trying to retrieve challenge type %type for form %form_id.',
array('%type' => $captcha_type_challenge, '%module' => $captcha_type_module, '%form_id' => $this_form_id),
array(
'%type' => $captcha_type_challenge,
'%module' => $captcha_type_module,
'%form_id' => $this_form_id,
),
WATCHDOG_ERROR);
return $element;
}
......@@ -300,7 +303,6 @@ function captcha_element_process($element, &$form_state, $complete_form) {
return $element;
}