mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 15:54:29 +02:00
change storage format of custom data field in DB
This commit is contained in:
parent
de75277c8a
commit
e1ec4ce40e
@ -2429,6 +2429,9 @@ function events_create_event(
|
|||||||
$source = get_product_name();
|
$source = get_product_name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$custom_data = base64_decode($custom_data);
|
||||||
|
$custom_data = mysql_escape_string_sql($custom_data);
|
||||||
|
|
||||||
$table_events = 'tevento';
|
$table_events = 'tevento';
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
$table_events = 'tmetaconsole_event';
|
$table_events = 'tmetaconsole_event';
|
||||||
|
@ -183,6 +183,29 @@ try {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'custom_data':
|
||||||
|
$custom_data_array = json_decode(
|
||||||
|
$row[$key],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
|
$custom_data = '';
|
||||||
|
$separator = ($config['csv_divider'] === ';') ? ',' : ';';
|
||||||
|
|
||||||
|
if ($custom_data_array !== null) {
|
||||||
|
array_walk(
|
||||||
|
$custom_data_array,
|
||||||
|
function (&$value, $field) {
|
||||||
|
$value = $field.'='.$value;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
$custom_data = implode($separator, $custom_data_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
echo io_safe_output($custom_data);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
echo io_safe_output($row[$key]);
|
echo io_safe_output($row[$key]);
|
||||||
break;
|
break;
|
||||||
|
@ -4301,9 +4301,6 @@ sub cli_create_event() {
|
|||||||
|
|
||||||
print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n";
|
print_log "[INFO] Adding event '$event' for agent '$agent_name' \n\n";
|
||||||
|
|
||||||
# Base64 encode custom data
|
|
||||||
$custom_data = encode_base64 ($custom_data, '');
|
|
||||||
|
|
||||||
pandora_event ($conf, $event, $id_group, $id_agent, $severity,
|
pandora_event ($conf, $event, $id_group, $id_agent, $severity,
|
||||||
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, safe_input($comment), $id_extra, $tags, $c_instructions, $w_instructions, $u_instructions, $custom_data);
|
$id_alert_agent_module, $id_agentmodule, $event_type, $event_status, $dbh, $source, $user_name, safe_input($comment), $id_extra, $tags, $c_instructions, $w_instructions, $u_instructions, $custom_data);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user