You are here

function _botcha_filter_form_log in BOTCHA Spam Prevention 7

Same name and namespace in other branches
  1. 6 botcha.botcha.inc \_botcha_filter_form_log()
  2. 6.2 botcha.inc \_botcha_filter_form_log()
  3. 6.3 botcha.module \_botcha_filter_form_log()
  4. 7.2 botcha.inc \_botcha_filter_form_log()
  5. 7.3 botcha.module \_botcha_filter_form_log()

Filter out sensitive form data for logging Recursive.

2 calls to _botcha_filter_form_log()
botcha_form_alter_botcha in ./botcha.botcha.inc
Main BOTCHA worker - process the form and apply BOTCHA protection
__botcha_form_validate in ./botcha.botcha.inc
Custom form validation.

File

./botcha.botcha.inc, line 540
Implementation of botcha form logic.

Code

function _botcha_filter_form_log($form, $level = 0) {
  $filtered_form = $form;
  if (is_array($form) && !is_string($form)) {
    foreach ($form as $key => $value) {
      switch ($key) {
        case '#post':
          $filtered_form[$key] = $level == 0 ? _botcha_filter_form_log($value, -1) : t('...[redundant entry - removed]');
          break;
        default:

          // Filter out sensitive data.
          $filtered_form[$key] = $key === 'pass' ? _botcha_filter_value($value) : _botcha_filter_form_log($value, -1);
          break;
      }
    }
  }
  return $filtered_form;
}