From 5d59e1da3f026ca45669b0f1bb6bd4e0a333b7de Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" <alejandro.campos@artica.es> Date: Tue, 18 Jan 2022 15:03:44 +0100 Subject: [PATCH] fixed bulk copy of modules with percent character --- pandora_console/include/functions_agents.php | 17 +++++++++++------ pandora_console/include/functions_modules.php | 12 ++++++++++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 6dbac49957..5c81b5b0fd 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -910,7 +910,11 @@ function agents_process_manage_config($source_id_agent, $destiny_id_agents, $cop [ 'nombre' => $module['nombre'], 'disabled' => false, - ] + ], + true, + true, + false, + false ); // Keep all modules repeated @@ -1443,7 +1447,8 @@ function agents_get_modules( $filter=false, $indexed=true, $get_not_init_modules=true, - $force_tags=false + $force_tags=false, + $filter_include_sql=true ) { global $config; @@ -1542,18 +1547,18 @@ function agents_get_modules( } } - if ($value[0] == '%') { + if ($value[0] == '%' && $filter_include_sql === true) { array_push( $fields, $field.' LIKE "'.$value.'"' ); - } else if ($operatorDistin) { + } else if ($operatorDistin && $filter_include_sql === true) { array_push($fields, $field.' <> '.substr($value, 2)); - } else if (substr($value, -1) == '%') { + } else if (substr($value, -1) == '%' && $filter_include_sql === true) { array_push($fields, $field.' LIKE "'.$value.'"'); } else if (strncmp($value, '666=666', 7) == 0) { array_push($fields, ' '.$value); - } else if (preg_match('/\bin\b/i', $field)) { + } else if (preg_match('/\bin\b/i', $field) && $filter_include_sql === true) { array_push($fields, $field.' '.$value); } else { array_push($fields, 'tagente_modulo.'.$field.' = "'.$value.'"'); diff --git a/pandora_console/include/functions_modules.php b/pandora_console/include/functions_modules.php index 4f27b17896..584270d17f 100755 --- a/pandora_console/include/functions_modules.php +++ b/pandora_console/include/functions_modules.php @@ -189,7 +189,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent, [ 'nombre' => $module['nombre'], 'disabled' => false, - ] + ], + true, + true, + false, + false ); // The module already exist in the target @@ -203,7 +207,11 @@ function modules_copy_agent_module_to_agent($id_agent_module, $id_destiny_agent, [ 'nombre' => $module['nombre'], 'disabled' => true, - ] + ], + true, + true, + false, + false ); // If the module exist but disabled, we enable it