From cc2c6eab38213fd2d88d14564b1f29ad6f1cbd2b Mon Sep 17 00:00:00 2001 From: jsatoh Date: Sat, 19 Apr 2014 01:35:53 +0000 Subject: [PATCH] 2014-04-19 Junichi Satoh * godmode/agentes/agent_manager.php, godmode/agentes/agent_wizard.snmp_explorer.php, godmode/agentes/configurar_agente.php, godmode/agentes/module_manager_editor.php, godmode/agentes/module_manager_editor_common.php: Replaced json_encode() with io_json_mb_encode() to avoid invalid encoding with multi-byte characters. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9783 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 ++++++++++ pandora_console/godmode/agentes/agent_manager.php | 4 ++-- .../godmode/agentes/agent_wizard.snmp_explorer.php | 6 +++--- .../godmode/agentes/configurar_agente.php | 8 ++++---- .../godmode/agentes/module_manager_editor.php | 12 ++++++------ .../godmode/agentes/module_manager_editor_common.php | 4 ++-- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index fed2c55d9e..12c20c1b9b 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2014-04-19 Junichi Satoh + + * godmode/agentes/agent_manager.php, + godmode/agentes/agent_wizard.snmp_explorer.php, + godmode/agentes/configurar_agente.php, + godmode/agentes/module_manager_editor.php, + godmode/agentes/module_manager_editor_common.php: Replaced + json_encode() with io_json_mb_encode() to avoid invalid encoding + with multi-byte characters. + 2014-04-16 Miguel de Dios * include/javascript/d3.v3.4.5.js: added the last javascript diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index a62170000c..e3de6417bf 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -49,7 +49,7 @@ if (is_ajax ()) { 'ip' => io_safe_output($agent['direccion'])); } - echo json_encode($data); + echo io_json_mb_encode($data); return; } @@ -86,7 +86,7 @@ if (is_ajax ()) { $oid_snmp = array(); } - echo json_encode($out); + echo io_json_mb_encode($out); } return; diff --git a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php index b77d0aa214..89bbc6cda3 100644 --- a/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php +++ b/pandora_console/godmode/agentes/agent_wizard.snmp_explorer.php @@ -442,7 +442,7 @@ if ($create_modules) { } } - $module_values['macros'] = json_encode($macros); + $module_values['macros'] = io_json_mb_encode($macros); unset($module_values['snmp_community']); //snmp_community unset($module_values['ip_target']); //ip_target @@ -488,7 +488,7 @@ if ($create_modules) { } } - $module_values['macros'] = json_encode($macros); + $module_values['macros'] = io_json_mb_encode($macros); unset($module_values['snmp_community']); //snmp_community unset($module_values['ip_target']); //ip_target @@ -528,7 +528,7 @@ if ($create_modules) { } } - $module_values['macros'] = json_encode($macros); + $module_values['macros'] = io_json_mb_encode($macros); unset($module_values['snmp_community']); //snmp_community unset($module_values['ip_target']); //ip_target diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 388ffb028f..bb7beda17e 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -843,7 +843,7 @@ if ($update_module || $create_module) { $macros[$k]['value'] = get_parameter($m['macro'], ''); } - $macros = json_encode($macros); + $macros = io_json_mb_encode($macros); $conf_array = explode("\n",$configuration_data); foreach($conf_array as $line) { @@ -944,7 +944,7 @@ if ($update_module || $create_module) { $throw_unknown_events = (bool)get_parameter('throw_unknown_events', false); //Set the event type that can show. $disabled_types_event = array(EVENTS_GOING_UNKNOWN => (int)!$throw_unknown_events); - $disabled_types_event = json_encode($disabled_types_event); + $disabled_types_event = io_json_mb_encode($disabled_types_event); $module_macro_names = (array) get_parameter('module_macro_names', array()); $module_macro_values = (array) get_parameter('module_macro_values', array()); @@ -1066,7 +1066,7 @@ if ($update_module) { $agent = db_get_row ('tagente', 'id_agente', $id_agente); db_pandora_audit("Agent management", - "Updated module '$name' for agent ".$agent["nombre"], false, false, json_encode($values)); + "Updated module '$name' for agent ".$agent["nombre"], false, false, io_json_mb_encode($values)); } } @@ -1189,7 +1189,7 @@ if ($create_module) { $agent = db_get_row ('tagente', 'id_agente', $id_agente); db_pandora_audit("Agent management", - "Added module '$name' for agent ".$agent["nombre"], false, true, json_encode($values)); + "Added module '$name' for agent ".$agent["nombre"], false, true, io_json_mb_encode($values)); } } diff --git a/pandora_console/godmode/agentes/module_manager_editor.php b/pandora_console/godmode/agentes/module_manager_editor.php index 32ab54d044..cc7abb9438 100644 --- a/pandora_console/godmode/agentes/module_manager_editor.php +++ b/pandora_console/godmode/agentes/module_manager_editor.php @@ -33,7 +33,7 @@ if (is_ajax ()) { !network_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN); - echo json_encode ($component); + echo io_json_mb_encode ($component); return; } @@ -47,7 +47,7 @@ if (is_ajax ()) { 'order' => 'name ASC'), array ('id_nc', 'name')); - echo json_encode ($components); + echo io_json_mb_encode ($components); return; } @@ -60,7 +60,7 @@ if (is_ajax ()) { array('id_network_component_group' => $id_module_group), array('id', 'name')); - echo json_encode($localComponents); + echo io_json_mb_encode($localComponents); return; } @@ -93,7 +93,7 @@ if (is_ajax ()) { $component['throw_unknown_events'] = !local_components_is_disable_type_event($id_component, EVENTS_GOING_UNKNOWN); - echo json_encode ($component); + echo io_json_mb_encode ($component); return; } @@ -123,7 +123,7 @@ if (is_ajax ()) { 1, "", $snmp_port); if ($snmpwalk === false) { - echo json_encode ($snmpwalk); + echo io_json_mb_encode ($snmpwalk); return; } @@ -133,7 +133,7 @@ if (is_ajax ()) { $result[$id] = substr ($value, 0, 55); } asort ($result); - echo json_encode ($result); + echo io_json_mb_encode ($result); return; } diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index 91d1a72eb5..54f46048bb 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -182,7 +182,7 @@ if (!$edit) { } $table_simple->data[1][1] = ''.modules_get_moduletype_description ($id_module_type).' ('.$type_names_hash[$id_module_type].')'; - $table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(json_encode($type_names_hash)),true); + $table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true); } else { if (isset($id_module_type)) { @@ -215,7 +215,7 @@ else { $type_names_hash[$tn['id_tipo']] = $tn['nombre']; } - $table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(json_encode($type_names_hash)),true); + $table_simple->data[1][1] .= html_print_input_hidden('type_names',base64_encode(io_json_mb_encode($type_names_hash)),true); } $table_simple->data[1][2] = __('Module group');