You are here

function botcha_fprocess in BOTCHA Spam Prevention 7

Same name and namespace in other branches
  1. 6.4 botcha.module \botcha_fprocess()
  2. 6 botcha.module \botcha_fprocess()
  3. 6.2 botcha.inc \botcha_fprocess()
  4. 6.3 botcha.module \botcha_fprocess()

Process form callback for BOTCHA form. Using hooking mechanism that is a hack - we want to come in before #process, but our _form_alter() is way too early (we want to let it use cache for all other modules & data). Ideal would be to have #process callback work on the form, but FAPI does not call it on forms, despite the documentation stating that it does. In fact, D6 code needs '#input'=TRUE on the element to get into calling #process callbacks. So we set '#input'=>TRUE on the form when inserting our callback into form['#process'], and it forces the FAPI to call that code path and we get our intercept. Works like a charm!

1 string reference to 'botcha_fprocess'
botcha_form_alter in ./botcha.module
Implements hook_form_alter().

File

./botcha.module, line 248
BOTCHA - Spam Prevention It modifies forms by adding various botcha's.

Code

function botcha_fprocess($element, &$form_state) {

  // UNUSED
  //  // Prevent caching of the page with BOTCHA elements.
  //  // This needs to be done even if the BOTCHA will be ommitted later:
  //  // other untrusted users should not get a cached page.
  //  global $conf;
  //  $conf['cache'] = 0;
  //  // This temporarily disables cache (for this page request)
  //  // Pressflow in CACHE_EXTERNAL caching mode additionally requires to mark
  //  // this request as non-cacheable to bypass external caches (e.g., Varnish).
  //  if (function_exists('drupal_page_is_cacheable')) {
  //    drupal_set_header('Cache-Control', 'no-cache, must-revalidate, post-check=0, pre-check=0', FALSE);
  //  }
  return $element;
}