You are here

function _spam_sign in Spam 6

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

Helper function, returns a randomized token used to build a unique path for reporting mis-filtered content. Intended as a spam deterrent.

2 calls to _spam_sign()
spam_hash_load in ./spam.module
Wildcard loader function.
_spam_error_link in ./spam.module
Helper function, generate a link for reporting mis-filtered content.

File

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

Code

function _spam_sign($text) {
  if (!variable_get('spam_sign_start', '')) {
    variable_set('spam_sign_start', rand(0, 22));
    variable_set('spam_sign_end', rand(45, 115));
  }
  if (!variable_get('spam_sign_key', '')) {
    variable_set('spam_sign_key', md5(microtime()));
  }

  // TODO: Be sure signing is changing...
  return md5(drupal_substr($text, variable_get('spam_sign_start', 0), variable_get('spam_sign_end', 11)) . variable_get('spam_sign_key', ''));
}