=== modified file 'captcha.module' --- captcha.module 2007-06-21 07:46:37 +0000 +++ captcha.module 2007-06-21 08:10:26 +0000 @@ -2,7 +2,7 @@ // $Id$ -define('CAPTCHA_DESCRIPTION', 'This question is used to make sure you are a human user and to prevent spam submissions.'); +define('CAPTCHA_DESCRIPTION', 'This question is used to make sure you are a human visitor and to prevent spam submissions.'); /** * Implementation of hook_help(). @@ -66,21 +66,21 @@ if ($form_id) { switch ($op) { case 'disable': - db_query("UPDATE {captcha_points} SET captcha_type=NULL WHERE form_id='%s'", $form_id); + db_query("UPDATE {captcha_points} SET captcha_type = NULL WHERE form_id = '%s'", $form_id); drupal_set_message(t('Disabled captcha point %form_id.', array('%form_id'=>$form_id))); drupal_goto('admin/settings/captcha'); break; case 'hide': - db_query("UPDATE {captcha_points} SET visible=0 WHERE form_id='%s'", $form_id); + db_query("UPDATE {captcha_points} SET visible = 0 WHERE form_id = '%s'", $form_id); drupal_goto('admin/settings/captcha'); break; case 'edit': return drupal_get_form('captcha_admin_captcha_point_edit', $form_id); break; case 'enable': - $present = db_result(db_query("SELECT 1 FROM {captcha_points} WHERE form_id='%s'", $form_id)); + $present = db_result(db_query("SELECT 1 FROM {captcha_points} WHERE form_id = '%s'", $form_id)); if ($present) { - db_query("UPDATE {captcha_points} SET visible=1 WHERE form_id='%s'", $form_id); + db_query("UPDATE {captcha_points} SET visible = 1 WHERE form_id = '%s'", $form_id); } else { db_query("INSERT INTO {captcha_points} (form_id, description, captcha_type, visible) VALUES ('%s', '', NULL, 1)", $form_id); @@ -113,7 +113,7 @@ '#theme' => 'captcha_admin_settings_captcha_points', ); $captcha_challenges = _captcha_supported_challenges_types(); - $result = db_query("SELECT * FROM {captcha_points} WHERE visible=1 ORDER BY form_id"); + $result = db_query("SELECT * FROM {captcha_points} WHERE visible = 1 ORDER BY form_id"); while ($captcha_point = db_fetch_object($result)) { $form['captcha_types'][$captcha_point->form_id]['form_id'] = array( '#value' => $captcha_point->form_id, @@ -138,7 +138,7 @@ '#type' => 'textfield', '#title' => t('Captcha description'), '#description' => t('This description should explain to the anonymous visitor why the captcha needs to be solved.'), - '#default_value' => variable_get('captcha_description', t(CAPTCHA_DESCRIPTION)), + '#default_value' => t(variable_get('captcha_description', CAPTCHA_DESCRIPTION)), ); // captcha persistens $form["captcha_persist"] = array( @@ -180,10 +180,10 @@ foreach($form_values['captcha_types'] as $form_id => $data) { $captcha_type = $data['captcha_type']; if ($captcha_type == 'none') { - db_query("UPDATE {captcha_points} SET captcha_type=NULL WHERE form_id='%s'", $form_id); + db_query("UPDATE {captcha_points} SET captcha_type = NULL WHERE form_id = '%s'", $form_id); } else { - db_query("UPDATE {captcha_points} SET captcha_type='%s' WHERE form_id='%s'", $captcha_type, $form_id); + db_query("UPDATE {captcha_points} SET captcha_type = '%s' WHERE form_id = '%s'", $captcha_type, $form_id); } } variable_set('captcha_description', $form_values['captcha_description']); @@ -197,7 +197,7 @@ */ function captcha_admin_captcha_point_edit($form_id) { $captcha_challenges = _captcha_supported_challenges_types(); - $captcha_point = db_fetch_object(db_query("SELECT * FROM {captcha_points} WHERE form_id='%s'", $form_id)); + $captcha_point = db_fetch_object(db_query("SELECT * FROM {captcha_points} WHERE form_id = '%s'", $form_id)); drupal_set_title(t('Form with form_id "@form_id"', array('@form_id' => $form_id))); if ($captcha_point) { $form = array(); @@ -208,7 +208,7 @@ $form['description'] = array( '#type' => 'textfield', '#title' => t('Description'), - '#description' => t('Describe the selected form.'), + '#description' => t('Describe the form (usefull when the form_id is a bit to cryptic).'), '#default_value' => $captcha_point->description, ); $form['captcha_type'] = array( @@ -220,7 +220,7 @@ $form['visible'] = array( '#type' => 'checkbox', '#title' => t('Visible'), - '#description' => t('If enabled, this Form ID will be listed on the general Captcha settings page'), + '#description' => t('If enabled, this form will be listed on the general Captcha settings page.'), '#default_value' => $captcha_point->visible, ); $form['submit'] = array( @@ -235,7 +235,7 @@ */ function captcha_admin_captcha_point_edit_submit($form_id, $form_values) { if ($form_id == 'captcha_admin_captcha_point_edit') { - db_query("DELETE FROM {captcha_points} WHERE form_id='%s'", $form_values['_form_id']); + db_query("DELETE FROM {captcha_points} WHERE form_id = '%s'", $form_values['_form_id']); if ($form_values['captcha_type'] == 'none'){ db_query("INSERT INTO {captcha_points} (form_id, description, captcha_type, visible) VALUES ('%s', '%s', NULL, %d)", $form_values['_form_id'], $form_values['description'], $form_values['visible']); } @@ -256,12 +256,12 @@ if (user_access('administer site configuration') && variable_get('captcha_administration_mode', FALSE)) { // For administrators: show captcha info and offer link to configure it - $captcha_type = db_result(db_query("SELECT captcha_type FROM {captcha_points} WHERE visible=1 AND form_id='%s'", $form_id)); + $captcha_type = db_result(db_query("SELECT captcha_type FROM {captcha_points} WHERE visible = 1 AND form_id = '%s'", $form_id)); if ($captcha_type) { $form['captcha'] = array( '#type' => 'item', '#title' => t('Captcha administration'), - '#description' => t('The captcha challenge %captcha_type is enabled at this point for anonymous users: !edit, !disable.', array( + '#description' => t('The captcha challenge %captcha_type is enabled at this point for anonymous visitors: !edit, !disable.', array( '%captcha_type' => $captcha_type, '!edit' => l(t('edit captcha type'), "admin/settings/captcha/$form_id/edit"), '!disable' => l(t('remove captcha from this form'), "admin/settings/captcha/$form_id/disable"))), @@ -271,7 +271,7 @@ $form['captcha'] = array( '#type' => 'item', '#title' => t('Captcha administration'), - '#description' => t('Click !here to enable a captcha challenge at this point for anonymous users.', array( + '#description' => t('Click !here to enable a captcha challenge at this point for anonymous visitors.', array( '!here' => l(t('here'), "admin/settings/captcha/$form_id/enable"))), ); } @@ -287,19 +287,19 @@ return; } // get captcha type and return if no captcha set - $captcha_type = db_result(db_query("SELECT captcha_type FROM {captcha_points} WHERE visible=1 AND form_id='%s'", $form_id)); + $captcha_type = db_result(db_query("SELECT captcha_type FROM {captcha_points} WHERE visible = 1 AND form_id = '%s'", $form_id)); if (!$captcha_type) { return; } // get captcha module list($captcha_module, $captcha_type) = explode('::', $captcha_type); $result = module_invoke($captcha_module, 'captcha', 'generate', $captcha_type); - $captcha_description = variable_get('captcha_description', t(CAPTCHA_DESCRIPTION)); + $captcha_description = variable_get('captcha_description', CAPTCHA_DESCRIPTION); if ($captcha_description) { $form['captcha'] = array( '#type' => 'fieldset', '#title' => t('Captcha'), - '#description' => $captcha_description, + '#description' => t($captcha_description), ); } else {