diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 738d82859a..068d25ba61 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.771-230526 +Version: 7.0NG.771-230530 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 0f2a8b9a64..0ca3e7bc19 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.771-230526" +pandora_version="7.0NG.771-230530" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 41faa4189c..61818d4d77 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1023,7 +1023,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.771'; -use constant AGENT_BUILD => '230526'; +use constant AGENT_BUILD => '230530'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index e65a057a1f..61b7de98c3 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.771 -%define release 230526 +%define release 230530 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 9384ca50d8..69cdf3c0e9 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -4,7 +4,7 @@ %global __os_install_post %{nil} %define name pandorafms_agent_linux %define version 7.0NG.771 -%define release 230526 +%define release 230530 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 40246f249e..563121f5e2 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.771" -PI_BUILD="230526" +PI_BUILD="230530" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 85cf1478e9..7709331714 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{230526} +{230530} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 76e4a97a68..394ea74ed3 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.771 Build 230526") +#define PANDORA_VERSION ("7.0NG.771 Build 230530") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 4a9570c10f..ea51a460fc 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.771(Build 230526))" + VALUE "ProductVersion", "(7.0NG.771(Build 230530))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index fdb6f97015..a8053b5563 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.771-230526 +Version: 7.0NG.771-230530 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 1a4058f752..45449be129 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.771-230526" +pandora_version="7.0NG.771-230530" package_pear=0 package_pandora=1 diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index f01c035e80..6216bd5e31 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -295,25 +295,25 @@ if (enterprise_installed() === true) { $cps_val = $cps; } } +} - // Parent agents. - $paramsParentAgent = []; - $paramsParentAgent['return'] = true; - $paramsParentAgent['show_helptip'] = false; - $paramsParentAgent['input_name'] = 'id_parent'; - $paramsParentAgent['print_hidden_input_idagent'] = true; - $paramsParentAgent['hidden_input_idagent_name'] = 'id_agent_parent'; - $paramsParentAgent['hidden_input_idagent_value'] = $id_parent; - $paramsParentAgent['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent); - $paramsParentAgent['selectbox_id'] = 'cascade_protection_module'; - $paramsParentAgent['javascript_is_function_select'] = true; - $paramsParentAgent['cascade_protection'] = true; - $paramsParentAgent['input_style'] = 'width: 100%;'; +// Parent agents. +$paramsParentAgent = []; +$paramsParentAgent['return'] = true; +$paramsParentAgent['show_helptip'] = false; +$paramsParentAgent['input_name'] = 'id_parent'; +$paramsParentAgent['print_hidden_input_idagent'] = true; +$paramsParentAgent['hidden_input_idagent_name'] = 'id_agent_parent'; +$paramsParentAgent['hidden_input_idagent_value'] = $id_parent; +$paramsParentAgent['value'] = db_get_value('alias', 'tagente', 'id_agente', $id_parent); +$paramsParentAgent['selectbox_id'] = 'cascade_protection_module'; +$paramsParentAgent['javascript_is_function_select'] = true; +$paramsParentAgent['cascade_protection'] = true; +$paramsParentAgent['input_style'] = 'width: 100%;'; - if ($id_agente !== 0) { - // Deletes the agent's offspring. - $paramsParentAgent['delete_offspring_agents'] = $id_agente; - } +if ($id_agente !== 0) { + // Deletes the agent's offspring. + $paramsParentAgent['delete_offspring_agents'] = $id_agente; } $listIcons = gis_get_array_list_icons(); @@ -631,15 +631,18 @@ $tableAdvancedAgent->style = []; $tableAdvancedAgent->cellclass = []; $tableAdvancedAgent->colspan = []; $tableAdvancedAgent->rowspan = []; -// Secondary groups. -$tableAdvancedAgent->data['secondary_groups'][] = html_print_label_input_block( - __('Secondary groups'), - html_print_select_agent_secondary( - $agent, - $id_agente, - ['selected_post' => $secondary_groups] - ) -); + +if (enterprise_installed() === true) { + // Secondary groups. + $tableAdvancedAgent->data['secondary_groups'][] = html_print_label_input_block( + __('Secondary groups'), + html_print_select_agent_secondary( + $agent, + $id_agente, + ['selected_post' => $secondary_groups] + ) + ); +} // Parent agent. $tableAdvancedAgent->data['parent_agent'][] = html_print_label_input_block( @@ -795,8 +798,6 @@ if (enterprise_installed() === true) { '', 'w540px', '', - // Autocomplete. - 'new-password' ); } else { $urlAddressInput = html_print_input_text( @@ -903,18 +904,16 @@ $tableAdvancedAgent->data['safe_operation'][] = html_print_label_input_block( ) ); -if (enterprise_installed() === true) { - ui_toggle( - html_print_table($tableAdvancedAgent, true), - ''.__('Advanced options').'', - '', - '', - true, - false, - 'white_box_content', - 'no-border white_table_graph' - ); -} +ui_toggle( + html_print_table($tableAdvancedAgent, true), + ''.__('Advanced options').'', + '', + '', + true, + false, + 'white_box_content', + 'no-border white_table_graph' +); // Custom fields. $customOutputData = ''; diff --git a/pandora_console/godmode/massive/massive_add_profiles.php b/pandora_console/godmode/massive/massive_add_profiles.php index 38657bdf1c..6fa11d357f 100644 --- a/pandora_console/godmode/massive/massive_add_profiles.php +++ b/pandora_console/godmode/massive/massive_add_profiles.php @@ -109,7 +109,7 @@ if ($create_profiles) { } else { foreach ($profiles_id as $profile) { // Check profiles permissions for non admin user. - if (is_user_admin($config['user_id']) === false) { + if (is_user_admin($config['id_user']) === false) { $user_profiles = profile_get_profiles( [ 'pandora_management' => '<> 1', @@ -122,7 +122,7 @@ if ($create_profiles) { AUDIT_LOG_ACL_VIOLATION, 'Trying to add administrator profile whith standar user for user '.io_safe_input($user) ); - exit; + continue; } } @@ -132,7 +132,7 @@ if ($create_profiles) { AUDIT_LOG_ACL_VIOLATION, 'Trying to add profile group without permission for user '.io_safe_input($user) ); - exit; + continue; } foreach ($users_id as $user) { @@ -141,7 +141,7 @@ if ($create_profiles) { AUDIT_LOG_ACL_VIOLATION, 'Trying to edit user without permission for user '.io_safe_input($user) ); - exit; + continue; } $profile_data = db_get_row_filter('tusuario_perfil', ['id_usuario' => $user, 'id_perfil' => $profile, 'id_grupo' => $group]); diff --git a/pandora_console/godmode/modules/manage_network_components_form_common.php b/pandora_console/godmode/modules/manage_network_components_form_common.php index f7890712b3..9af6f3911d 100644 --- a/pandora_console/godmode/modules/manage_network_components_form_common.php +++ b/pandora_console/godmode/modules/manage_network_components_form_common.php @@ -327,7 +327,7 @@ $table->data[10][2] = __('Discard unknown events'); $table->data[10][3] = html_print_checkbox( 'throw_unknown_events', 1, - network_components_is_disable_type_event($id, EVENTS_GOING_UNKNOWN), + network_components_is_disable_type_event(($id === 0) ? false : $id, EVENTS_GOING_UNKNOWN), true ); diff --git a/pandora_console/include/chart_generator.php b/pandora_console/include/chart_generator.php index 62701365e5..2695b89c22 100644 --- a/pandora_console/include/chart_generator.php +++ b/pandora_console/include/chart_generator.php @@ -46,6 +46,8 @@ if (json_last_error() === JSON_ERROR_NONE) { $session_id = $data_decoded['session_id']; $type_graph_pdf = $data_decoded['type_graph_pdf']; $id_user = $data_decoded['id_user']; + $slicebar = $data_decoded['slicebar']; + $slicebar_value = $data_decoded['slicebar_value']; $data_combined = []; if (isset($data_decoded['data_combined']) === true) { @@ -64,6 +66,9 @@ global $config; // Care whit this!!! check_login not working if you remove this. $config['id_user'] = $id_user; $_SESSION['id_usuario'] = $id_user; +if (!isset($config[$slicebar])) { + $config[$slicebar] = $slicebar_value; +} // Try to initialize session using existing php session id. $user = new PandoraFMS\User(['phpsessionid' => $session_id]); diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 5c69e24da3..55bdd44779 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC230526'; +$build_version = 'PC230530'; $pandora_version = 'v7.0NG.771'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index 564e566247..97880fdcbf 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -1190,30 +1190,32 @@ function mysql_db_format_array_to_update_sql($values) $fields = []; foreach ($values as $field => $value) { - if (is_numeric($field)) { - array_push($fields, $value); - continue; - } else if ($field[0] == '`') { - $field = str_replace('`', '', $field); - } - - if ($value === null) { - $sql = sprintf('`%s` = NULL', $field); - } else if (is_int($value) || is_bool($value)) { - $sql = sprintf('`%s` = %d', $field, $value); - } else if (is_float($value) || is_double($value)) { - $sql = sprintf('`%s` = %f', $field, $value); - } else { - // String - if (isset($value[0]) && $value[0] == '`') { - // Don't round with quotes if it references a field - $sql = sprintf('`%s` = %s', $field, $value); - } else { - $sql = sprintf("`%s` = '%s'", $field, $value); + if (is_object($value) === false) { + if (is_numeric($field)) { + array_push($fields, $value); + continue; + } else if ($field[0] == '`') { + $field = str_replace('`', '', $field); } - } - array_push($fields, $sql); + if ($value === null) { + $sql = sprintf('`%s` = NULL', $field); + } else if (is_int($value) || is_bool($value)) { + $sql = sprintf('`%s` = %d', $field, $value); + } else if (is_float($value) || is_double($value)) { + $sql = sprintf('`%s` = %f', $field, $value); + } else { + // String + if (isset($value[0]) && $value[0] == '`') { + // Don't round with quotes if it references a field + $sql = sprintf('`%s` = %s', $field, $value); + } else { + $sql = sprintf("`%s` = '%s'", $field, $value); + } + } + + array_push($fields, $sql); + } } return implode(', ', $fields); diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 81799a549d..7f59f6e598 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -3548,6 +3548,25 @@ function update_config_token($cfgtoken, $cfgvalue) } +function update_check_config_token($cfgtoken, $cfgvalue) +{ + global $config; + db_process_sql('START TRANSACTION'); + if (isset($config[$cfgtoken])) { + delete_config_token($cfgtoken); + } + + $insert = db_process_sql(sprintf("INSERT INTO tconfig (token, value) VALUES ('%s', '%s')", $cfgtoken, $cfgvalue)); + db_process_sql('COMMIT'); + if ($insert) { + $config[$cfgtoken] = $cfgvalue; + return true; + } else { + return false; + } +} + + function delete_config_token($cfgtoken) { $delete = db_process_sql(sprintf('DELETE FROM tconfig WHERE token = "%s"', $cfgtoken)); @@ -4284,6 +4303,8 @@ function generator_chart_to_pdf( 'data_module_list' => $module_list, 'data_combined' => $params_combined, 'id_user' => $config['id_user'], + 'slicebar' => $_SESSION['slicebar'], + 'slicebar_value' => $config[$_SESSION['slicebar']], ]; } else { $data = [ @@ -4291,6 +4312,8 @@ function generator_chart_to_pdf( 'session_id' => $session_id, 'type_graph_pdf' => $type_graph_pdf, 'id_user' => $config['id_user'], + 'slicebar' => $_SESSION['slicebar'], + 'slicebar_value' => $config[$_SESSION['slicebar']], ]; } diff --git a/pandora_console/include/functions_inventory.php b/pandora_console/include/functions_inventory.php index 2beed2f0dc..78aca29867 100644 --- a/pandora_console/include/functions_inventory.php +++ b/pandora_console/include/functions_inventory.php @@ -818,9 +818,16 @@ function inventory_get_datatable( function get_data_basic_info_sql($params, $count=false) { + $table = 'tagente'; + if (is_metaconsole() === true) { + $table = 'tmetaconsole_agent'; + } + $where = 'WHERE 1=1 '; - if ($params['id_agent'] > 0) { + if ($params['id_agent'] > 0 && $count === true) { $where .= sprintf(' AND id_agente = %d', $params['id_agent']); + } else if ($params['id_agent'] > 0 && $count === false) { + $where .= sprintf(' AND %s.id_agente = %d', $table, $params['id_agent']); } if ($params['id_group'] > 0) { @@ -897,11 +904,6 @@ function get_data_basic_info_sql($params, $count=false) $innerjoin = ''; $groupby = ''; - $table = 'tagente'; - if (is_metaconsole() === true) { - $table = 'tmetaconsole_agent'; - } - if ($count !== true) { $fields = '*'; $innerjoin = 'LEFT JOIN tagente_estado ON '.$table.'.id_agente = tagente_estado.id_agente '; diff --git a/pandora_console/include/functions_network_components.php b/pandora_console/include/functions_network_components.php index f6c0087b37..acce410dd6 100644 --- a/pandora_console/include/functions_network_components.php +++ b/pandora_console/include/functions_network_components.php @@ -31,7 +31,7 @@ function network_components_is_disable_type_event($id=false, $type_event=false) if ($id === false) { switch ($type_event) { case EVENTS_GOING_UNKNOWN: - return true; + return false; break; case EVENTS_UNKNOWN: diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 8c8a7870e9..4596ba64aa 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -9123,7 +9123,7 @@ function reporting_availability($report, $content, $date=false, $time=false) modules_get_agentmodule_agent($item['id_agent_module']) ); - if (empty($text)) { + if (empty($row['data']['availability_item'])) { $row['data']['availability_item'] = __('No Address'); } } else { diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 1ee377f290..d1856b7b4c 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -756,8 +756,9 @@ function flot_slicesbar_graph( 'server_id' => $server_id, ]; // TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET. - update_config_token($tokem_config, json_encode($graph_data)); - + update_check_config_token($tokem_config, json_encode($graph_data)); + $_SESSION['slicebar'] = $tokem_config; + $_SESSION['slicebar_value'] = json_encode($graph_data); $graph = ''; diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index db74679a4c..4a64a9f2e6 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -1548,10 +1548,7 @@ function changePlugin() { var pluginDescription = pluginAllData.description; var pluginMacros = pluginAllData.macros; - console.log(pluginAllData.macrosElement); var pluginMacrosElement = JSON.parse(atob(pluginAllData.macrosElement)); - console.log(pluginMacrosElement); - var displayShow = "none"; if (executionType == EXECUTION_TYPE_NETWORK) { displayShow = "none"; diff --git a/pandora_console/install.php b/pandora_console/install.php index b0948156d4..7cb1d40aec 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -131,7 +131,7 @@