You are here

function spam_admin_feedback_form_submit in Spam 6

Same name and namespace in other branches
  1. 5.3 spam.module \spam_admin_feedback_form_submit()

Process spam feedback.

File

./spam.module, line 1102
Spam module, v3 Copyright(c) 2006-2008 Jeremy Andrews <jeremy@tag1consulting.com>. All rights reserved.

Code

function spam_admin_feedback_form_submit($form, &$form_state) {
  $content = unserialize($form_state['values']['content']);

  // mark the content as not spam
  $extra['content'] = $content;
  $extra['type'] = $form_state['values']['type'];
  $extra['feedback_form'] = TRUE;

  // This will publish any content that is unpublished.
  spam_mark_as_not_spam($form_state['values']['type'], $form_state['values']['id'], $extra);
  $values = $form_state['values'];

  // process the form if applicable, we optionally let the content type module take care of this.
  if (!spam_invoke_module($form_state['values']['type'], 'feedback_approved', $form_state['values']['id'], $extra)) {
    if (variable_get('spam_visitor_action', SPAM_ACTION_PREVENT)) {
      $form = unserialize($form_state['values']['spam_form']);
      $_SESSION['spam_bypass_spam_filter'] = TRUE;
      $form_state = array();

      // We only have a form if we use this setting
      // return will contain a url to the new content
      $return = drupal_process_form($content['form_id'], $form, $form_state);
    }
  }
  db_query('DELETE FROM {spam_filters_errors} WHERE bid = %d', $values['bid']);
  drupal_set_message(t('Content published.'));
  drupal_goto('admin/content/spam/feedback');
}