You are here

protected function BotchaRecipeNoResubmit::getToken in BOTCHA Spam Prevention 7.3

Same name and namespace in other branches
  1. 6.2 controller/botcha_recipe.controller.inc \BotchaRecipeNoResubmit::getToken()
  2. 6.3 controller/recipe/botcha.recipe.controller.inc \BotchaRecipeNoResubmit::getToken()
  3. 7.2 controller/botcha_recipe.controller.inc \BotchaRecipeNoResubmit::getToken()
2 calls to BotchaRecipeNoResubmit::getToken()
BotchaRecipeNoResubmit::apply in controller/recipe/botcha.recipe.controller.inc
BotchaRecipeNoResubmit::isSpam in controller/recipe/botcha.recipe.controller.inc
Spam check.

File

controller/recipe/botcha.recipe.controller.inc, line 415
Controller layer of the BotchaRecipe objects.

Class

BotchaRecipeNoResubmit

Code

protected function getToken($value = '') {

  // A bit customized version of drupal_get_token().
  // @see drupal_get_token()
  if (empty($_SESSION['botcha_session'])) {
    $_SESSION['botcha_session'] = session_id();
  }

  // @todo Replace with function, depending on BOTCHA_SECRET.
  // @see?
  // @todo Abstract it.

  //return md5($_SESSION['botcha_session'] . $value . BOTCHA_SECRET);
  return drupal_hmac_base64($value, $_SESSION['botcha_session'] . drupal_get_private_key() . drupal_get_hash_salt());
}