public function BotchaRecipeNoResubmit::isSpam in BOTCHA Spam Prevention 6.3
Same name and namespace in other branches
- 6.2 controller/botcha_recipe.controller.inc \BotchaRecipeNoResubmit::isSpam()
 - 7.2 controller/botcha_recipe.controller.inc \BotchaRecipeNoResubmit::isSpam()
 - 7.3 controller/recipe/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
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;
}