From 9c470053aee6de01f0a740c26899887419a8ef40 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 31 Aug 2023 10:58:39 +0200 Subject: [PATCH 001/108] #11954 Fix pagination --- pandora_console/godmode/agentes/fields_manager.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/fields_manager.php b/pandora_console/godmode/agentes/fields_manager.php index 25b06e2f5a..53b4995d20 100644 --- a/pandora_console/godmode/agentes/fields_manager.php +++ b/pandora_console/godmode/agentes/fields_manager.php @@ -217,6 +217,7 @@ foreach ($fields as $field) { array_push($table->data, $data); } +$tablePagination = ''; if ($fields) { html_print_table($table); $tablePagination = ui_pagination($count_fields, false, $offset, 0, true, 'offset', false); @@ -231,6 +232,9 @@ html_print_action_buttons( [ 'icon' => 'next' ], true ), - ['type' => 'form_action'] + [ + 'type' => 'form_action', + 'right_content' => $tablePagination, + ], ); echo ''; From 82db8bd4bda6e6aa4865147bbfbd583a0d2f3bf4 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Sep 2023 10:28:02 +0200 Subject: [PATCH 002/108] #11077 fix trre view widget style modal --- pandora_console/include/functions_treeview.php | 6 +++--- pandora_console/include/styles/pandora.css | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index 025276ecef..bdc7339b4a 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -785,7 +785,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) false, false, '', - 'white-box-content mrgn_top_0 mrgn_btn_0px', + 'white-box-content-no-height mrgn_top_0 mrgn_btn_0px', 'white_table_flex' ); @@ -805,7 +805,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) true, false, '', - 'white-box-content mrgn_top_0 mrgn_btn_0px border-bottom-gray', + 'white-box-content-no-height mrgn_top_0 mrgn_btn_0px border-bottom-gray', 'white_table_flex' ); } @@ -980,7 +980,7 @@ function treeview_printTable($id_agente, $server_data=[], $no_head=false) true, empty($table_advanced->data), '', - 'white-box-content mrgn_top_0 mrgn_btn_0px border-bottom-gray', + 'white-box-content-no-height mrgn_top_0 mrgn_btn_0px border-bottom-gray', 'white_table_flex' ); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index abbb50c927..486e3717f2 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -6369,6 +6369,18 @@ div#status_pie { min-width: 100%; } +.white-box-content-no-height { + width: 100%; + background-color: #fff; + box-sizing: border-box; + /*border: 1px solid #e2e2e2;*/ + display: flex; + align-items: center; + flex-wrap: wrap; + padding: 10px; + min-width: 100%; +} + .white-box-content-clean { padding-left: 2em; padding-top: 1em; From f3d2d7f3e63b8e215184c5eba931129d068de6e6 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 1 Sep 2023 10:48:03 +0200 Subject: [PATCH 003/108] #11854 Fix Create network monitoring from welcome pandora fms agent --- .../include/class/WelcomeWindow.class.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/class/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php index 5e66268403..3b49e1a56f 100644 --- a/pandora_console/include/class/WelcomeWindow.class.php +++ b/pandora_console/include/class/WelcomeWindow.class.php @@ -702,7 +702,7 @@ class WelcomeWindow extends Wizard 'next', 'style' => 'margin-top:15px; float:right;']); ?> @@ -1263,14 +1262,18 @@ class WelcomeWindow extends Wizard }); }); - $('#button-create_conectivity').click(function(){ + $('#button-create_conectivity').click(function(e){ + if($("#text-ip_target")[0].checkValidity() == false) { + $("#text-ip_target")[0].reportValidity(); + return false; + } $.ajax({ async: false, type: "POST", url: "include/ajax/task_to_perform.php", data: { check_connectivity: 1, - id_group: $('#id_group :selected').val(), + id_group: $('#id_group1 option:selected').val(), ip_target: $('#text-ip_target').val(), agent_name: $('#text-agent_name').val(), }, From 4129833a3804779ce8f7d9b07affc379d40c3606 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Sep 2023 11:44:12 +0200 Subject: [PATCH 004/108] #11026 message update only for token enable --- .../include/class/ConsoleSupervisor.php | 24 ++++++++++--------- pandora_console/include/styles/pandora.css | 1 + 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index f6d3767708..97e613cc20 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -2373,17 +2373,19 @@ class ConsoleSupervisor include_once $config['homedir'].'/include/functions_update_manager.php'; $login = get_parameter('login', false); - if (update_manager_verify_registration() === false) { - $this->notify( - [ - 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION', - 'title' => __('This instance is not registered in the Update manager section'), - 'message' => __('Click here to start the registration process'), - 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', - ] - ); - } else { - $this->cleanNotifications('NOTIF.UPDATEMANAGER.REGISTRATION'); + if ($config['autoupdate'] === true || $_GET['sec2'] === 'godmode/update_manager/update_manager') { + if (update_manager_verify_registration() === false) { + $this->notify( + [ + 'type' => 'NOTIF.UPDATEMANAGER.REGISTRATION', + 'title' => __('This instance is not registered in the Update manager section'), + 'message' => __('Click here to start the registration process'), + 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', + ] + ); + } else { + $this->cleanNotifications('NOTIF.UPDATEMANAGER.REGISTRATION'); + } } } diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index abbb50c927..573ac1a40c 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -4928,6 +4928,7 @@ div#dialog_messages table th:last-child { margin-top: 55px; border-radius: 5px; max-height: 530px; + position: fixed; } #notification-wrapper::before { From 083043eabae516edf768c55e235cf29afb77dfc2 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 1 Sep 2023 14:06:48 +0200 Subject: [PATCH 005/108] #11650 Change style for tooltip --- pandora_console/godmode/alerts/alert_templates.php | 9 +++++---- pandora_console/include/functions_ui.php | 7 +++++-- pandora_console/include/styles/pandora.css | 5 +++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_templates.php b/pandora_console/godmode/alerts/alert_templates.php index 003ec45d03..8236d1e69c 100644 --- a/pandora_console/godmode/alerts/alert_templates.php +++ b/pandora_console/godmode/alerts/alert_templates.php @@ -31,13 +31,14 @@ if (is_ajax()) { return; } - echo '

'.$template['name'].'

'; + echo '

'.$template['name'].'

'; + echo html_print_image('images/info.svg', true, ['class' => 'invert_filter']); + echo ui_print_alert_template_example($template['id'], true, true, false); + echo '
'; + echo '
'; echo ''.__('Type').': '; echo alerts_get_alert_templates_type_name($template['type']); - echo '
'; - echo ui_print_alert_template_example($template['id'], true); - echo '
'; if ($template['description'] != '') { diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 4bacf6c920..b843b5ff3e 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -1780,11 +1780,14 @@ function ui_print_string_substr($string, $cutoff=16, $return=false, $fontsize=0) * * @return An HTML string if return was true. */ -function ui_print_alert_template_example($id_alert_template, $return=false, $print_values=true) +function ui_print_alert_template_example($id_alert_template, $return=false, $print_values=true, $print_icon=true) { $output = ''; - $output .= html_print_image('images/information.png', true, ['class' => 'invert_filter']); + if ($print_icon === true) { + $output .= html_print_image('images/information.png', true, ['class' => 'invert_filter']); + } + $output .= ''; $template = alerts_get_alert_template($id_alert_template); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index abbb50c927..eeab657bce 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -12562,3 +12562,8 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input { flex-wrap: nowrap; justify-content: flex-start !important; } + +#cluetip-inner > #example { + position: absolute; + margin-left: 5px; +} From 5ca1c547926ddbdf7417ec3e0f05db080af057a2 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 4 Sep 2023 10:49:29 +0200 Subject: [PATCH 006/108] #9946 Add search filter and change table to datatable --- .../include/ajax/dashboard.ajax.php | 217 ++++++++++++++++++ pandora_console/views/dashboard/list.php | 181 ++++----------- 2 files changed, 262 insertions(+), 136 deletions(-) create mode 100644 pandora_console/include/ajax/dashboard.ajax.php diff --git a/pandora_console/include/ajax/dashboard.ajax.php b/pandora_console/include/ajax/dashboard.ajax.php new file mode 100644 index 0000000000..0c6b36a1df --- /dev/null +++ b/pandora_console/include/ajax/dashboard.ajax.php @@ -0,0 +1,217 @@ +width = '100%'; + $table->class = 'info_table'; + $table->headstyle['name'] = 'text-align: left;'; + $table->headstyle['cells'] = 'text-align: center;'; + $table->headstyle['groups'] = 'text-align: center;'; + $table->headstyle['favorite'] = 'text-align: center;'; + $table->headstyle['full_screen'] = 'text-align: center;'; + + $table->style = []; + $table->style['name'] = 'text-align: left;'; + $table->style['cells'] = 'text-align: center;'; + $table->style['groups'] = 'text-align: center;'; + $table->style['favorite'] = 'text-align: center;'; + $table->style['full_screen'] = 'text-align: center;'; + + $table->size = []; + $table->size['name'] = '40%'; + $table->size['full_screen'] = '30px'; + + $table->head = []; + $table->head['name'] = __('Name'); + $table->head['cells'] = __('Cells'); + $table->head['groups'] = __('Group'); + $table->head['favorite'] = __('Favorite'); + $table->head['full_screen'] = __('Full screen'); + + if ($manageDashboards === 1) { + $table->head['copy'] = __('Copy'); + $table->head['delete'] = __('Delete'); + $table->headstyle['copy'] = 'text-align: center;'; + $table->headstyle['delete'] = 'text-align: center;'; + $table->style['copy'] = 'text-align: center;'; + $table->style['delete'] = 'text-align: center;'; + $table->size['cells'] = '30px'; + $table->size['groups'] = '30px'; + $table->size['favorite'] = '30px'; + $table->size['copy'] = '30px'; + $table->size['delete'] = '30px'; + } else { + $table->size['cells'] = '60px'; + $table->size['groups'] = '60px'; + $table->size['favorite'] = '60px'; + } + + $table->data = []; + + if (strlen($filter['free_search']) > 0) { + $where = 'WHERE name LIKE "%'.$filter['free_search'].'%"'; + } else { + $where = ''; + } + + $sql = 'SELECT * FROM tdashboard '.$where.' ORDER BY id '.$pagination; + $dashboards = db_get_all_rows_sql($sql); + $count = db_get_value_sql('SELECT COUNT(*) FROM tdashboard '.$where); + foreach ($dashboards as $dashboard) { + $data = []; + + $dataQuery = ['dashboardId' => $dashboard['id']]; + + $url = $urlDashboard.'&'.http_build_query($dataQuery); + $data['name'] = ''; + $data['name'] .= $dashboard['name']; + $data['name'] .= ''; + + $data['cells'] = $dashboard['cells']; + + if (empty($dashboard['id_user']) === false) { + $data['groups'] = __( + 'Private for (%s)', + $dashboard['id_user'] + ); + } else { + $data['groups'] = ui_print_group_icon( + $dashboard['id_group'], + true + ); + } + + $data['favorite'] = $dashboard['active']; + + $dataQueryFull = [ + 'dashboardId' => $dashboard['id'], + 'pure' => 1, + ]; + + $urlFull = $urlDashboard; + $urlFull .= '&'.\http_build_query($dataQueryFull); + $data['full_screen'] = ''; + $data['full_screen'] .= \html_print_image( + 'images/fullscreen@svg.svg', + true, + ['class' => 'main_menu_icon invert_filter'] + ); + $data['full_screen'] .= ''; + + if ($manageDashboards === 1) { + $data['copy'] = ''; + $data['delete'] = ''; + } + + if (check_acl_restricted_all($config['id_user'], $dashboard['id_group'], 'RM')) { + $dataQueryCopy = [ + 'dashboardId' => $dashboard['id'], + 'copyDashboard' => 1, + ]; + $urlCopy = $urlDashboard.'&'.\http_build_query($dataQueryCopy); + $data['copy'] = ''; + $data['copy'] .= html_print_image('images/copy.svg', true, ['class' => 'main_menu_icon invert_filter']); + $data['copy'] .= ''; + + $dataQueryDelete = [ + 'dashboardId' => $dashboard['id'], + 'deleteDashboard' => 1, + ]; + $urlDelete = $urlDashboard; + $urlDelete .= '&'.\http_build_query($dataQueryDelete); + $data['delete'] = ''; + $data['delete'] .= \html_print_image( + 'images/delete.svg', + true, + ['class' => 'main_menu_icon invert_filter'] + ); + $data['delete'] .= ''; + } + + $table->cellclass[] = [ + 'full_screen' => 'table_action_buttons', + 'copy' => 'table_action_buttons', + 'delete' => 'table_action_buttons', + ]; + + $table->data[] = $data; + } + + // Datatables format: RecordsTotal && recordsfiltered. + echo json_encode( + [ + 'data' => $table->data, + 'recordsTotal' => $count, + 'recordsFiltered' => $count, + ] + ); + // Capture output. + $response = ob_get_clean(); + } catch (Exception $e) { + echo json_encode(['error' => $e->getMessage()]); + exit; + } + + // If not valid, show error with issue. + json_decode($response); + if (json_last_error() == JSON_ERROR_NONE) { + // If valid dump. + echo $response; + } else { + echo json_encode( + ['error' => $response] + ); + } + + exit; +} diff --git a/pandora_console/views/dashboard/list.php b/pandora_console/views/dashboard/list.php index 2645724a6e..e0cbaec685 100644 --- a/pandora_console/views/dashboard/list.php +++ b/pandora_console/views/dashboard/list.php @@ -75,144 +75,53 @@ if (empty($dashboards) === true) { ] ); } else { - $table = new stdClass(); - $table->width = '100%'; - $table->class = 'info_table'; - $table->headstyle['name'] = 'text-align: left;'; - $table->headstyle['cells'] = 'text-align: center;'; - $table->headstyle['groups'] = 'text-align: center;'; - $table->headstyle['favorite'] = 'text-align: center;'; - $table->headstyle['full_screen'] = 'text-align: center;'; + $id_table = 'dashboards_list'; + $columns = [ + 'name', + 'cells', + 'groups', + 'favorite', + 'full_screen', + ]; - $table->style = []; - $table->style['name'] = 'text-align: left;'; - $table->style['cells'] = 'text-align: center;'; - $table->style['groups'] = 'text-align: center;'; - $table->style['favorite'] = 'text-align: center;'; - $table->style['full_screen'] = 'text-align: center;'; + $column_names = [ + __('Name'), + __('Cells'), + __('Group'), + __('Favorite'), + __('Full screen'), + ]; - $table->size = []; - $table->size['name'] = '40%'; - $table->size['full_screen'] = '30px'; - - $table->head = []; - $table->head['name'] = __('Name'); - $table->head['cells'] = __('Cells'); - $table->head['groups'] = __('Group'); - $table->head['favorite'] = __('Favorite'); - $table->head['full_screen'] = __('Full screen'); - - if ($manageDashboards === 1) { - $table->head['copy'] = __('Copy'); - $table->head['delete'] = __('Delete'); - $table->headstyle['copy'] = 'text-align: center;'; - $table->headstyle['delete'] = 'text-align: center;'; - $table->style['copy'] = 'text-align: center;'; - $table->style['delete'] = 'text-align: center;'; - $table->size['cells'] = '30px'; - $table->size['groups'] = '30px'; - $table->size['favorite'] = '30px'; - $table->size['copy'] = '30px'; - $table->size['delete'] = '30px'; - } else { - $table->size['cells'] = '60px'; - $table->size['groups'] = '60px'; - $table->size['favorite'] = '60px'; - } - - $table->data = []; - - foreach ($dashboards as $dashboard) { - $data = []; - - $dataQuery = ['dashboardId' => $dashboard['id']]; - - $url = $urlDashboard.'&'.http_build_query($dataQuery); - $data['name'] = ''; - $data['name'] .= $dashboard['name']; - $data['name'] .= ''; - - $data['cells'] = $dashboard['cells']; - - if (empty($dashboard['id_user']) === false) { - $data['groups'] = __( - 'Private for (%s)', - $dashboard['id_user'] - ); - } else { - $data['groups'] = ui_print_group_icon( - $dashboard['id_group'], - true - ); - } - - $data['favorite'] = $dashboard['active']; - - $dataQueryFull = [ - 'dashboardId' => $dashboard['id'], - 'pure' => 1, - ]; - - $urlFull = $urlDashboard; - $urlFull .= '&'.\http_build_query($dataQueryFull); - $data['full_screen'] = ''; - $data['full_screen'] .= \html_print_image( - 'images/fullscreen@svg.svg', - true, - ['class' => 'main_menu_icon invert_filter'] - ); - $data['full_screen'] .= ''; - - if ($manageDashboards === 1) { - $data['copy'] = ''; - $data['delete'] = ''; - } - - if (check_acl_restricted_all($config['id_user'], $dashboard['id_group'], 'RM')) { - $dataQueryCopy = [ - 'dashboardId' => $dashboard['id'], - 'copyDashboard' => 1, - ]; - $urlCopy = $urlDashboard.'&'.\http_build_query($dataQueryCopy); - $data['copy'] = ''; - $data['copy'] .= html_print_image('images/copy.svg', true, ['class' => 'main_menu_icon invert_filter']); - $data['copy'] .= ''; - - $dataQueryDelete = [ - 'dashboardId' => $dashboard['id'], - 'deleteDashboard' => 1, - ]; - $urlDelete = $urlDashboard; - $urlDelete .= '&'.\http_build_query($dataQueryDelete); - $data['delete'] = ''; - $data['delete'] .= \html_print_image( - 'images/delete.svg', - true, - ['class' => 'main_menu_icon invert_filter'] - ); - $data['delete'] .= ''; - } - - $table->cellclass[] = [ - 'full_screen' => 'table_action_buttons', - 'copy' => 'table_action_buttons', - 'delete' => 'table_action_buttons', - ]; - - $table->data[] = $data; - } - - \html_print_table($table); - $tablePagination = \ui_pagination( - $count, - false, - $offset, - 0, - true, - 'offset', - false, - '' + ui_print_datatable( + [ + 'id' => $id_table, + 'class' => 'info_table', + 'style' => 'width: 100%', + 'columns' => $columns, + 'column_names' => $column_names, + 'ajax_url' => 'include/ajax/dashboard.ajax', + 'ajax_data' => ['method' => 'draw'], + 'default_pagination' => $config['block_size'], + 'no_sortable_columns' => [], + 'order' => [ + 'field' => 'name', + 'direction' => 'desc', + ], + 'search_button_class' => 'sub filter float-right', + 'form' => [ + 'inputs' => [ + [ + 'label' => __('Free search'), + 'type' => 'text', + 'class' => 'w400px', + 'id' => 'free_search', + 'name' => 'free_search', + ], + ], + ], + 'filter_main_class' => 'box-flat white_table_graph fixed_filter_bar ', + 'csv' => false, + ] ); } From 81610046e3cc3d07ce02231b0af0720c0a11895f Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 4 Sep 2023 10:58:15 +0200 Subject: [PATCH 007/108] #9946 Fix url --- pandora_console/include/ajax/dashboard.ajax.php | 1 + pandora_console/views/dashboard/list.php | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/ajax/dashboard.ajax.php b/pandora_console/include/ajax/dashboard.ajax.php index 0c6b36a1df..32d509eb8c 100644 --- a/pandora_console/include/ajax/dashboard.ajax.php +++ b/pandora_console/include/ajax/dashboard.ajax.php @@ -31,6 +31,7 @@ global $config; $method = get_parameter('method', null); $filter = get_parameter('filter', ''); +$urlDashboard = get_parameter('urlDashboard', ''); if ($method === 'draw') { // Datatables offset, limit and order. diff --git a/pandora_console/views/dashboard/list.php b/pandora_console/views/dashboard/list.php index e0cbaec685..50e2fe26d8 100644 --- a/pandora_console/views/dashboard/list.php +++ b/pandora_console/views/dashboard/list.php @@ -91,7 +91,6 @@ if (empty($dashboards) === true) { __('Favorite'), __('Full screen'), ]; - ui_print_datatable( [ 'id' => $id_table, @@ -100,7 +99,10 @@ if (empty($dashboards) === true) { 'columns' => $columns, 'column_names' => $column_names, 'ajax_url' => 'include/ajax/dashboard.ajax', - 'ajax_data' => ['method' => 'draw'], + 'ajax_data' => [ + 'method' => 'draw', + 'urlDashboard' => $urlDashboard, + ], 'default_pagination' => $config['block_size'], 'no_sortable_columns' => [], 'order' => [ From dc520df039343547929cba9ca7278c35942ae4db Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 4 Sep 2023 11:09:58 +0200 Subject: [PATCH 008/108] #9946 Fix delete and copy --- pandora_console/include/ajax/dashboard.ajax.php | 1 + pandora_console/views/dashboard/list.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/ajax/dashboard.ajax.php b/pandora_console/include/ajax/dashboard.ajax.php index 32d509eb8c..f07d1aee57 100644 --- a/pandora_console/include/ajax/dashboard.ajax.php +++ b/pandora_console/include/ajax/dashboard.ajax.php @@ -32,6 +32,7 @@ global $config; $method = get_parameter('method', null); $filter = get_parameter('filter', ''); $urlDashboard = get_parameter('urlDashboard', ''); +$manageDashboards = get_parameter('manageDashboards', 1); if ($method === 'draw') { // Datatables offset, limit and order. diff --git a/pandora_console/views/dashboard/list.php b/pandora_console/views/dashboard/list.php index 50e2fe26d8..52b7543304 100644 --- a/pandora_console/views/dashboard/list.php +++ b/pandora_console/views/dashboard/list.php @@ -91,6 +91,13 @@ if (empty($dashboards) === true) { __('Favorite'), __('Full screen'), ]; + if ($manageDashboards === 1) { + $columns[] = 'copy'; + $columns[] = 'delete'; + $column_names[] = __('Copy'); + $column_names[] = __('Delete'); + } + ui_print_datatable( [ 'id' => $id_table, @@ -100,8 +107,9 @@ if (empty($dashboards) === true) { 'column_names' => $column_names, 'ajax_url' => 'include/ajax/dashboard.ajax', 'ajax_data' => [ - 'method' => 'draw', - 'urlDashboard' => $urlDashboard, + 'method' => 'draw', + 'urlDashboard' => $urlDashboard, + 'manageDashboards' => $manageDashboards, ], 'default_pagination' => $config['block_size'], 'no_sortable_columns' => [], From e31a38b08b4230d3743e62eefc66a95d097e4929 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 4 Sep 2023 12:50:23 +0200 Subject: [PATCH 009/108] #11791 Prevent any user from changing another user's notification settings --- pandora_console/include/functions_notifications.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index 60a8e6bce0..eb16d5ebc0 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -653,7 +653,14 @@ function notifications_get_user_label_status($source, $user, $label) */ function notifications_set_user_label_status($source, $user, $label, $value) { + global $config; + + if ((bool) check_acl($config['id_user'], 0, 'PM') === false && $config['id_user'] !== $user) { + return false; + } + $source_info = notifications_get_all_sources(['id' => $source]); + if (!isset($source_info[0]) || !$source_info[0]['enabled'] || !$source_info[0]['user_editable'] From 3327d79ed62b38bc6f63611c57fe4c9f60c49c54 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 6 Sep 2023 09:35:12 +0200 Subject: [PATCH 010/108] #11442 Change Welcome tips arrows and buttons --- .../include/class/TipsWindow.class.php | 21 +++- .../include/javascript/tipsWindow.js | 101 ++++++++++++++---- pandora_console/include/styles/pandora.css | 22 ++++ .../include/styles/tips_window.css | 3 +- .../views/dashboard/tipsWindow.php | 39 ++++--- 5 files changed, 144 insertions(+), 42 deletions(-) diff --git a/pandora_console/include/class/TipsWindow.class.php b/pandora_console/include/class/TipsWindow.class.php index ae4271fba9..6406c69194 100644 --- a/pandora_console/include/class/TipsWindow.class.php +++ b/pandora_console/include/class/TipsWindow.class.php @@ -47,6 +47,7 @@ class TipsWindow 'renderPreview', 'setShowTipsAtStartup', 'getTips', + 'getTipById', ]; /** @@ -221,8 +222,13 @@ class TipsWindow * * @return array $tip */ - public function getTipById($idTip) + public function getTipById($idTip=false, $return=false) { + if ($idTip === false) { + $idTip = get_parameter('idTip'); + } + + $return = get_parameter('return', false); $tip = db_get_row( 'twelcome_tip', 'id', @@ -232,9 +238,20 @@ class TipsWindow $tip['title'] = io_safe_output($tip['title']); $tip['text'] = io_safe_output($tip['text']); $tip['url'] = io_safe_output($tip['url']); + $tip['files'] = $this->getFilesFromTip($tip['id']); } - return $tip; + if ($return !== false) { + if (empty($tip) === false) { + echo json_encode(['success' => true, 'data' => $tip]); + return; + } else { + echo json_encode(['success' => false]); + return; + } + } else { + return $tip; + } } diff --git a/pandora_console/include/javascript/tipsWindow.js b/pandora_console/include/javascript/tipsWindow.js index 94d28c9339..cb804ecebb 100644 --- a/pandora_console/include/javascript/tipsWindow.js +++ b/pandora_console/include/javascript/tipsWindow.js @@ -81,14 +81,17 @@ function removeInputImage(e) { $("#notices_images").addClass("invisible"); } } -function render({ title, text, url, files }) { +function render({ title, text, url, files, method }) { $("#title_tip").html(title); $("#text_tip").html(text); if (url) { - $("#url_tip").removeClass("invisible"); + $("#button-learn_more").removeAttr("disabled"); + $("#button-learn_more").removeClass("disabled_button"); $("#url_tip").attr("href", url); } else { - $("#url_tip").addClass("invisible"); + $("#button-learn_more").attr("disabled", "disabled"); + $("#button-learn_more").addClass("disabled_button"); + $("#url_tip").attr("href", ""); } $(".carousel").empty(); @@ -110,7 +113,11 @@ function render({ title, text, url, files }) { if (index >= limitRound - 1) { $($(".count-round-tip")[0]).addClass("active"); } else { - $($(".count-round-tip")[index + 1]).addClass("active"); + if (method == "next") { + $($(".count-round-tip")[index + 1]).addClass("active"); + } else { + $($(".count-round-tip")[index - 1]).addClass("active"); + } } return false; } @@ -146,23 +153,79 @@ function render_counter() { function next_tip() { if (idTips.length >= totalTips) { idTips = []; + $("#hidden-tip_position").val(-1); } - $.ajax({ - method: "POST", - url: url, - dataType: "json", - data: { - page: page, - method: "getRandomTip", - exclude: JSON.stringify(idTips) - }, - success: function({ success, data }) { - if (success) { - idTips.push(parseInt(data.id)); - render(data); + let tip_position = parseInt($("#hidden-tip_position").val()) + 1; + let idTip = idTips[tip_position]; + if (idTip === undefined) { + $.ajax({ + method: "POST", + url: url, + dataType: "json", + data: { + page: page, + method: "getRandomTip", + exclude: JSON.stringify(idTips) + }, + success: function({ success, data }) { + if (success) { + let tip_position = parseInt($("#hidden-tip_position").val()) + 1; + $("#hidden-tip_position").val(tip_position); + idTips.push(parseInt(data.id)); + data.method = "next"; + render(data); + } } - } - }); + }); + } else { + $.ajax({ + method: "POST", + url: url, + dataType: "json", + data: { + page: page, + method: "getTipById", + idTip: idTip, + return: true + }, + success: function({ success, data }) { + if (success) { + let tip_position = parseInt($("#hidden-tip_position").val()) + 1; + $("#hidden-tip_position").val(tip_position); + data.method = "next"; + render(data); + } + } + }); + } +} + +function previous_tip() { + let actual_tip_position = parseInt($("#hidden-tip_position").val()); + + if (actual_tip_position != 0) { + let tip_position = parseInt($("#hidden-tip_position").val()) - 1; + let idTip = idTips[tip_position]; + $.ajax({ + method: "POST", + url: url, + dataType: "json", + data: { + page: page, + method: "getTipById", + idTip: idTip, + return: true + }, + success: function({ success, data }) { + if (success) { + let tip_position = parseInt($("#hidden-tip_position").val()) - 1; + $("#hidden-tip_position").val(tip_position); + data.method = "prev"; + render(data); + } + } + }); + } } function load_tips_modal(settings) { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index d87d959ac5..3bbf8cb16d 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -12566,3 +12566,25 @@ tr[id^="network_component-plugin-snmp-fields-dynamicMacroRow-"] input { .ui-date-range-in > a { background-color: #81b92e3b !important; } + +.ui-dialog .tips_header.ui-dialog-titlebar { + height: fit-content !important; +} + +.arrow_counter:hover { + cursor: pointer; +} + +.disabled_button { + background-color: #ccc !important; + border: 2px solid #444 !important; + color: #444 !important; +} + +.disabled_button:hover { + cursor: not-allowed; +} + +.counter-tips { + margin-right: 20px; +} diff --git a/pandora_console/include/styles/tips_window.css b/pandora_console/include/styles/tips_window.css index 505799949b..53906401a8 100644 --- a/pandora_console/include/styles/tips_window.css +++ b/pandora_console/include/styles/tips_window.css @@ -21,7 +21,7 @@ display: flex !important; padding: 0px 20px; justify-content: space-between; - height: fit-content; + height: fit-content !important; background-color: white; color: #161628; border-top-left-radius: 25px !important; @@ -161,6 +161,7 @@ span.count-round-tip.active { margin-top: 10px; } .arrow_counter { + cursor: pointer; width: 7px; margin: 0px 5px; } diff --git a/pandora_console/views/dashboard/tipsWindow.php b/pandora_console/views/dashboard/tipsWindow.php index b9ff3f2420..573a11abcc 100644 --- a/pandora_console/views/dashboard/tipsWindow.php +++ b/pandora_console/views/dashboard/tipsWindow.php @@ -72,37 +72,36 @@ $output .= '

'.$title.'

'; $output .= '

'; $output .= $text; $output .= '

'; - -$link_class = 'invisible'; +$disabled_class = 'disabled_button'; +$disabled = true; if (empty($url) === false && $url !== '') { - $link_class = ''; + $disabled_class = ''; + $disabled = false; } -$output .= ''.__('See more info').''; - $output .= ''; $output .= '
'; - +$output .= ''; $output .= html_print_button( - __('Maybe later'), + __('Learn more'), + 'learn_more', + $disabled, '', - false, - '', - [ - 'onclick' => 'close_dialog()', - 'class' => 'secondary mini', - ], + ['class' => 'secondary mini '.$disabled_class], true ); +$output .= ''; $output .= '
'; -$output .= html_print_image('images/arrow-left-grey.png', true, ['class' => 'arrow_counter']); -$output .= html_print_image('images/arrow-right-grey.png', true, ['class' => 'arrow_counter']); + +$output .= html_print_image('images/arrow-left-grey.png', true, ['class' => 'arrow_counter', 'onclick' => 'previous_tip()']); +$output .= html_print_image('images/arrow-right-grey.png', true, ['class' => 'arrow_counter', 'onclick' => 'next_tip()']); +$output .= html_print_input_hidden('tip_position', 0, true); $output .= '
'; if ($preview === true) { $output .= html_print_button( - __('Ok'), - 'next_tip', + __('Close'), + 'close_dialog', false, '', [ @@ -113,12 +112,12 @@ if ($preview === true) { ); } else { $output .= html_print_button( - __('Ok'), - 'next_tip', + __('Close'), + 'close_dialog', false, '', [ - 'onclick' => 'next_tip()', + 'onclick' => 'close_dialog()', 'class' => ($totalTips === '1') ? 'mini hide-button' : 'mini', ], true From 0cd43b8315e48c654725564c02a01781a3fee0c7 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Wed, 6 Sep 2023 15:45:35 +0200 Subject: [PATCH 011/108] fixed web console erratas --- .../godmode/reporting/reporting_builder.list_items.php | 2 +- pandora_console/godmode/setup/setup.php | 2 +- pandora_console/include/functions_reporting_html.php | 2 +- tests/console/Views.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index d3fd439181..e92e038dfe 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -777,7 +777,7 @@ $table->data[0][0] = html_print_label_input_block( ) ); $table->data[0][1] = html_print_label_input_block( - __('Poisition'), + __('Position'), html_print_input_text_extended( 'position_to_delete', 1, diff --git a/pandora_console/godmode/setup/setup.php b/pandora_console/godmode/setup/setup.php index 7e17f9fe4c..84cce309a8 100644 --- a/pandora_console/godmode/setup/setup.php +++ b/pandora_console/godmode/setup/setup.php @@ -370,7 +370,7 @@ switch ($section) { break; default: - $subpage = 'seccion: '.$section; + $subpage = 'seccion: '; // Default. break; } diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index eb7c555fb9..b57ee0e7e1 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -2712,7 +2712,7 @@ function reporting_html_group_report($table, $item, $pdf=0) $out .= ''; $out .= ''; $out .= ''; - $out .= '
'.__('Events per agent').''; + $out .= '
'.__('Events by agent').''; $data = []; $options = []; $labels = []; diff --git a/tests/console/Views.py b/tests/console/Views.py index b4ad48134e..f4967e3db7 100644 --- a/tests/console/Views.py +++ b/tests/console/Views.py @@ -305,7 +305,7 @@ class viewAppear(PandoraWebDriverTestCase): click_menu_element(driver,"CSV import") time.sleep(2) self.assertEqual("Upload file" in driver.page_source,True) - click_menu_element(driver,"CSV import group") + click_menu_element(driver,"Import groups with CSV file") time.sleep(2) self.assertEqual("Upload file" in driver.page_source,True) click_menu_element(driver,"IPAM") From 02e2903b37f4538b59c0ec18cf9134986a4bfe39 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 7 Sep 2023 17:58:26 +0200 Subject: [PATCH 012/108] #11995 Prevent breaked graphics --- pandora_console/include/graphs/flot/pandora.flot.js | 3 +++ pandora_console/include/styles/pandora.css | 1 + 2 files changed, 4 insertions(+) diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 56cd4a71a1..077a3200e5 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -2223,6 +2223,9 @@ function pandoraFlotArea( } var dataInSelection = ranges.xaxis.to - ranges.xaxis.from; + if (dataInSelection < 35000) { + return; + } var maxticks_zoom = dataInSelection / 3600000 / number_ticks; if (maxticks_zoom < 0.001) { diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index d87d959ac5..bc31c721e5 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -6646,6 +6646,7 @@ table.table_modal_alternate tr td:first-child { white-space: normal; word-break: break-all; line-height: 1.3; + max-width: 40px !important; } table#agent_interface_info .flot-text .flot-x-axis div { From 4b5dcff3cc41cbac4bc801d0d64638ce093c1e9d Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 8 Sep 2023 09:26:08 +0200 Subject: [PATCH 013/108] #10529 Fix token session timeout --- pandora_console/godmode/setup/setup_auth.php | 33 +++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/setup/setup_auth.php b/pandora_console/godmode/setup/setup_auth.php index 6616cd765c..580ccab9a3 100644 --- a/pandora_console/godmode/setup/setup_auth.php +++ b/pandora_console/godmode/setup/setup_auth.php @@ -535,16 +535,47 @@ html_print_action_buttons( __('Update'), 'update_button', false, - [ 'icon' => 'update' ], + [ + 'icon' => 'update', + 'onclick' => 'onFormSubmit()', + ], true ) ); echo ''; +echo ui_print_warning_message( + [ + 'message' => __('Session timeout must be a number'), + 'force_class' => 'invisible js_warning_msg', + ], + '', + true +); ?> From 09cae778c52172af465b1a9cc5c775bf29a2a8a1 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 4 Oct 2023 16:28:40 +0200 Subject: [PATCH 033/108] #12153 Create event list graph --- pandora_console/include/ajax/events.php | 4 +- pandora_console/include/functions_events.php | 40 ++++++++++++++------ pandora_console/include/graphs/fgraph.php | 6 +++ pandora_console/operation/events/events.php | 11 +++--- 4 files changed, 41 insertions(+), 20 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index 1e9d744739..fbab653bf7 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -2764,9 +2764,7 @@ if ($draw_row_response_info === true) { if ((bool) $draw_events_graph === true) { $filter = get_parameter('filter'); - $output = ''; - hd($filter, true); - $output .= '

grafica

'; + $output = event_print_graph($filter); echo $output; return; } \ No newline at end of file diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index edefd1c187..76439fd8c4 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -6207,13 +6207,14 @@ function event_get_counter_extraId(array $event, ?array $filters) function event_print_graph( $filter, - $start_utimestamp, - $end_utimestamp, - $graph_width, - $graph_height, + $graph_height=100, ) { global $config; - $num_data = 10; + $events = events_get_all(['te.id_evento', 'te.timestamp', 'te.utimestamp'], $filter, null, null, 'te.utimestamp', true); + $start_utimestamp = $events[0]['utimestamp']; + $end_utimestamp = $events[array_key_last($events)]['utimestamp']; + $num_data = count($events); + $num_intervals = ($num_data > 75) ? 75 : $num_data; $period = ($end_utimestamp - $start_utimestamp); @@ -6256,12 +6257,26 @@ function event_print_graph( $chart = []; $labels = []; $color = []; - $currentutimestamp = $start_utimestamp; - for ($i = 0; $i < $num_intervals; $i++,$currentutimestamp += $interval_length) { - $labels[] = date($chart_time_format, $currentutimestamp); + $count = 0; + $control_timestamp = $start_utimestamp; + $data_events = []; + foreach ($events as $event) { + if ($event['utimestamp'] === $control_timestamp) { + $count++; + } else { + $control_timestamp = $event['utimestamp']; + $count = 1; + } + + $data_events[$control_timestamp] = $count; + } + + $data_events = array_reverse($data_events, true); + foreach ($data_events as $utimestamp => $count) { + $labels[] = date($chart_time_format, $utimestamp); $chart[] = [ - 'y' => 1, - 'x' => date($chart_time_format, $currentutimestamp), + 'y' => $count, + 'x' => date($chart_time_format, $utimestamp), ]; $color[] = '#82b92f'; } @@ -6276,6 +6291,7 @@ function event_print_graph( 'waterMark' => $water_mark, 'legend' => ['display' => false], 'colors' => $color, + 'border' => false, 'scales' => [ 'x' => [ 'grid' => ['display' => false], @@ -6287,9 +6303,9 @@ function event_print_graph( 'labels' => $labels, ]; - $graph = '
'; + $graph = '
'; $graph .= vbar_graph($chart, $options); $graph .= '
'; - echo $graph; + return $graph; } diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 494ec9c010..d7f3e3ed7b 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -1187,6 +1187,12 @@ function get_build_setup_charts($type, $options, $data) ) { $colors = $options['colors']; $borders = $options['colors']; + if (isset($options['border']) === true && (bool) $options['border'] === false) { + $borders = []; + foreach ($colors as $color) { + $borders[] = 'rgba(0, 0, 0, 0)'; + } + } } else { // Colors. $defaultColor = []; diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 076d48e60a..febdb33156 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -2728,8 +2728,8 @@ try { $graph_div = html_print_div( [ 'id' => 'events-graph', - 'class' => 'mrgn_top_10px mrg_btt_60 invisible', - 'style' => 'text-align: left;'.$graph_background, + 'class' => 'invisible', + 'style' => 'margin-bottom: 10px; text-align: left;'.$graph_background, ], true ); @@ -2750,7 +2750,6 @@ try { true ); - hd(get_parameter('filter'), true); // Print datatable. @@ -3502,6 +3501,10 @@ $(document).ready( function() { $("#button-remove_without").click(function() { click_button_remove_tag("without"); }); + + $("#button-events_form_search_bt").click(function(){ + show_events_graph(); + }); //Autorefresh in fullscreen @@ -3737,8 +3740,6 @@ function show_events_graph(){ $('#events-graph') .empty() .html(data); - console.log('success'); - console.log(data); } }); } From 87aa79b176d8209671385456ad389cc84ffb689a Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 5 Oct 2023 09:45:17 +0200 Subject: [PATCH 034/108] #12153 Fix graph --- pandora_console/include/functions_events.php | 129 ++++++++++++------- 1 file changed, 82 insertions(+), 47 deletions(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 76439fd8c4..8e2896c448 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -6207,17 +6207,48 @@ function event_get_counter_extraId(array $event, ?array $filters) function event_print_graph( $filter, - $graph_height=100, + $graph_height=400, ) { global $config; + $show_all_data = false; $events = events_get_all(['te.id_evento', 'te.timestamp', 'te.utimestamp'], $filter, null, null, 'te.utimestamp', true); - $start_utimestamp = $events[0]['utimestamp']; - $end_utimestamp = $events[array_key_last($events)]['utimestamp']; - $num_data = count($events); - $num_intervals = ($num_data > 75) ? 75 : $num_data; + if (empty($filter['date_from']) === false + && empty($filter['time_from']) === false + && empty($filter['date_to']) === false + && empty($filter['time_to']) === false + ) { + $start_utimestamp = strtotime($filter['date_from'].' '.$filter['time_from']); + $end_utimestamp = strtotime($filter['date_to'].' '.$filter['time_to']); + } else if ($filter['event_view_hr'] !== '') { + $start_utimestamp = strtotime('-'.$filter['event_view_hr'].' hours'); + $end_utimestamp = strtotime('now'); + } else { + $show_all_data = true; + $start_utimestamp = $events[0]['utimestamp']; + $end_utimestamp = $events[array_key_last($events)]['utimestamp']; + } + + $data_events = []; + $control_timestamp = $start_utimestamp; + $count = 0; + foreach ($events as $event) { + if ($event['utimestamp'] === $control_timestamp) { + $count++; + } else { + $control_timestamp = $event['utimestamp']; + $count = 1; + } + + $data_events[$control_timestamp] = $count; + } + + $num_data = count($data_events); + + $num_intervals = $num_data; $period = ($end_utimestamp - $start_utimestamp); + if ($period <= SECONDS_6HOURS) { $chart_time_format = 'H:i:s'; } else if ($period < SECONDS_1DAY) { @@ -6230,55 +6261,59 @@ function event_print_graph( $chart_time_format = 'M d H\h'; } - $interval_length = (int) ($period / $num_intervals); - - $currentutimestamp = $start_utimestamp; - for ($i = 0; $i < $num_intervals; $i++) { - if ($currentutimestamp === $start_utimestamp) { - $filter['aggs']['messages']['filters']['filters'][$i]['range']['utimestamp'] = [ - 'gte' => $currentutimestamp, - 'lte' => ($currentutimestamp + $interval_length), - ]; - } else if ($currentutimestamp === $end_utimestamp) { - $filter['aggs']['messages']['filters']['filters'][$i]['range']['utimestamp'] = [ - 'gt' => $currentutimestamp, - 'lte' => $end_utimestamp, - ]; - } else { - $filter['aggs']['messages']['filters']['filters'][$i]['range']['utimestamp'] = [ - 'gt' => $currentutimestamp, - 'lte' => ($currentutimestamp + $interval_length), - ]; - } - - $currentutimestamp += $interval_length; - } - $chart = []; $labels = []; $color = []; $count = 0; - $control_timestamp = $start_utimestamp; - $data_events = []; - foreach ($events as $event) { - if ($event['utimestamp'] === $control_timestamp) { - $count++; - } else { - $control_timestamp = $event['utimestamp']; - $count = 1; + + if ($show_all_data === true) { + foreach ($events as $event) { + if ($event['utimestamp'] === $control_timestamp) { + $count++; + } else { + $control_timestamp = $event['utimestamp']; + $count = 1; + } + + $data_events[$control_timestamp] = $count; } - $data_events[$control_timestamp] = $count; - } + $data_events = array_reverse($data_events, true); - $data_events = array_reverse($data_events, true); - foreach ($data_events as $utimestamp => $count) { - $labels[] = date($chart_time_format, $utimestamp); - $chart[] = [ - 'y' => $count, - 'x' => date($chart_time_format, $utimestamp), - ]; - $color[] = '#82b92f'; + foreach ($data_events as $utimestamp => $count) { + $labels[] = date($chart_time_format, $utimestamp); + $chart[] = [ + 'y' => $count, + 'x' => date($chart_time_format, $utimestamp), + ]; + $color[] = '#82b92f'; + } + } else { + $interval_length = (int) ($period / $num_intervals); + $intervals = []; + $intervals[0] = $start_utimestamp; + for ($i = 0; $i < $num_intervals; $i++) { + $intervals[($i + 1)] = ($intervals[$i] + $interval_length); + } + + $control_data = []; + + foreach ($data_events as $utimestamp => $count_event) { + for ($i = 0; $i < $num_intervals; $i++) { + if ((int) $utimestamp > (int) $intervals[$i] && (int) $utimestamp < (int) $intervals[($i + 1)]) { + $control_data[(string) $intervals[$i]] += $count_event; + } + } + } + + for ($i = 0; $i < $num_intervals; $i++) { + $labels[] = date($chart_time_format, $intervals[$i]); + $chart[] = [ + 'y' => $control_data[$intervals[$i]], + 'x' => date($chart_time_format, $intervals[$i]), + ]; + $color[] = '#82b92f'; + } } $water_mark = [ From 6312804386f9624248f844983297d9cd96e12fce Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 5 Oct 2023 09:52:52 +0200 Subject: [PATCH 035/108] #12153 Fix graph height --- pandora_console/include/functions_events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 8e2896c448..bd54d61623 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -6207,7 +6207,7 @@ function event_get_counter_extraId(array $event, ?array $filters) function event_print_graph( $filter, - $graph_height=400, + $graph_height=100, ) { global $config; $show_all_data = false; From c20ca271ba430de34e7917fdbfd870a4afaf8b4a Mon Sep 17 00:00:00 2001 From: daniel Date: Fri, 6 Oct 2023 13:05:42 +0200 Subject: [PATCH 036/108] fix translate pandora_enterprise#11760 --- pandora_console/include/lib/Dashboard/Widgets/events_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index 7e050d3ee8..3706c33d5e 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -396,7 +396,7 @@ class EventsListWidget extends Widget 0 => \__('Only pending'), 2 => \__('Only in process'), 3 => \__('Only not validated'), - 4 => \__('Only not process'), + 4 => \__('Only not in process'), ]; $inputs['inputs']['row1'][] = [ From 049e25f866d62388573997b5238f9cea7fd9cf41 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 6 Oct 2023 13:51:18 +0200 Subject: [PATCH 037/108] #8686 Add filter in managemnet tree group --- pandora_console/godmode/groups/group_list.php | 307 +++++++++++++----- pandora_console/include/ajax/tree.ajax.php | 2 + .../include/class/TreeGroupEdition.class.php | 148 +++++++-- pandora_console/include/functions_agents.php | 21 ++ 4 files changed, 373 insertions(+), 105 deletions(-) diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 00bbdddb39..201d3cea4e 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -757,6 +757,125 @@ if ($tab == 'tree') { /* * Group tree view. */ + + $table = new stdClass(); + $table->width = '100%'; + $table->class = 'databox filters filter-table-adv'; + if (is_metaconsole() === true) { + $table->cellspacing = 0; + $table->cellpadding = 0; + } + + $search_group_string = get_parameter('search_group_string', ''); + $search_agent_string = get_parameter('search_agent_string', ''); + $agent_status = get_parameter('agent_status', ''); + $show_not_init_agents = get_parameter('show_not_init_agents', 1); + $show_not_init_modules = get_parameter('show_not_init_modules', 1); + $show_full_hirearchy = get_parameter('show_full_hirearchy', 1); + + + $table->data = []; + $table->head = []; + $table->style = []; + + $table->style[0] = 'width: 50%;'; + $table->style[1] = 'width: 50%;'; + + $table->data[0][0] = html_print_label_input_block( + __('Search group'), + html_print_input_text( + 'search_group_string', + $search_group_string, + '', + 25, + 255, + true, + false, + false, + '', + ) + ); + + $agents_status_list = agents_status_list(); + + $table->data[0][1] = html_print_label_input_block( + __('Search by agent status').ui_print_help_tip(__('Shows the groups that contain an agent with the status that has been searched'), true), + html_print_select( + $agents_status_list, + 'agent_status', + $agent_status, + '', + __('All'), + '', + true, + false, + false, + 'w200p', + false, + 'width: 100%;' + ) + ); + + $table->data[1][0] = html_print_label_input_block( + __('Search by agent').ui_print_help_tip(__('Shows groups that contain an agent matching the search'), true), + html_print_input_text( + 'search_agent_string', + $search_agent_string, + '', + 25, + 255, + true, + false, + false, + '', + ) + ); + + $table->data[1][1] = html_print_label_input_block( + __('Show full hierarchy'), + html_print_checkbox_switch_extended( + 'show_full_hirearchy', + 1, + $show_full_hirearchy, + false, + '', + '', + true + ) + ); + + $table->data[3][0] = ' '; + + $table->data[3][1] = html_print_submit_button( + __('Filter'), + 'filter', + false, + [ + 'class' => 'float-right', + 'icon' => 'search', + ], + true + ); + + $form = "
"; + $form .= html_print_table($table, true); + $form .= '
'; + + + + ui_toggle( + $form, + ''.__('Filters').'', + 'filter_form', + '', + true, + false, + '', + 'white-box-content', + 'box-flat white_table_graph fixed_filter_bar' + ); + + echo "
"; } else { /* @@ -826,6 +945,8 @@ if ($tab == 'tree') { ); $form .= ''; + + ui_toggle( $form, ''.__('Filters').'', @@ -1058,87 +1179,119 @@ $tab = 'group_edition'; diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 319b98e168..600b30e74d 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -59,6 +59,7 @@ if (is_ajax() === true) { $metaID = (int) get_parameter('metaID', 0); $childrenMethod = get_parameter('childrenMethod', 'on_demand'); + $default_filters = [ 'searchAgent' => '', 'statusAgent' => AGENT_STATUS_ALL, @@ -69,6 +70,7 @@ if (is_ajax() === true) { ]; $filter = get_parameter('filter', $default_filters); + $agent_a = check_acl($config['id_user'], 0, 'AR'); $agent_w = check_acl($config['id_user'], 0, 'AW'); $access = ($agent_a === true) ? 'AR' : (($agent_w === true) ? 'AW' : 'AR'); diff --git a/pandora_console/include/class/TreeGroupEdition.class.php b/pandora_console/include/class/TreeGroupEdition.class.php index 4071266a58..48a103c724 100644 --- a/pandora_console/include/class/TreeGroupEdition.class.php +++ b/pandora_console/include/class/TreeGroupEdition.class.php @@ -106,20 +106,24 @@ class TreeGroupEdition extends TreeGroup } // Build the group hierarchy. - foreach ($groups as $id => $group) { - if (isset($groups[$id]['parent']) === true - && ($groups[$id]['parent'] != 0) - ) { - $parent = $groups[$id]['parent']; - // Parent exists. - if (isset($groups[$parent]['children']) === false) { - $groups[$parent]['children'] = []; - } + if (isset($this->filter['show_full_hirearchy']) === false + || (isset($this->filter['show_full_hirearchy']) === true && (bool) $this->filter['show_full_hirearchy'] === true) + ) { + foreach ($groups as $id => $group) { + if (isset($groups[$id]['parent']) === true + && ($groups[$id]['parent'] != 0) + ) { + $parent = $groups[$id]['parent']; + // Parent exists. + if (isset($groups[$parent]['children']) === false) { + $groups[$parent]['children'] = []; + } - // Store a reference to the group into the parent. - $groups[$parent]['children'][] = &$groups[$id]; - // This group was introduced into a parent. - $groups[$id]['have_parent'] = true; + // Store a reference to the group into the parent. + $groups[$parent]['children'][] = &$groups[$id]; + // This group was introduced into a parent. + $groups[$id]['have_parent'] = true; + } } } @@ -167,24 +171,112 @@ class TreeGroupEdition extends TreeGroup ]; $group_acl = ''; - if (users_can_manage_group_all('AR') === false) { - $user_groups_str = implode(',', $this->userGroupsArray); - $group_acl = sprintf( - 'AND id_grupo IN (%s)', - $user_groups_str + $search_agent = ''; + $status_agent = ''; + $inner_agent = ''; + + if ((bool) is_metaconsole() === true) { + if (users_can_manage_group_all('AR') === false) { + $user_groups_str = implode(',', $this->userGroupsArray); + $group_acl = sprintf( + ' AND tgrupo.id_grupo IN (%s) ', + $user_groups_str + ); + } + + if (isset($this->filter['searchAgent']) === true && empty($this->filter['searchAgent']) === false + || isset($this->filter['statusAgent']) === true && strlen($this->filter['statusAgent']) > 0 + ) { + $inner_agent = 'INNER JOIN tmetaconsole_agent ON tgrupo.id_grupo = tmetaconsole_agent.id_grupo'; + } + + if (isset($this->filter['searchAgent']) === true && empty($this->filter['searchAgent']) === false) { + $search_agent = ' AND tmetaconsole_agent.alias LIKE "%'.$this->filter['searchAgent'].'%" '; + } + + if (isset($this->filter['statusAgent']) === true && strlen($this->filter['statusAgent']) > 0) { + switch ($this->filter['statusAgent']) { + case AGENT_STATUS_NORMAL: + $status_agent = ' AND ( + tmetaconsole_agent.critical_count = 0 + AND tmetaconsole_agent.warning_count = 0 + AND tmetaconsole_agent.unknown_count = 0 + AND tmetaconsole_agent.normal_count > 0)'; + break; + + case AGENT_STATUS_WARNING: + $status_agent = ' AND ( + tmetaconsole_agent.critical_count = 0 + AND tmetaconsole_agent.warning_count > 0 + AND tmetaconsole_agent.total_count > 0)'; + break; + + case AGENT_STATUS_CRITICAL: + $status_agent = ' AND tmetaconsole_agent.critical_count > 0'; + break; + + case AGENT_STATUS_UNKNOWN: + $status_agent = ' AND ( + tmetaconsole_agent.critical_count = 0 + AND tmetaconsole_agent.warning_count = 0 + AND tmetaconsole_agent.unknown_count > 0)'; + break; + + case AGENT_STATUS_NOT_NORMAL: + $status_agent = ' AND ( + tmetaconsole_agent.normal_count <> total_count + OR tmetaconsole_agent.total_count = notinit_count)'; + break; + + case AGENT_STATUS_NOT_INIT: + $status_agent = ' AND ( + tmetaconsole_agent.total_count = 0 + OR tmetaconsole_agent.total_count = notinit_count)'; + break; + + default: + // Nothing to do. + break; + } + } + + $sql = sprintf( + 'SELECT tgrupo.id_grupo AS gid, + tgrupo.nombre as name, + tgrupo.parent, + tgrupo.icon + FROM tgrupo + %s + WHERE 1=1 + %s + %s + %s ', + $inner_agent, + $search_agent, + $status_agent, + $group_acl + ); + } else { + if (users_can_manage_group_all('AR') === false) { + $user_groups_str = implode(',', $this->userGroupsArray); + $group_acl = sprintf( + 'AND id_grupo IN (%s)', + $user_groups_str + ); + } + + $sql = sprintf( + 'SELECT id_grupo AS gid, + nombre as name, + parent, + icon + FROM tgrupo + WHERE 1=1 + %s ', + $group_acl ); } - $sql = sprintf( - 'SELECT id_grupo AS gid, - nombre as name, - parent, - icon - FROM tgrupo - WHERE 1=1 %s', - $group_acl - ); - $stats = db_get_all_rows_sql($sql); $group_stats = []; foreach ($stats as $group) { diff --git a/pandora_console/include/functions_agents.php b/pandora_console/include/functions_agents.php index 720b0e6e55..f7457b3d3c 100644 --- a/pandora_console/include/functions_agents.php +++ b/pandora_console/include/functions_agents.php @@ -4856,4 +4856,25 @@ function get_resume_agent_concat($id_agente, $all_groups, $agent) $agent_contact .= html_print_table($table_contact, true); return $agent_contact; +} + + +/** + * Return an array with a list of status agents + * + * @return array. + */ + + +function agents_status_list() +{ + $status_list = []; + $status_list[AGENT_STATUS_NORMAL] = __('Normal'); + $status_list[AGENT_STATUS_WARNING] = __('Warning'); + $status_list[AGENT_STATUS_CRITICAL] = __('Critical'); + $status_list[AGENT_STATUS_UNKNOWN] = __('Unknown'); + $status_list[AGENT_STATUS_NOT_NORMAL] = __('Not normal'); + $status_list[AGENT_STATUS_NOT_INIT] = __('Not init'); + + return $status_list; } \ No newline at end of file From 041a13cb49ee75353fcf9dc304b350f18cc77643 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 9 Oct 2023 16:03:04 +0200 Subject: [PATCH 038/108] #12206 User password change limitation to local --- pandora_console/general/login_page.php | 2 +- .../godmode/users/configure_user.php | 116 +++++++++--------- 2 files changed, 61 insertions(+), 57 deletions(-) diff --git a/pandora_console/general/login_page.php b/pandora_console/general/login_page.php index e18d278ac8..bbc499661f 100755 --- a/pandora_console/general/login_page.php +++ b/pandora_console/general/login_page.php @@ -418,7 +418,7 @@ switch ($login_screen) { } if ($config['enterprise_installed']) { - if ($config['reset_pass_option']) { + if ($config['reset_pass_option'] && $config['auth'] === 'mysql') { $reset_pass_link = 'reset_pass.php'; // Reset password link. echo '
'; diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 08040f839c..e4edb3765e 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -688,23 +688,55 @@ if ($update_user) { $id_user = (string) get_parameter('id_user', ''); if ($password_new != '') { - $correct_password = false; + if ($config['auth'] !== 'mysql') { + ui_print_error_message(__('It is not possible to change the password because external authentication is being used')); + } else { + $correct_password = false; - $user_credentials_check = process_user_login($id_user, $own_password_confirm, true); + $user_credentials_check = process_user_login($id_user, $own_password_confirm, true); - if ($user_credentials_check !== false) { - $correct_password = true; - } + if ($user_credentials_check !== false) { + $correct_password = true; + } - if ((string) $password_confirm === (string) $password_new) { - if ($correct_password === true || is_user_admin($config['id_user'])) { - if ((is_user_admin($config['id_user']) === false || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) { - $pass_ok = login_validate_pass($password_new, $id, true); - if ($pass_ok != 1) { - ui_print_error_message($pass_ok); + if ((string) $password_confirm === (string) $password_new) { + if ($correct_password === true || is_user_admin($config['id_user'])) { + if ((is_user_admin($config['id_user']) === false || $config['enable_pass_policy_admin']) && $config['enable_pass_policy']) { + $pass_ok = login_validate_pass($password_new, $id, true); + if ($pass_ok != 1) { + ui_print_error_message($pass_ok); + } else { + $res2 = update_user_password($id, $password_new); + if ($res2) { + db_process_sql_insert( + 'tsesion', + [ + 'id_sesion' => '', + 'id_usuario' => $id, + 'ip_origen' => $_SERVER['REMOTE_ADDR'], + 'accion' => 'Password change', + 'descripcion' => 'Access password updated', + 'fecha' => date('Y-m-d H:i:s'), + 'utimestamp' => time(), + ] + ); + $res3 = save_pass_history($id, $password_new); + + // Generate new API token. + $newToken = api_token_generate(); + $res4 = update_user($id, ['api_token' => $newToken]); + } + + ui_print_result_message( + $res1 || $res2, + __('User info successfully updated'), + __('Error updating user info (no change?)') + ); + } } else { $res2 = update_user_password($id, $password_new); if ($res2) { + $res3 = save_pass_history($id, $password_new); db_process_sql_insert( 'tsesion', [ @@ -717,7 +749,6 @@ if ($update_user) { 'utimestamp' => time(), ] ); - $res3 = save_pass_history($id, $password_new); // Generate new API token. $newToken = api_token_generate(); @@ -731,54 +762,27 @@ if ($update_user) { ); } } else { - $res2 = update_user_password($id, $password_new); - if ($res2) { - $res3 = save_pass_history($id, $password_new); - db_process_sql_insert( - 'tsesion', - [ - 'id_sesion' => '', - 'id_usuario' => $id, - 'ip_origen' => $_SERVER['REMOTE_ADDR'], - 'accion' => 'Password change', - 'descripcion' => 'Access password updated', - 'fecha' => date('Y-m-d H:i:s'), - 'utimestamp' => time(), - ] - ); - - // Generate new API token. - $newToken = api_token_generate(); - $res4 = update_user($id, ['api_token' => $newToken]); + if ($own_password_confirm === '') { + ui_print_error_message(__('Password of the active user is required to perform password change')); + } else { + ui_print_error_message(__('Password of active user is not correct')); } - - ui_print_result_message( - $res1 || $res2, - __('User info successfully updated'), - __('Error updating user info (no change?)') - ); } } else { - if ($own_password_confirm === '') { - ui_print_error_message(__('Password of the active user is required to perform password change')); - } else { - ui_print_error_message(__('Password of active user is not correct')); - } + db_process_sql_insert( + 'tsesion', + [ + 'id_sesion' => '', + 'id_usuario' => $id, + 'ip_origen' => $_SERVER['REMOTE_ADDR'], + 'accion' => 'Password change', + 'descripcion' => 'Access password update failed', + 'fecha' => date('Y-m-d H:i:s'), + 'utimestamp' => time(), + ] + ); + ui_print_error_message(__('Passwords does not match')); } - } else { - db_process_sql_insert( - 'tsesion', - [ - 'id_sesion' => '', - 'id_usuario' => $id, - 'ip_origen' => $_SERVER['REMOTE_ADDR'], - 'accion' => 'Password change', - 'descripcion' => 'Access password update failed', - 'fecha' => date('Y-m-d H:i:s'), - 'utimestamp' => time(), - ] - ); - ui_print_error_message(__('Passwords does not match')); } } else { $has_skin = false; From 3a2b56cc4c171616d626362812a707f6494c9d5f Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 10 Oct 2023 16:50:42 +0200 Subject: [PATCH 039/108] #12204 Fix force check icon --- pandora_console/include/ajax/module.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 78daacb0a0..3c65200ae6 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1354,10 +1354,12 @@ if (check_login()) { $additionalLinkAction = '&flag=1'; $linkCaption = __('Force checks'); $imgaction = 'images/force@svg.svg'; + $visibility = ''; } else { $additionalLinkAction = ''; $linkCaption = __('Refresh'); $imgaction = 'images/go-back@svg.svg'; + $visibility = 'visibility: initial;'; } $moduleActionButtons[] = html_print_anchor( @@ -1369,6 +1371,7 @@ if (check_login()) { [ 'title' => __('Force remote check'), 'class' => 'main_menu_icon forced_title', + 'style' => $visibility, ] ), ], From a8713264e289f4e746ef1e7ce460f81a5da9233e Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Wed, 11 Oct 2023 09:55:44 +0200 Subject: [PATCH 040/108] #10807 fixed GIS MAP creation/editing view styles --- .../godmode/gis_maps/configure_gis_map.php | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/pandora_console/godmode/gis_maps/configure_gis_map.php b/pandora_console/godmode/gis_maps/configure_gis_map.php index a6f282d2cf..f3f7d06d21 100644 --- a/pandora_console/godmode/gis_maps/configure_gis_map.php +++ b/pandora_console/godmode/gis_maps/configure_gis_map.php @@ -560,21 +560,23 @@ html_print_table($table); $user_groups = users_get_groups($config['user'], 'AR', false); -echo '

'.__('Layers').'

'; +echo '
'.__('Layers').''; $table->width = '100%'; $table->class = 'databox filters'; $table->valign = []; -$table->valign[0] = 'top'; -$table->valign[1] = 'top'; +$table->valign[0] = 'top; width: 50%'; +$table->valign[1] = 'top; width: 50%'; $table->data = []; $table->data[0][0] = '

'.__('List of layers').'

'; $table->data[0][1] = '
'.html_print_button(__('New layer'), 'new_layer', false, 'newLayer();', 'class="sub add "', true).'
'; -$table->data[1][0] = '
'; -$table->data[1][1] = '
'; switch ($action) { case 'save_new': @@ -1229,6 +1233,8 @@ function getLayerRow (layerId, layerData) { .append($editCol) .append($deleteCol); + $("#list_layers").removeClass('invisible'); + return $row; } From 3e20ff7eaad11e8a8e19c4eef0bdc05a5a856b8c Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 11 Oct 2023 09:59:26 +0200 Subject: [PATCH 041/108] #12218 Fix show hide password button --- pandora_console/godmode/users/user_management.php | 12 +++++++----- pandora_console/include/styles/pandora.css | 8 +++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index 6d5f9bf18b..167b7756ce 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -266,7 +266,7 @@ $passwordManageTable->data = []; $passwordManageTable->data['captions_newpassword'][0] = __('New password'); $passwordManageTable->rowclass['fields_newpassword'] = 'w540px'; -$passwordManageTable->data['fields_newpassword'][0] = html_print_input_text_extended( +$passwordManageTable->data['fields_newpassword'][0] = '
'.html_print_input_text_extended( 'password_new', '', 'password_new', @@ -276,16 +276,17 @@ $passwordManageTable->data['fields_newpassword'][0] = html_print_input_text_exte $view_mode, '', [ - 'class' => 'input w100p', + 'class' => 'input', 'placeholder' => __('Password'), + 'style' => 'width: 540px', ], true, true -); +).'
'; $passwordManageTable->data['captions_repeatpassword'][0] = __('Repeat new password'); $passwordManageTable->rowclass['fields_repeatpassword'] = 'w540px'; -$passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_extended( +$passwordManageTable->data['fields_repeatpassword'][0] = '
'.html_print_input_text_extended( 'password_confirm', '', 'password_conf', @@ -297,10 +298,11 @@ $passwordManageTable->data['fields_repeatpassword'][0] = html_print_input_text_e [ 'class' => 'input w100p', 'placeholder' => __('Password confirmation'), + 'style' => 'width: 540px', ], true, true -); +).'
'; if ($new_user === false && users_is_admin() === false) { $passwordManageTable->data['captions_currentpassword'][0] = __('Current password'); diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 45cacafb6b..fe6f22b23b 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -11763,16 +11763,14 @@ p.trademark-copyright { } .show-hide-pass { - position: absolute; - right: 9px; - top: 4px; + position: fixed; border: 0; outline: none; - margin: 0; + margin-left: -50px; height: 30px; width: 40px; cursor: pointer; - display: inline-block; + display: initial; } .show-hide-pass-background { From 6793086c855ce7cf90e8cc6fed0c9b738fbb393c Mon Sep 17 00:00:00 2001 From: Rafael Date: Wed, 11 Oct 2023 12:37:37 +0200 Subject: [PATCH 042/108] 12101 adding pandora_gotty --- .../pandora_deploy_community.sh | 33 +++++++-------- .../pandora_deploy_community_el8.sh | 41 ++++++++++--------- .../pandora_deploy_community_ubuntu_2204.sh | 4 ++ 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/extras/deploy-scripts/pandora_deploy_community.sh b/extras/deploy-scripts/pandora_deploy_community.sh index e99843b059..24d714daea 100644 --- a/extras/deploy-scripts/pandora_deploy_community.sh +++ b/extras/deploy-scripts/pandora_deploy_community.sh @@ -11,7 +11,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf -S_VERSION='2023062901' +S_VERSION='2023101101' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" # define default variables @@ -185,7 +185,7 @@ extra_repos=" \ tar \ yum-utils \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ -http://rpms.remirepo.net/enterprise/remi-release-7.rpm \ +https://rpms.remirepo.net/enterprise/remi-release-7.rpm \ https://repo.percona.com/yum/percona-release-latest.noarch.rpm" execute_cmd "yum install -y $extra_repos" "Installing extra repositories" @@ -285,6 +285,7 @@ console_dependencies=" \ mod_ssl \ libzstd \ openldap-clients \ + https://firefly.pandorafms.com/centos8/pandora_gotty-1.0-1.el8.x86_64.rpm \ chromium" execute_cmd "yum install -y $console_dependencies" "Installing Pandora FMS Console dependencies" @@ -312,7 +313,7 @@ server_dependencies=" \ bind-utils \ whois \ cpanminus \ - http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ + https://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ https://firefly.pandorafms.com/centos7/pandorawmic-1.0.0-1.x86_64.rpm" execute_cmd "yum install -y $server_dependencies" "Installing Pandora FMS Server dependencies" @@ -322,13 +323,13 @@ execute_cmd "cpanm -i Thread::Semaphore" "Installing Thread::Semaphore" # SDK VMware perl dependencies vmware_dependencies=" \ - http://firefly.pandorafms.com/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ + https://firefly.pandorafms.com/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm \ perl-JSON \ perl-Archive-Zip \ openssl-devel \ perl-Crypt-CBC \ perl-Digest-SHA \ - http://firefly.pandorafms.com/centos7/perl-Crypt-OpenSSL-AES-0.02-1.el7.x86_64.rpm" + https://firefly.pandorafms.com/centos7/perl-Crypt-OpenSSL-AES-0.02-1.el7.x86_64.rpm" execute_cmd "yum install -y $vmware_dependencies" "Installing SDK VMware perl dependencies" # Instant client Oracle @@ -410,7 +411,7 @@ skip-character-set-client-handshake # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Mysql optimizations for Pandora FMS -# Please check the documentation in http://pandorafms.com for better results +# Please check the documentation in https://pandorafms.com for better results max_allowed_packet = 64M innodb_buffer_pool_size = $POOL_SIZE @@ -461,20 +462,20 @@ export MYSQL_PWD=$DBPASS #Define packages #Define packages if [ "$PANDORA_LTS" -eq '1' ] ; then - [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm" - [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm" - [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm" + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm" elif [ "$PANDORA_LTS" -ne '1' ] ; then - [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" - [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm" - [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" fi # if beta is enable if [ "$PANDORA_BETA" -eq '1' ] ; then - PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" - PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm" - PANDORA_AGENT_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" + PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" + PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm" + PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" fi # Downloading Pandora Packages @@ -729,7 +730,7 @@ Welcome to Pandora FMS appliance on CentOS Go to Public http://$ipplublic/pandora_console to login web console $(ip addr | grep -w "inet" | grep -v "127.0.0.1" | grep -v "172.17.0.1" | awk '{print $2}' | awk -F '/' '{print "Go to Local http://"$1"/pandora_console to login web console"}') -You can find more information at http://pandorafms.com +You can find more information at https://pandorafms.com EOF_banner diff --git a/extras/deploy-scripts/pandora_deploy_community_el8.sh b/extras/deploy-scripts/pandora_deploy_community_el8.sh index ad51db0ec6..e1be9519f0 100644 --- a/extras/deploy-scripts/pandora_deploy_community_el8.sh +++ b/extras/deploy-scripts/pandora_deploy_community_el8.sh @@ -14,7 +14,7 @@ PANDORA_SERVER_CONF=/etc/pandora/pandora_server.conf PANDORA_AGENT_CONF=/etc/pandora/pandora_agent.conf -S_VERSION='2023062901' +S_VERSION='2023101101' LOGFILE="/tmp/pandora-deploy-community-$(date +%F).log" # define default variables @@ -264,7 +264,7 @@ if [ "$(grep -Ei 'Red Hat Enterprise' /etc/redhat-release)" ]; then tar \ dnf-utils \ https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \ - http://rpms.remirepo.net/enterprise/remi-release-8.rpm \ + https://rpms.remirepo.net/enterprise/remi-release-8.rpm \ https://repo.percona.com/yum/percona-release-latest.noarch.rpm" execute_cmd "dnf install -y $extra_repos" "Installing extra repositories" @@ -275,7 +275,7 @@ else tar \ dnf-utils \ epel-release \ - http://rpms.remirepo.net/enterprise/remi-release-8.rpm \ + https://rpms.remirepo.net/enterprise/remi-release-8.rpm \ https://repo.percona.com/yum/percona-release-latest.noarch.rpm" execute_cmd "dnf install -y $extra_repos" "Installing extra repositories" @@ -391,10 +391,11 @@ console_dependencies=" \ mod_ssl \ libzstd \ openldap-clients \ - http://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \ - http://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \ - http://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ - http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm" + https://firefly.pandorafms.com/centos8/chromium-110.0.5481.177-1.el7.x86_64.rpm \ + https://firefly.pandorafms.com/centos8/chromium-common-110.0.5481.177-1.el7.x86_64.rpm \ + https://firefly.pandorafms.com/centos8/perl-Net-Telnet-3.04-1.el8.noarch.rpm \ + https://firefly.pandorafms.com/centos8/pandora_gotty-1.0-1.el8.x86_64.rpm \ + https://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm" execute_cmd "dnf install -y $console_dependencies" "Installing Pandora FMS Console dependencies" # Server dependencies @@ -421,7 +422,7 @@ server_dependencies=" \ bind-utils \ whois \ libnsl \ - http://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ + https://firefly.pandorafms.com/centos7/wmic-1.4-1.el7.x86_64.rpm \ https://firefly.pandorafms.com/centos8/pandorawmic-1.0.0-1.x86_64.rpm" execute_cmd "dnf install -y $server_dependencies" "Installing Pandora FMS Server dependencies" @@ -436,8 +437,8 @@ vmware_dependencies=" \ perl-Math-Random-ISAAC \ perl-JSON \ perl-Crypt-SSLeay \ - http://firefly.pandorafms.com/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm \ - http://firefly.pandorafms.com/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm" + https://firefly.pandorafms.com/centos8/perl-Crypt-OpenSSL-AES-0.02-1.el8.x86_64.rpm \ + https://firefly.pandorafms.com/centos8/VMware-vSphere-Perl-SDK-6.5.0-4566394.x86_64.rpm" execute_cmd "dnf install -y $vmware_dependencies" "Installing SDK VMware perl dependencies" # Instant client Oracle @@ -518,7 +519,7 @@ skip-character-set-client-handshake # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Mysql optimizations for Pandora FMS -# Please check the documentation in http://pandorafms.com for better results +# Please check the documentation in https://pandorafms.com for better results max_allowed_packet = 64M innodb_buffer_pool_size = $POOL_SIZE @@ -567,20 +568,20 @@ export MYSQL_PWD=$DBPASS #Define packages if [ "$PANDORA_LTS" -eq '1' ] ; then - [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm" - [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm" - [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm" + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_server-7.0NG.noarch.rpm" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_console-7.0NG.noarch.rpm" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/LTS/pandorafms_agent_linux-7.0NG.noarch.rpm" elif [ "$PANDORA_LTS" -ne '1' ] ; then - [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" - [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm" - [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" + [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" + [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" fi # if beta is enable if [ "$PANDORA_BETA" -eq '1' ] ; then - PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" - PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm" - PANDORA_AGENT_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" + PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" + PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm" + PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" fi # Downloading Pandora Packages diff --git a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh index a215808d17..e927526913 100644 --- a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh +++ b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh @@ -344,6 +344,10 @@ execute_cmd "apt install -y $server_dependencies" "Installing Pandora FMS Server execute_cmd "installing_docker" "Installing Docker for debug" +# Installing pandora_gotty +execute_cmd "curl --output pandora_gotty.deb https://firefly.pandorafms.com/ubuntu/pandora_gotty_1.0.0.deb" "Downloading pandora_gotty" +execute_cmd "apt install -y ./pandora_gotty.deb" "Intalling pandora_gotty" + # wmic and pandorawmic execute_cmd "curl -O https://firefly.pandorafms.com/pandorafms/utils/bin/wmic" "Downloading wmic" execute_cmd "curl -O https://firefly.pandorafms.com/pandorafms/utils/bin/pandorawmic" "Downloading pandorawmic" From 65c7738bca3a0526cdd6e45cf951c66487dac463 Mon Sep 17 00:00:00 2001 From: Rafael Date: Wed, 11 Oct 2023 15:46:42 +0200 Subject: [PATCH 043/108] 12101 fix url for open server --- extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh index e927526913..ca7ccf757e 100644 --- a/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh +++ b/extras/deploy-scripts/pandora_deploy_community_ubuntu_2204.sh @@ -526,7 +526,7 @@ elif [ "$PANDORA_LTS" -ne '1' ] ; then fi if [ "$PANDORA_BETA" -eq '1' ] ; then - PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest_x86_64.tar.gz" + PANDORA_SERVER_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.tar.gz" PANDORA_CONSOLE_PACKAGE="http://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.tar.gz" PANDORA_AGENT_PACKAGE="http://firefly.pandorafms.com/pandorafms/latest/Tarball/pandorafms_agent_linux-7.0NG.tar.gz" fi From 2062169f2f26f9e7b81f42f647558f60cc36d879 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 13 Oct 2023 12:55:58 +0200 Subject: [PATCH 044/108] #12177 Fix upload os icon --- pandora_console/godmode/setup/os.builder.php | 52 +++++++++++++++++--- pandora_console/godmode/setup/os.php | 8 ++- pandora_console/include/functions_html.php | 4 +- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/pandora_console/godmode/setup/os.builder.php b/pandora_console/godmode/setup/os.builder.php index d8a2f47d00..0a8c23a08d 100644 --- a/pandora_console/godmode/setup/os.builder.php +++ b/pandora_console/godmode/setup/os.builder.php @@ -46,7 +46,7 @@ if ($idOS > 0) { $description = $os['description']; $icon = $os['icon_name']; } else { - $name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name')))); + $name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name'))))); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description')))); $icon = get_parameter('icon', 0); } @@ -87,9 +87,16 @@ if ($is_management_allowed === true) { if (in_array($file_ext, $allowed_extensions) === false) { $message = 9; + } else if (exif_imagetype($file_tmp) === false && $file_ext !== 'svg') { + $message = 10; } else { $message = 8; - move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name); + + $file_uploaded = move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name); + + if ($file_uploaded !== true) { + $message = 10; + } } } } else { @@ -108,7 +115,7 @@ if ($is_management_allowed === true) { if ($resultOrId === false) { $message = 2; - $tab = 'builder'; + $tab = 'manage_os'; $actionHidden = 'save'; $textButton = __('Create'); $classButton = ['icon' => 'wand']; @@ -144,13 +151,19 @@ if ($is_management_allowed === true) { if (in_array($file_ext, $allowed_extensions) === false) { $message = 9; + } else if (exif_imagetype($file_tmp) === false) { + $message = 10; } else { $message = 8; - move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name); + $file_uploaded = move_uploaded_file($file_tmp, $config['homedir'].'/images/os_icons/'.$file_name); + + if ($file_uploaded !== true) { + $message = 10; + } } } } else { - $name = io_safe_input(strip_tags(io_safe_output((string) get_parameter('name')))); + $name = io_safe_input(strip_tags(trim(io_safe_output((string) get_parameter('name'))))); $description = io_safe_input(strip_tags(io_safe_output((string) get_parameter('description')))); $icon = get_parameter('icon', 0); @@ -254,7 +267,7 @@ $table->class = 'databox filter-table-adv'; $table->data[0][] = html_print_label_input_block( __('Name'), - html_print_input_text('name', $name, __('Name'), 20, 30, true, false, false, '', 'w250px') + html_print_input_text('name', $name, __('Name'), 20, 30, true, false, true, '', 'w250px') ); $table->data[0][] = html_print_label_input_block( @@ -290,6 +303,33 @@ html_print_action_buttons( echo ''; +$id_message = get_parameter('id_message', 0); + +if ($id_message !== 0) { + switch ($id_message) { + case 8: + echo ui_print_success_message(__('Icon successfuly uploaded'), '', true); + break; + + case 9: + echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true); + break; + + case 9: + echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true); + break; + + case 10: + echo ui_print_error_message(__('An error ocurrered to load icon'), '', true); + break; + + default: + // Nothing to do. + break; + } +} + + function get_list_os_icons_dir() { global $config; diff --git a/pandora_console/godmode/setup/os.php b/pandora_console/godmode/setup/os.php index 99402ff30a..dcfe95ecdb 100644 --- a/pandora_console/godmode/setup/os.php +++ b/pandora_console/godmode/setup/os.php @@ -162,11 +162,15 @@ if (empty($id_message) === false) { break; case 8: - echo ui_print_success_message(__('Icon successfuly uploaded'), '', true); + header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=8'); break; case 9: - echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true); + header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=9'); + break; + + case 10: + header('Location: index.php?sec=gagente&sec2=godmode/setup/os&tab=manage_os&action=edit&id_message=10'); break; default: diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 2552fbcdc1..2dac62a3ee 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4939,8 +4939,8 @@ function html_print_input_file($name, $return=false, $options=false, $inline_upl $inline_upload_anchor_to_form ), [ - 'mode' => 'link', - 'style' => 'min-width: initial;', + 'class' => 'secondary', + 'style' => 'min-width: initial; position: relative; margin-left: 5%; ', ], true, ); From 35efc20fc78aa9c93de7ad95a827e12d894668ab Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 13 Oct 2023 12:58:21 +0200 Subject: [PATCH 045/108] #12177 Fix message --- pandora_console/godmode/setup/os.builder.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pandora_console/godmode/setup/os.builder.php b/pandora_console/godmode/setup/os.builder.php index 0a8c23a08d..6313aa3edd 100644 --- a/pandora_console/godmode/setup/os.builder.php +++ b/pandora_console/godmode/setup/os.builder.php @@ -315,12 +315,8 @@ if ($id_message !== 0) { echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true); break; - case 9: - echo ui_print_error_message(__('File must be of type JPG, JPEG, PNG or SVG'), '', true); - break; - case 10: - echo ui_print_error_message(__('An error ocurrered to load icon'), '', true); + echo ui_print_error_message(__('An error ocurrered to upload icon'), '', true); break; default: From 1c609374a83becb228e92bd716704d2579c153e4 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 17 Oct 2023 09:27:53 +0200 Subject: [PATCH 046/108] #12134 Count total modules --- pandora_console/operation/agentes/status_monitor.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/operation/agentes/status_monitor.php b/pandora_console/operation/agentes/status_monitor.php index 046fbc5222..825fbb01df 100644 --- a/pandora_console/operation/agentes/status_monitor.php +++ b/pandora_console/operation/agentes/status_monitor.php @@ -2348,6 +2348,7 @@ if (empty($result) === false) { array_push($table->data, $data); } + echo '
'.sprintf(__('Total items: %s'), $count).'
'; html_print_table($table); if ($count_modules > $config['block_size']) { From 19abe5f0f6340e3547c9f8345eee5f2553b57a49 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 17 Oct 2023 16:35:58 +0200 Subject: [PATCH 047/108] #9761 remove lines "logstash" --- pandora_console/include/class/ConsoleSupervisor.php | 9 --------- pandora_console/include/functions_notifications.php | 1 - 2 files changed, 10 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index b4320b1a4d..25e298e520 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -394,15 +394,6 @@ class ConsoleSupervisor $this->checkPandoraHistoryDB(); - /* - * Check pandoradb running in main DB. - * Check pandoradb running in historical DB. - * NOTIF.PANDORADB - * NOTIF.PANDORADB.HISTORICAL - */ - - $this->checkPandoraDBMaintenance(); - /* * Check historical DB MR version. * NOTIF.HISTORYDB.MR diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index b9393ce1c4..ea5b57283f 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -141,7 +141,6 @@ function notifications_get_subtypes(?string $source=null) 'NOTIF.PANDORADB', 'NOTIF.PANDORADB.HISTORICAL', 'NOTIF.HISTORYDB.MR', - 'NOTIF.EXT.ELASTICSEARCH', 'NOTIF.EXT.LOGSTASH', 'NOTIF.METACONSOLE.DB_CONNECTION', 'NOTIF.DOWNTIME', From 1935b3c8f472979ed25bff1982d040eb4237e207 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 18 Oct 2023 12:35:50 +0200 Subject: [PATCH 048/108] #9761 add again checkPandoraDBMaintenance --- pandora_console/include/class/ConsoleSupervisor.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 25e298e520..b4320b1a4d 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -394,6 +394,15 @@ class ConsoleSupervisor $this->checkPandoraHistoryDB(); + /* + * Check pandoradb running in main DB. + * Check pandoradb running in historical DB. + * NOTIF.PANDORADB + * NOTIF.PANDORADB.HISTORICAL + */ + + $this->checkPandoraDBMaintenance(); + /* * Check historical DB MR version. * NOTIF.HISTORYDB.MR From e0628f8c14a879e190b34008cb92b5a7594d6c0a Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 18 Oct 2023 12:46:38 +0200 Subject: [PATCH 049/108] #9761 change notif to remove --- pandora_console/include/functions_notifications.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index ea5b57283f..93fca8602a 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -141,7 +141,7 @@ function notifications_get_subtypes(?string $source=null) 'NOTIF.PANDORADB', 'NOTIF.PANDORADB.HISTORICAL', 'NOTIF.HISTORYDB.MR', - 'NOTIF.EXT.LOGSTASH', + 'NOTIF.EXT.ELASTICSEARCH', 'NOTIF.METACONSOLE.DB_CONNECTION', 'NOTIF.DOWNTIME', 'NOTIF.UPDATEMANAGER.REGISTRATION', From e87790ed037cf55304c0d9b9e43c96a6ddd89850 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 19 Oct 2023 10:39:18 +0200 Subject: [PATCH 050/108] 12101 adding binary agent --- extras/deploy-scripts/pandora_deploy_community_el8.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/deploy-scripts/pandora_deploy_community_el8.sh b/extras/deploy-scripts/pandora_deploy_community_el8.sh index e1be9519f0..3ad47baf73 100644 --- a/extras/deploy-scripts/pandora_deploy_community_el8.sh +++ b/extras/deploy-scripts/pandora_deploy_community_el8.sh @@ -574,14 +574,14 @@ if [ "$PANDORA_LTS" -eq '1' ] ; then elif [ "$PANDORA_LTS" -ne '1' ] ; then [ "$PANDORA_SERVER_PACKAGE" ] || PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_server-7.0NG.noarch.rpm" [ "$PANDORA_CONSOLE_PACKAGE" ] || PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_console-7.0NG.x86_64.rpm" - [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" + [ "$PANDORA_AGENT_PACKAGE" ] || PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm" fi # if beta is enable if [ "$PANDORA_BETA" -eq '1' ] ; then PANDORA_SERVER_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_server-latest.x86_64.rpm" PANDORA_CONSOLE_PACKAGE="https://firefly.pandorafms.com/pandora_enterprise_nightlies/pandorafms_console-latest.x86_64.rpm" - PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux-7.0NG.noarch.rpm" + PANDORA_AGENT_PACKAGE="https://firefly.pandorafms.com/pandorafms/latest/RHEL_CentOS/pandorafms_agent_linux_bin-7.0NG.x86_64.rpm" fi # Downloading Pandora Packages From 2f6e0b62be8e9385c5aa62e287d1e1586ec3353b Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Fri, 20 Oct 2023 12:55:26 +0200 Subject: [PATCH 051/108] #12295 Fixed errata --- pandora_console/include/class/WelcomeWindow.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/class/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php index 5e66268403..2481630130 100644 --- a/pandora_console/include/class/WelcomeWindow.class.php +++ b/pandora_console/include/class/WelcomeWindow.class.php @@ -732,7 +732,7 @@ class WelcomeWindow extends Wizard ) ); echo html_print_label_input_block( - __('Module group'), + __('Agent group'), html_print_select_from_sql( 'SELECT * FROM tgrupo ORDER BY nombre', 'id_group', From 10fcf9fdb3f6e6008f496963a890cef4f4df3f4f Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 20 Oct 2023 13:00:02 +0200 Subject: [PATCH 052/108] #12271 style dashboard widgets --- pandora_console/include/styles/dashboards.css | 4 ++++ pandora_console/views/dashboard/widget.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/styles/dashboards.css b/pandora_console/include/styles/dashboards.css index 2cda2de6f4..b9f15a63a8 100644 --- a/pandora_console/include/styles/dashboards.css +++ b/pandora_console/include/styles/dashboards.css @@ -949,3 +949,7 @@ input.resize_button { bottom: 3%; right: 6%; } + +.new-widget-message .info_box_information .title b { + margin-left: 60px; +} diff --git a/pandora_console/views/dashboard/widget.php b/pandora_console/views/dashboard/widget.php index 2f0bfe7364..cf160ccc76 100644 --- a/pandora_console/views/dashboard/widget.php +++ b/pandora_console/views/dashboard/widget.php @@ -43,7 +43,7 @@ if ((int) $cellData['id_widget'] !== 0 || $widgetId !== 0) { true ); - $output .= '
'; + $output .= '
'; $output .= \ui_print_info_message( __('Please select widget'), '', From 183812635442e492be4481c6c54d555e69539772 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Tue, 24 Oct 2023 09:57:25 +0200 Subject: [PATCH 053/108] #12298 clear hidden fields --- pandora_console/godmode/alerts/configure_alert_action.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/alerts/configure_alert_action.php b/pandora_console/godmode/alerts/configure_alert_action.php index 4883467c10..65195f466b 100644 --- a/pandora_console/godmode/alerts/configure_alert_action.php +++ b/pandora_console/godmode/alerts/configure_alert_action.php @@ -707,7 +707,7 @@ $(document).ready (function () { name: "id_action", value: "" }); - + jQuery.post (, values, function (data, status) { @@ -739,6 +739,9 @@ $(document).ready (function () { // If the row is empty, hide it if (field_row == '') { + // Clear hidden fields. + $("[name=field" + i + "_value]").val(''); + $("[name=field" + i + "_recovery_value]").val('') $table_macros_field.hide(); continue; } From 60efc695de5ec970885fc48ccee4b0aa3ccfb095 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 24 Oct 2023 12:08:11 +0200 Subject: [PATCH 054/108] #11039 added snmp browser in metaconsole --- .../include/functions_snmp_browser.php | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php index 480d0d865e..99a0b07612 100644 --- a/pandora_console/include/functions_snmp_browser.php +++ b/pandora_console/include/functions_snmp_browser.php @@ -644,14 +644,16 @@ function snmp_browser_print_oid( if (isset($_POST['print_create_agent_module'])) { // Hidden by default. - $output .= html_print_button( - __('Create agent module'), - 'create_module_agent_single', - false, - 'show_add_module()', - 'class="sub add invisible"', - true - ); + if (is_metaconsole() === false) { + $output .= html_print_button( + __('Create agent module'), + 'create_module_agent_single', + false, + 'show_add_module()', + 'class="sub add invisible"', + true + ); + } } if (isset($_POST['print_copy_oid'])) { @@ -1238,13 +1240,15 @@ function snmp_browser_print_container( if ($show_massive_buttons) { $output .= '