From afd84ce74d478bec7298674c25eedf0258fd47c3 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Fri, 24 Nov 2017 10:59:44 +0100 Subject: [PATCH] Change system audit log extended info to table format with change info - #1571 --- .../godmode/agentes/configurar_agente.php | 71 +++++++++++-------- .../godmode/users/configure_user.php | 52 +++++++++----- pandora_console/include/functions.php | 5 ++ pandora_console/include/styles/pandora.css | 5 ++ 4 files changed, 86 insertions(+), 47 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 39f3cbba5b..1c4bcf5b02 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -253,23 +253,23 @@ if ($create_agent) { } } - $info = 'Name: ' . $nombre_agente . - ' IP: ' . $direccion_agente . - ' Group: ' . $grupo . - ' Interval: ' . $intervalo . - ' Comments: ' . $comentarios . - ' Mode: ' . $modo . - ' ID_parent: ' . $id_parent . - ' Server: ' . $server_name . - ' ID os: ' . $id_os . - ' Disabled: ' . $disabled . - ' Custom ID: ' . $custom_id . - ' Cascade protection: ' . $cascade_protection . - ' Cascade protection module: ' . $cascade_protection_module . - ' Icon path: ' . $icon_path . - ' Update GIS data: ' . $update_gis_data . - ' Url description: ' . $url_description . - ' Quiet: ' . (int)$quiet; + $info = '{"Name":"' . $nombre_agente .'", + "IP":"' . $direccion_agente .'", + "Group":"' . $grupo .'", + "Interval":"' . $intervalo .'", + "Comments":"' . $comentarios .'", + "Mode":"' . $modo .'", + "ID_parent:":"' . $id_parent .'", + "Server":"' . $server_name .'", + "ID os":"' . $id_os .'", + "Disabled":"' . $disabled .'", + "Custom ID":"' . $custom_id .'", + "Cascade protection":"' . $cascade_protection .'", + "Cascade protection module":"' . $cascade_protection_module .'", + "Icon path":"' . $icon_path .'", + "Update GIS data":"' . $update_gis_data .'", + "Url description":"' . $url_description .'", + "Quiet":"' . (int)$quiet.'"}'; db_pandora_audit("Agent management", "Created agent $alias", false, true, $info); @@ -844,16 +844,25 @@ if ($update_agent) { // if modified some agent paramenter } } - $info = 'Group: ' . $grupo . ' Interval: ' . $intervalo . - ' Comments: ' . $comentarios . ' Mode: ' . $modo . - ' ID OS: ' . $id_os . ' Disabled: ' . $disabled . - ' Server Name: ' . $server_name . ' ID parent: ' . $id_parent . - ' Custom ID: ' . $custom_id . ' Cascade Protection: ' . $cascade_protection . - ' Cascade protection module: ' . $cascade_protection_module . - ' Icon Path: ' . $icon_path . 'Update GIS data: ' .$update_gis_data . - ' Url description: ' . $url_description . - ' Quiet: ' . (int)$quiet; - + $info = '{ + "id_agente":"' . $id_agente . '", + "alias":"' . $alias . '", + "Group":"' . $grupo . '", + "Interval" : "' . $intervalo .'", + "Comments":"' . $comentarios . '", + "Mode":"' . $modo . '", + "ID OS":"' . $id_os . '", + "Disabled":"' . $disabled .'", + "Server Name":"' . $server_name .'", + "ID parent":"' . $id_parent .'", + "Custom ID":"' . $custom_id . '", + "Cascade Protection":"' . $cascade_protection .'", + "Cascade protection module":"' . $cascade_protection_module .'", + "Icon Path":"' . $icon_path . '", + "Update GIS data":"' .$update_gis_data .'", + "Url description":"' . $url_description .'", + "Quiet":"' . (int)$quiet.'"}'; + enterprise_hook ('update_agent', array ($id_agente)); ui_print_success_message (__('Successfully updated')); db_pandora_audit("Agent management", @@ -1217,7 +1226,9 @@ if ($update_module || $create_module) { if ($update_module) { $id_agent_module = (int) get_parameter ('id_agent_module'); - $values = array ('descripcion' => $description, + $values = array ( + 'id_agente_modulo' => $id_agent_module, + 'descripcion' => $description, 'id_module_group' => $id_module_group, 'nombre' => $name, 'max' => $max, @@ -1275,7 +1286,7 @@ if ($update_module) { 'warning_inverse' => $warning_inverse, 'cron_interval' => $cron_interval, 'id_category' => $id_category, - 'disabled_types_event' => $disabled_types_event, + 'disabled_types_event' => addslashes($disabled_types_event), 'module_macros' => $module_macros); // In local modules, the interval is updated by agent @@ -1435,7 +1446,7 @@ if ($create_module) { 'warning_inverse' => $warning_inverse, 'cron_interval' => $cron_interval, 'id_category' => $id_category, - 'disabled_types_event' => $disabled_types_event, + 'disabled_types_event' => addslashes($disabled_types_event), 'module_macros' => $module_macros); if ($prediction_module == 3 && $serialize_ops == '') { diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index ef2e4f0f9c..582e4887cf 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -220,15 +220,14 @@ if ($create_user) { $new_user = true; } else { - $info = 'FullName: ' . $values['fullname'] . ' Firstname: ' . $values['firstname'] . - ' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] . - ' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] . - ' Is_admin: ' . $values['is_admin'] . - ' Language: ' . $values['language'] . - ' Block size: ' . $values['block_size'] . ' Interactive Charts: ' . $values['flash_chart']; - + $info = + '{"FullName":"' . $values['fullname'] . '","Firstname":"'. $values['firstname'] .'","Lastname":"'. $values['lastname'] . '","Email":"' . $values['email'] . '","Phone":"' . $values['phone'] . '","Comments":"' . $values['comments'] .'","Is_admin":"' . $values['is_admin'] .'","Language":"' . $values['language'] . '","Block size":"' . $values['block_size'] . '","Interactive Charts":"' . $values['flash_chart'].'"'; + if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { - $info .= ' Skin: ' . $values['id_skin']; + $info .= ',"Skin":"' . $values['id_skin'].'"}'; + } + else{ + $info .= '}'; } switch ($config['dbtype']) { @@ -356,21 +355,40 @@ if ($update_user) { } } else { - $info = 'FullName: ' . $values['fullname'] . ' Firstname: ' . $values['firstname'] . - ' Lastname: ' . $values['lastname'] . ' Email: ' . $values['email'] . - ' Phone: ' . $values['phone'] . ' Comments: ' . $values['comments'] . - ' Is_admin: ' . $values['is_admin'] . - ' Language: ' . $values['language'] . - ' Block size: ' . $values['block_size'] . ' Flash Chats: ' . $values['flash_chart'] . - ' Section: ' . $values['section']; + + $has_skin = false; + $has_wizard = false; + + $info = '{"id_user":"'.$values['id_user'].'", + "FullName":"' . $values['fullname'] .'", + "Firstname":"' . $values['firstname'] .'", + "Lastname":"' . $values['lastname'] . '", + "Email":"' . $values['email'] . '", + "Phone":"' . $values['phone'] . '", + "Comments":"' . $values['comments'] . '", + "Is_admin":"' . $values['is_admin'] . '", + "Language":"' . $values['language'] . '", + "Block size":"' . $values['block_size'] . '", + "Flash Chats":"' . $values['flash_chart'] . '", + "Section":"' . $values['section'].'"'; if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { - $info .= ' Skin: ' . $values['id_skin']; + $info .= ',"Skin":"' . $values['id_skin'].'"'; + $has_skin = true; } if(enterprise_installed() && defined('METACONSOLE')) { - $info .= ' Wizard access: ' . $values['metaconsole_access']; + $info .= ',"Wizard access":"' . $values['metaconsole_access'].'"}'; + $has_wizard = true; } + elseif($has_skin){ + $info .= '}'; + } + + if(!$has_skin && !$has_wizard){ + $info .= '}'; + } + db_pandora_audit("User management", "Updated user ".io_safe_input($id), false, false, $info); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 4edfe2c512..6ef0e3ce76 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2788,4 +2788,9 @@ function register_pass_change_try ($id_user, $success) { db_process_sql_insert('treset_pass_history', $values); } +function isJson($string) { + json_decode($string); + return (json_last_error() == JSON_ERROR_NONE); +} + ?> diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index beb53d61d7..9c5956bfa1 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4368,3 +4368,8 @@ div#footer_help{ fill: none; transition: all 2s ease-in-out; } + +.limit_scroll{ + max-width: 800px; + overflow-x:scroll; +} \ No newline at end of file