You are here

public function BotchaRecipeNoResubmit::isSpam in BOTCHA Spam Prevention 7.3

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

Spam check.

_state

Parameters

array $form:

Overrides BotchaRecipe::isSpam

File

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

Class

BotchaRecipeNoResubmit

Code

public function isSpam($form, $form_state) {

  // @todo Reduce code duplication (determining which build_id to use).
  // @see BotchaRecipe.applyRecipe()
  // @see?
  $isSpam = parent::isSpam($form, $form_state);
  $build_id = isset($_POST['form_build_id']) ? $_POST['form_build_id'] : $form['#build_id'];
  if ($cached = cache_get("botcha_{$build_id}", 'cache_form')) {
    $data = $cached->data;
    if (!isset($data['#cache_token']) || $data['#cache_token'] != $this
      ->getToken()) {
      $isSpam = TRUE;
    }
  }
  return $isSpam;
}