You are here

function BotchaRecipeNoResubmit::isSpam in BOTCHA Spam Prevention 7.2

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.3 controller/recipe/botcha.recipe.controller.inc \BotchaRecipeNoResubmit::isSpam()

Spam check.

_state

Parameters

type $form:

Overrides BotchaRecipe::isSpam

File

controller/botcha_recipe.controller.inc, line 360
Controller layer of the BotchaRecipe objects.

Class

BotchaRecipeNoResubmit

Code

function isSpam($form, $form_state) {

  // !!~ @todo Reduce code duplication.
  // @see BotchaRecipe.applyRecipe()
  $isSpam = TRUE;
  $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 = FALSE;
    }
  }
  return $isSpam;
}