You are here

function botcha_admin_settings_submit in BOTCHA Spam Prevention 7.2

Same name and namespace in other branches
  1. 6 botcha.pages.inc \botcha_admin_settings_submit()
  2. 6.2 botcha.admin.inc \botcha_admin_settings_submit()
  3. 7 botcha.pages.inc \botcha_admin_settings_submit()

Submission function for botcha_admin_settings form.

File

./botcha.admin.inc, line 105
Implementation of botcha administration forms.

Code

function botcha_admin_settings_submit($form, &$form_state) {

  // Generate the secret key.
  // @todo botcha_admin_settings_submit Move secret key generation to validate phase.
  if (empty($form_state['values']['botcha_secret'])) {

    // Generate unique secret for this site
    $secret = botcha_generate_secret_key();
    $form_state['values']['botcha_secret'] = $secret;
    drupal_set_message(t('New BOTCHA secret key have been generated.'));
  }

  // Do what system_settings_form() would do with regular variable fields
  variable_set('botcha_secret', $form_state['values']['botcha_secret']);
  variable_set('botcha_loglevel', $form_state['values']['botcha_loglevel']);
  drupal_set_message(t('The BOTCHA settings were saved.'), 'status');
}