You are here

function spamicide_admin_form_submit in Spamicide 7

Same name and namespace in other branches
  1. 5 spamicide.module \spamicide_admin_form_submit()
  2. 6 spamicide.module \spamicide_admin_form_submit()

Implements hook_form_submit().

_values

Parameters

$form:

File

./spamicide.module, line 236
This module provides yet another tool to eliminate spam.

Code

function spamicide_admin_form_submit($form, &$form_state) {
  module_load_include('inc', 'spamicide');
  variable_set('spamicide_administration_mode', $form_state['values']['spamicide_administration_mode']);
  variable_set('spamicide_log_attempts', $form_state['values']['spamicide_log_attempts']);
  if ($form_state['values']['spamicide_dir'] != variable_get('spamicide_dir')) {
    file_unmanaged_delete_recursive('public://' . variable_get('spamicide_dir'));
    variable_set('spamicide_dir', $form_state['values']['spamicide_dir']);
  }
  if ($form_state['values']['spamicide_description'] != variable_get('spamicide_description')) {
    variable_set('spamicide_description', $form_state['values']['spamicide_description']);
  }
  foreach ($form_state['values']['spamicide_form'] as $spamicide_form_id => $data) {

    // create an array of the files in the spamdir and check it
    _spamicide_set_css_file($data['form_field'], 'create');
    db_merge('spamicide')
      ->key(array(
      'form_id' => $spamicide_form_id,
    ))
      ->fields(array(
      'enabled' => $data['enabled'],
      'form_field' => $data['form_field'],
    ))
      ->execute();
  }
  drupal_set_message(t('The Spamicide settings were saved.'), 'status');
}