You are here

public function BotchaRecipeNoResubmit::handle in BOTCHA Spam Prevention 7.3

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

Handle form depending on the result of spam check.

_state

Parameters

string $result:

array $form:

Overrides BotchaRecipe::handle

File

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

Class

BotchaRecipeNoResubmit

Code

public function handle($mode, $form, $form_state) {
  parent::handle($mode, $form, $form_state);

  // @todo Reduce code duplication (determining which build_id to use).
  // @see BotchaRecipe.applyRecipe()
  // @see?
  $build_id = isset($_POST['form_build_id']) ? $_POST['form_build_id'] : $form['#build_id'];

  // Invalidate cache so resubmit will not work.
  // Make it to expire immediately.
  $expire = 0;
  $data = array();

  // @todo Abstract it.

  //cache_set('botcha_' . $build_id, $data, 'cache_form', $_SERVER['REQUEST_TIME'] + $expire);
  cache_set('botcha_' . $build_id, $data, 'cache_form', REQUEST_TIME + $expire);
}