function process_row(&$schema, &$sql_data, &$insert_values)
{
global $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache;
global $convert, $convert_row;
$sql_flag = false;
foreach ($schema as $key => $fields) {
// We are only interested in the lines with:
// array('comment', 'attachments_desc.comment', 'htmlspecialchars'),
if (is_int($key)) {
if (!is_array($fields[1])) {
$fields[1] = array($fields[1]);
}
$firstkey_set = false;
$firstkey = 0;
foreach ($fields[1] as $inner_key => $inner_value) {
if (!$firstkey_set) {
$firstkey = $inner_key;
$firstkey_set = true;
}
$src_field = isset($sql_data['source_fields'][$key][$inner_key]) ? $sql_data['source_fields'][$key][$inner_key] : '';
if (!empty($src_field)) {
$fields[1][$inner_key] = $convert->row[$src_field];
}
}
if (!empty($fields[0])) {
// We have a target field, if we haven't set $sql_flag yet it will be set to TRUE.
// If a function has already set it to FALSE it won't change it.
if ($sql_flag === false) {
$sql_flag = true;
}
// No function assigned?
if (empty($fields[2])) {
$value = $fields[1][$firstkey];
} else {
if (is_array($fields[2]) && !is_callable($fields[2])) {
// Execute complex function/eval/typecast
$value = $fields[1];
foreach ($fields[2] as $type => $execution) {
if (strpos($type, 'typecast') === 0) {
if (!is_array($value)) {
$value = array($value);
}
$value = $value[0];
settype($value, $execution);
} else {
if (strpos($type, 'function') === 0) {
if (!is_array($value)) {
$value = array($value);
}
$value = call_user_func_array($execution, $value);
} else {
if (strpos($type, 'execute') === 0) {
if (!is_array($value)) {
$value = array($value);
}
$execution = str_replace('{RESULT}', '$value', $execution);
$execution = str_replace('{VALUE}', '$value', $execution);
// @codingStandardsIgnoreStart
eval($execution);
// @codingStandardsIgnoreEnd
}
}
}
}
} else {
$value = call_user_func_array($fields[2], $fields[1]);
}
}
if (is_null($value)) {
$value = '';
}
$insert_values[] = $db->_sql_validate_value($value);
} else {
if (!empty($fields[2])) {
if (is_array($fields[2])) {
// Execute complex function/eval/typecast
$value = '';
foreach ($fields[2] as $type => $execution) {
if (strpos($type, 'typecast') === 0) {
$value = settype($value, $execution);
} else {
if (strpos($type, 'function') === 0) {
if (!is_array($value)) {
$value = array($value);
}
$value = call_user_func_array($execution, $value);
} else {
if (strpos($type, 'execute') === 0) {
if (!is_array($value)) {
$value = array($value);
}
$execution = str_replace('{RESULT}', '$value', $execution);
$execution = str_replace('{VALUE}', '$value', $execution);
// @codingStandardsIgnoreStart
eval($execution);
// @codingStandardsIgnoreEnd
}
}
}
}
} else {
call_user_func_array($fields[2], $fields[1]);
}
}
}
}
}
return $sql_flag;
}