function BotchaRecipeTimegate::isSpam in BOTCHA Spam Prevention 6.2
Same name and namespace in other branches
- 6.3 controller/recipe/botcha.recipe.controller.inc \BotchaRecipeTimegate::isSpam()
- 7.2 controller/botcha_recipe.controller.inc \BotchaRecipeTimegate::isSpam()
- 7.3 controller/recipe/botcha.recipe.controller.inc \BotchaRecipeTimegate::isSpam()
Spam check.
_state
Parameters
type $form:
Overrides BotchaRecipe::isSpam
File
- controller/
botcha_recipe.controller.inc, line 904 - Controller layer of the BotchaRecipe objects.
Class
Code
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;
}