You are here

function spam_feedback_insert in Spam 6

Store reported legitimate content in database.

2 calls to spam_feedback_insert()
contact_spamapi in content/spam_content_contact.inc
Spam module _spamapi() hook.
spam_error_page_submit in ./spam.module
Form submit callback for feedback form.

File

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

Code

function spam_feedback_insert($feedback) {
  global $user, $language;
  $content = unserialize($_SESSION['spam_content']);
  $type = $_SESSION['spam_type'];
  $id = spam_invoke_module($type, 'content_id', $content);
  $hash = md5($_SESSION['spam_content']);
  if (is_array($_SESSION['spam_form'])) {
    $spam_form = serialize($_SESSION['spam_form']);
  }
  else {
    $spam_form = $_SESSION['spam_form'];
  }

  // We do not want to have spammers spam the error form and discard identical entries.
  if (!db_result(db_query("SELECT COUNT(*) FROM {spam_filters_errors} WHERE content_hash = '%s'", $hash))) {
    db_query("INSERT INTO {spam_filters_errors} (uid, language, content_type, content_id, content_hash, content, form, hostname, feedback, timestamp) VALUES(%d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", $user->uid, $language->language, $type, $id, $hash, $_SESSION['spam_content'], $spam_form, ip_address(), $feedback, time());
  }
  $_SESSION['spam_content'] = $_SESSION['spam_type'] = $_SESSION['spam_form'] = '';
}