You are here

function spam_spam_node in Spam 5

Force a node to be marked as spam. May unpublish depending on settings

File

./spam.module, line 3116

Code

function spam_spam_node($nid) {
  if ($node = node_load(array(
    'nid' => $nid,
  ))) {
    $tokens = spam_tokenize($node->title, 'header*');
    $tokens = array_merge($tokens, spam_tokenize($node->body));
    spam_tokens_save($tokens, 1);
    spam_tokens_unsave($tokens, 1);
    db_query("UPDATE {spam_tracker} SET probability = %d, timestamp = %d WHERE source = 'node' AND id = %d", 99, time(), $nid);
    if (!db_affected_rows()) {
      db_query("INSERT INTO {spam_tracker} (id, source, probability, hostname, hash, timestamp) VALUES(%d, '%s', %d, '%s', '%s', %d)", $nid, 'node', 99, $_SERVER['REMOTE_ADDR'], md5($node->title . $node->body), time());
    }
    spam_default_actions('node', $nid, $node->title, $node->body, 99, NULL, FALSE, 1);
    spam_log(SPAM_LOG, t('spam_page: node manually marked as spam'), 'node', $node->nid);
  }
}