You are here

function spam_admin_settings_form_submit in Spam 5.3

Store general spam settings in database.

File

./spam.module, line 849

Code

function spam_admin_settings_form_submit($form_id, $form_values) {
  $modules = spam_invoke_api('content_module');
  foreach ($modules as $module) {
    $content_types = spam_invoke_module($module, 'content_types');
    if (is_array($content_types)) {
      foreach ($content_types as $content_type) {
        $name = $content_type['name'];
        if ($form_values['op'] == t('Reset to defaults')) {
          variable_del("spam_filter_{$name}");
        }
        else {
          variable_set("spam_filter_{$name}", $form_values[$name]);
          if ($form_values[$name]) {
            $filter_types[] = $name;
          }
        }
      }
    }
  }
  variable_set('filter_types', implode(',', $filter_types));
  if ($form_values['op'] == t('Reset to defaults')) {
    variable_del('spam_visitor_action');
    variable_del('spam_filtered_message');
    variable_del('spam_threshold');
    variable_del('spam_log_level');
    variable_del('spam_log_delete');
  }
  else {
    variable_set('spam_visitor_action', $form_values['spam_visitor_action']);
    variable_set('spam_filtered_message', $form_values['spam_filtered_message']);
    variable_set('spam_threshold', $form_values['spam_threshold']);
    variable_set('spam_log_level', $form_values['spam_log_level']);
    variable_set('spam_log_delete', $form_values['spam_log_delete']);
  }
}