function _botcha_filter_form_log in BOTCHA Spam Prevention 6
Same name and namespace in other branches
- 6.2 botcha.inc \_botcha_filter_form_log()
- 6.3 botcha.module \_botcha_filter_form_log()
- 7 botcha.botcha.inc \_botcha_filter_form_log()
- 7.2 botcha.inc \_botcha_filter_form_log()
- 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 516 - Implementation of botcha form logic.
Code
function _botcha_filter_form_log($form, $level = 0) {
if (is_array($form) && !is_string($form)) {
foreach ($form as $key => $value) {
if ($key == '#post') {
$form[$key] = $level == 0 ? _botcha_filter_form_values_log($value) : t('...[redundand entry - removed]');
}
elseif ($key == '#parameters') {
foreach ($value as $n => $arg) {
$value[$n] = _botcha_filter_form_log($arg, -1);
}
$form[$key] = $value;
}
elseif (!element_property($key)) {
// Handle recursion for $key == '#parameters'
if ($level == -1) {
$form[$key] = $key == 'pass' ? '********' : _botcha_filter_form_log($value, -1);
}
else {
$form[$key] = _botcha_filter_form_log($value, $level + 1);
if ($key == 'pass' && isset($form[$key]['#value'])) {
$form[$key]['#value'] = '********';
}
}
}
}
}
return $form;
}