From 9280d8845e0baf4169803dd126dada4bba1c8c32 Mon Sep 17 00:00:00 2001 From: GoZ Date: Mon, 2 Jul 2012 12:14:18 +0200 Subject: [PATCH] Issue #1176888: Add automatically spamicide on webforms with option --- spamicide.inc | 3 +++ spamicide.install | 2 +- spamicide.module | 11 ++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/spamicide.inc b/spamicide.inc index ec3fa4b..f27fde1 100644 --- a/spamicide.inc +++ b/spamicide.inc @@ -29,6 +29,9 @@ function _spamicide_get_field(&$form) { return $spamicide->form_field; } else { + if(strpos($form, 'webform_client_form') !== FALSE && variable_get('spamicide_webform_enabled', TRUE)) { + return SPAMICIDE_FIELD_DEFAULT; + } return FALSE; } } diff --git a/spamicide.install b/spamicide.install index 242e4ec..9ac603d 100644 --- a/spamicide.install +++ b/spamicide.install @@ -70,7 +70,7 @@ function spamicide_schema() { 'type' => 'varchar', 'length' => 64, 'not null' => TRUE, - 'default' => 'feed_me', + 'default' => SPAMICIDE_FIELD_DEFAULT, ), 'enabled' => array( 'type' => 'int', diff --git a/spamicide.module b/spamicide.module index 1a5f83f..f755924 100644 --- a/spamicide.module +++ b/spamicide.module @@ -1,4 +1,5 @@ t('Report information about attempts to the !dblog.', array('!dblog' => l(t('log'), 'admin/reports/dblog'))), '#default_value' => variable_get('spamicide_log_attempts', TRUE), ); + if(module_exists('webform')) { + $form['spamicide_webform_enabled'] = array( + '#type' => 'checkbox', + '#title' => t('Enable on Webforms'), + '#description' => t('Enable on all webforms.'), + '#default_value' => variable_get('spamicide_webform_enabled', TRUE), + ); + } $form['spamicide_dir'] = array( '#type' => 'textfield', '#size' => 30, @@ -263,7 +272,7 @@ function spamicide_admin_adform_form($form, &$form_state, $spamicide_form_id) { $form['spamicide_form_field'] = array( '#type' => 'textfield', '#title' => t('Form field'), - '#default_value' => 'feed_me', + '#default_value' => SPAMICIDE_FIELD_DEFAULT, '#description' => t('The name you want for the field. Use only letters, numbers, and the underscore character(_).'), ); $form['submit'] = array( -- 1.7.5.4