You are here

public function BotchaRecipeTimegate::isSpam in BOTCHA Spam Prevention 7.3

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

Spam check.

_state

Parameters

array $form:

Overrides BotchaRecipe::isSpam

File

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

Class

BotchaRecipeTimegate

Code

public function isSpam($form, $form_state) {
  $isSpam = parent::isSpam($form, $form_state);

  // Timegate method validation.
  $absence = empty($form['timegate']);
  $minimal_delay = variable_get('botcha_timegate', 5);
  $form_generated = !empty($form_state['botcha_submit_values']['timegate']) ? $form_state['botcha_submit_values']['timegate'] : NULL;
  $form_submitted = !empty($form_state['values']['timegate']) ? $form_state['values']['timegate'] : NULL;
  if ($absence || (int) $form_submitted < (int) $form_generated + (int) $minimal_delay) {
    $isSpam = TRUE;
  }
  return $isSpam;
}