From 10a5cd496f0f5059b6eb72fff5408446cc0f21e5 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 14 Jul 2023 13:53:52 +0200 Subject: [PATCH 001/172] #11714 Fix external link --- pandora_console/godmode/users/configure_user.php | 12 ++++++++---- pandora_console/godmode/users/user_management.php | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 7227aaa09e..56f15ee0a8 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -349,8 +349,10 @@ if ($create_user === true) { $values['data_section'] = $dashboard; } else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) { $values['data_section'] = $visual_console; - } else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { - $values['data_section'] = get_parameter('data_section'); + } else if ($values['section'] === HOME_SCREEN_OTHER) { + $values['data_section'] = get_parameter('data_section_other'); + } else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { + $values['data_section'] = get_parameter('data_section_external'); } // $values['section'] = $homeScreenValues[$values['section']]; @@ -643,8 +645,10 @@ if ($update_user) { $values['data_section'] = $dashboard; } else if (io_safe_output($values['section']) === HOME_SCREEN_VISUAL_CONSOLE) { $values['data_section'] = $visual_console; - } else if ($values['section'] === HOME_SCREEN_OTHER || io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { - $values['data_section'] = get_parameter('data_section'); + } else if ($values['section'] === HOME_SCREEN_OTHER) { + $values['data_section'] = get_parameter('data_section_other'); + } else if (io_safe_output($values['section']) === HOME_SCREEN_EXTERNAL_LINK) { + $values['data_section'] = get_parameter('data_section_external'); } // $values['section'] = $homeScreenValues[$values['section']]; diff --git a/pandora_console/godmode/users/user_management.php b/pandora_console/godmode/users/user_management.php index 241177f2a2..ec967c293d 100644 --- a/pandora_console/godmode/users/user_management.php +++ b/pandora_console/godmode/users/user_management.php @@ -52,8 +52,8 @@ $customHomeScreenAddition[HOME_SCREEN_DASHBOARD] = html_print_select($dashboards // Home screen. Visual consoles. $customHomeScreenAddition[HOME_SCREEN_VISUAL_CONSOLE] = html_print_select($layouts_aux, 'visual_console', $user_info['data_section'], '', '', '', true, false, true, 'w100p', false, 'width: 100%'); // Home screen. External link and Other. -$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true); -$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section', $user_info['data_section'], '', 60, 255, true); +$customHomeScreenAddition[HOME_SCREEN_EXTERNAL_LINK] = html_print_input_text('data_section_external', $user_info['data_section'], '', 60, 255, true); +$customHomeScreenAddition[HOME_SCREEN_OTHER] = html_print_input_text('data_section_other', $user_info['data_section'], '', 60, 255, true); $customHomeScreenDataField = ''; foreach ($customHomeScreenAddition as $key => $customField) { From 6c41ccc0f3a8847514b59cc414bfa15824932bd2 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 17 Jul 2023 08:59:19 +0200 Subject: [PATCH 002/172] #11699 fix css filter --- pandora_console/include/styles/pandora_black.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/include/styles/pandora_black.css b/pandora_console/include/styles/pandora_black.css index 652d777f72..999810c367 100644 --- a/pandora_console/include/styles/pandora_black.css +++ b/pandora_console/include/styles/pandora_black.css @@ -1464,6 +1464,10 @@ ul.datatable_filter:has(li > div.action-buttons) { background-color: #222 !important; } +ul.datatable_filter { + background-color: #222 !important; +} + span.ui-dialog-title { color: #fff !important; } From aead8d006e84f01f30607e32d7d4f7f5ea90631e Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Tue, 29 Aug 2023 14:11:32 +0200 Subject: [PATCH 003/172] #11894 Fixed links does not update the page when creating or deleting links --- pandora_console/godmode/setup/links.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pandora_console/godmode/setup/links.php b/pandora_console/godmode/setup/links.php index fc27454b48..20e61e95b0 100644 --- a/pandora_console/godmode/setup/links.php +++ b/pandora_console/godmode/setup/links.php @@ -54,8 +54,12 @@ if (isset($_POST['create'])) { if (! $result) { ui_print_error_message(__('There was a problem creating link')); } else { - ui_print_success_message(__('Successfully created')); $id_link = $result; + ui_print_result_message( + $id_link, + __('Successfully created'), + __('Could not be created') + ); } } @@ -111,8 +115,8 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { $link = ''; } - echo ''; echo ''; + echo '
'; if ($creation_mode == 1) { echo ""; } else { @@ -179,10 +183,10 @@ if ((isset($_GET['form_add'])) or (isset($_GET['form_edit']))) { ) ); - echo '
'; + echo ''; } else { - // Main list view for Links editor - $rows = db_get_all_rows_in_table('tlink', 'name'); + // Main list view for Links editor. + $rows = db_get_all_fields_in_table('tlink', '', '', 'name'); if ($rows === false) { $rows = []; } From 9c470053aee6de01f0a740c26899887419a8ef40 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 31 Aug 2023 10:58:39 +0200 Subject: [PATCH 004/172] #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 98112d9ff3e51f286e7058d8a2c9518183d37b1b Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Sep 2023 09:05:16 +0200 Subject: [PATCH 005/172] #11759 fix delete action snmp alert --- pandora_console/godmode/snmpconsole/snmp_alert.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/godmode/snmpconsole/snmp_alert.php b/pandora_console/godmode/snmpconsole/snmp_alert.php index d23b65d7ea..0df4298d7a 100755 --- a/pandora_console/godmode/snmpconsole/snmp_alert.php +++ b/pandora_console/godmode/snmpconsole/snmp_alert.php @@ -1952,6 +1952,7 @@ if ($create_alert || $update_alert) { [ 'border' => '0', 'alt' => __('Delete'), + 'class' => 'invert_filter main_menu_icon', ] ).' '; $data[1] .= ''; From 3960c2021a9f874b1c290b6d49d8937fc59bf595 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 1 Sep 2023 09:06:48 +0200 Subject: [PATCH 006/172] #11856 Fix view events tooltip --- pandora_console/include/styles/tables.css | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/include/styles/tables.css b/pandora_console/include/styles/tables.css index 7d93624dbb..bd68fe4358 100644 --- a/pandora_console/include/styles/tables.css +++ b/pandora_console/include/styles/tables.css @@ -652,6 +652,7 @@ div.advanced-options-events > div.filter_input { .vert-align-bottom { vertical-align: bottom; + font-size: 8pt; } label.vert-align-bottom > a.tip { From 82db8bd4bda6e6aa4865147bbfbd583a0d2f3bf4 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Fri, 1 Sep 2023 10:28:02 +0200 Subject: [PATCH 007/172] #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 008/172] #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 009/172] #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 010/172] #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 011/172] #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 012/172] #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 013/172] #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 014/172] #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 bf4ef92610de2730d8bdaad2da6c80d684eb2aca Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 4 Sep 2023 13:44:44 +0200 Subject: [PATCH 015/172] #11511 Move tools from operation to management --- pandora_console/godmode/menu.php | 13 +++++++++++++ pandora_console/operation/menu.php | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 7cd504c8ac..9773a824ee 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -366,6 +366,8 @@ if ($access_console_node === true) { $sub['godmode/alerts/alert_list']['text'] = __('List of Alerts'); $sub['godmode/alerts/alert_list']['id'] = 'List_of_Alerts'; $sub['godmode/alerts/alert_list']['pages'] = ['godmode/alerts/alert_view']; + $sub['godmode/agentes/planned_downtime.list']['text'] = __('Scheduled downtime'); + $sub['godmode/agentes/planned_downtime.list']['id'] = 'scheduled_downtime'; if ((bool) check_acl($config['id_user'], 0, 'LM') === true) { $sub['godmode/alerts/alert_templates']['text'] = __('Templates'); @@ -706,6 +708,17 @@ if ($access_console_node === true) { } if ($access_console_node === true) { + // Tools + $menu_godmode['tools']['text'] = __('Tools'); + $menu_godmode['tools']['sec2'] = 'operation/extensions'; + $menu_godmode['tools']['id'] = 'oper-extensions'; + $sub = []; + $sub['operation/agentes/exportdata']['text'] = __('Export data'); + $sub['operation/agentes/exportdata']['id'] = 'export_data'; + $sub['extensions/files_repo']['text'] = __('File repository'); + $sub['extensions/files_repo']['id'] = 'file_repository'; + $menu_godmode['tools']['sub'] = $sub; + // About. $menu_godmode['about']['text'] = __('About'); $menu_godmode['about']['id'] = 'about'; diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index e64dbe30c7..6a12b5542f 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -802,13 +802,6 @@ if ($access_console_node === true) { } } } - - if (!empty($sub)) { - $menu_operation['extensions']['text'] = __('Tools'); - $menu_operation['extensions']['sec2'] = 'operation/extensions'; - $menu_operation['extensions']['id'] = 'oper-extensions'; - $menu_operation['extensions']['sub'] = $sub; - } } // ~ } From 3327d79ed62b38bc6f63611c57fe4c9f60c49c54 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 6 Sep 2023 09:35:12 +0200 Subject: [PATCH 016/172] #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 017/172] 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 f445066d134da812c8670eb208cabe2b5bce56b6 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 7 Sep 2023 16:29:18 +0200 Subject: [PATCH 018/172] #11679 Fix linked module name --- pandora_console/include/ajax/module.php | 2 ++ .../operation/search_modules.getdata.php | 26 ++++++++++++------- pandora_console/operation/search_modules.php | 10 ++++--- pandora_console/operation/search_results.php | 2 +- 4 files changed, 26 insertions(+), 14 deletions(-) diff --git a/pandora_console/include/ajax/module.php b/pandora_console/include/ajax/module.php index 1e529c487c..278774b8cd 100755 --- a/pandora_console/include/ajax/module.php +++ b/pandora_console/include/ajax/module.php @@ -1155,7 +1155,9 @@ if (check_login()) { ); } + $data[2] .= ''; $data[2] .= ui_print_truncate_text($module['nombre'], 'module_medium', false, true, true, '…', 'font-size: 9pt;'); + $data[2] .= ''; if (empty($module['extended_info']) === false) { $data[2] .= ui_print_help_tip($module['extended_info'], true, '/images/default_list.png'); } diff --git a/pandora_console/operation/search_modules.getdata.php b/pandora_console/operation/search_modules.getdata.php index e83c6035ef..a278ca8cd0 100644 --- a/pandora_console/operation/search_modules.getdata.php +++ b/pandora_console/operation/search_modules.getdata.php @@ -19,17 +19,25 @@ require_once $config['homedir'].'/include/functions_users.php'; $searchModules = check_acl($config['id_user'], 0, 'AR'); -$selectModuleNameUp = ''; -$selectModuleNameDown = ''; -$selectAgentNameUp = ''; -$selectAgentNameDown = ''; +if ($config['style'] === 'pandora_black') { + $selectModuleNameUp = ''; + $selectModuleNameDown = ''; + $selectAgentNameUp = ''; + $selectAgentNameDown = ''; +} else { + $selectModuleNameUp = '_black'; + $selectModuleNameDown = '_black'; + $selectAgentNameUp = '_black'; + $selectAgentNameDown = '_black'; +} + $is_admin = (bool) db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']); switch ($sortField) { case 'module_name': switch ($sort) { case 'up': - $selectModuleNameUp = $selected; + $selectModuleNameUp = $selected_module; $order = [ 'field' => 'module_name', 'order' => 'ASC', @@ -37,7 +45,7 @@ switch ($sortField) { break; case 'down': - $selectModuleNameDown = $selected; + $selectModuleNameDown = $selected_module; $order = [ 'field' => 'module_name', 'order' => 'DESC', @@ -49,7 +57,7 @@ switch ($sortField) { case 'agent_name': switch ($sort) { case 'up': - $selectAgentNameUp = $selected; + $selectAgentNameUp = $selected_module; $order = [ 'field' => 'agent_name', 'order' => 'ASC', @@ -57,7 +65,7 @@ switch ($sortField) { break; case 'down': - $selectAgentNameDown = $selected; + $selectAgentNameDown = $selected_module; $order = [ 'field' => 'agent_name', 'order' => 'DESC', @@ -67,7 +75,7 @@ switch ($sortField) { break; default: - $selectModuleNameUp = $selected; + $selectModuleNameUp = $selected_module; $order = [ 'field' => 'module_name', 'order' => 'ASC', diff --git a/pandora_console/operation/search_modules.php b/pandora_console/operation/search_modules.php index 6d35064b68..41d545928f 100644 --- a/pandora_console/operation/search_modules.php +++ b/pandora_console/operation/search_modules.php @@ -30,10 +30,9 @@ if (!$modules || !$searchModules) { $table->cellspacing = 4; $table->width = '98%'; $table->class = 'info_table'; - $table->head = []; - $table->head[0] = __('Module').' '.html_print_image('images/sort_up.png', true, ['style' => $selectModuleNameUp]).''.html_print_image('images/sort_down.png', true, ['style' => $selectModuleNameDown]).''; - $table->head[1] = __('Agent').' '.html_print_image('images/sort_up.png', true, ['style' => $selectAgentNameUp]).''.html_print_image('images/sort_down.png', true, ['style' => $selectAgentNameDown]).''; + $table->head[0] = __('Module').' '.html_print_image('images/sort_up'.$selectModuleNameUp.'.png', true).''.html_print_image('images/sort_down'.$selectModuleNameDown.'.png', true).''; + $table->head[1] = __('Agent').' '.html_print_image('images/sort_up'.$selectAgentNameUp.'.png', true).''.html_print_image('images/sort_down'.$selectAgentNameDown.'.png', true).''; $table->head[2] = __('Type'); $table->head[3] = __('Interval'); $table->head[4] = __('Status'); @@ -80,6 +79,9 @@ if (!$modules || !$searchModules) { $module['datos'] = modules_get_last_value($module['id_agente_modulo']); $module['module_name'] = $module['nombre']; + $linked_module_name = ''; + $linked_module_name .= $module['module_name']; + $linked_module_name .= ''; // To search the monitor status $status_sql = sprintf('SELECT estado from tagente_estado where id_agente_modulo ='.$module['id_agente_modulo']); $status_sql = db_process_sql($status_sql); @@ -226,7 +228,7 @@ if (!$modules || !$searchModules) { array_push( $table->data, [ - $module['module_name'], + $linked_module_name, $agentCell, $typeCell, $intervalCell, diff --git a/pandora_console/operation/search_results.php b/pandora_console/operation/search_results.php index cef9788be0..76638e3525 100644 --- a/pandora_console/operation/search_results.php +++ b/pandora_console/operation/search_results.php @@ -60,7 +60,7 @@ $order = null; $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $selected = 'border: 1px solid black;'; - +$selected_module = '_green'; if ($searchMain) { $main_tab = [ 'text' => "".html_print_image( From 02e2903b37f4538b59c0ec18cf9134986a4bfe39 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Thu, 7 Sep 2023 17:58:26 +0200 Subject: [PATCH 019/172] #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 020/172] #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 053/172] #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 054/172] #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 055/172] #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 056/172] 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 057/172] #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 e980e60025ed8370ec5efbc92f1621774c63f38d Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 6 Oct 2023 14:33:06 +0200 Subject: [PATCH 058/172] changed behavior of prediction modules creation --- .../module_manager_editor_prediction.php | 64 +++++++++++++------ 1 file changed, 46 insertions(+), 18 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_prediction.php b/pandora_console/godmode/agentes/module_manager_editor_prediction.php index eb85a05618..ff5043fd33 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_prediction.php +++ b/pandora_console/godmode/agentes/module_manager_editor_prediction.php @@ -131,9 +131,10 @@ if ($module_service_synthetic_selector !== ENTERPRISE_NOT_HOOK) { } $data = []; -$data[0] = __('Agent'); -$data[1] = __('Module'); -$data[2] = __('Period'); + +$data[0] = __('Module'); +$data[1] = __('Period'); + $table_simple->cellclass['caption_prediction_module'][0] = 'w33p'; $table_simple->cellclass['caption_prediction_module'][1] = 'w33p'; $table_simple->cellclass['caption_prediction_module'][2] = 'w33p'; @@ -163,34 +164,61 @@ $params['none_module_text'] = __('Select Module'); $params['use_hidden_input_idagent'] = true; $params['input_style'] = 'width: 100%;'; $params['hidden_input_idagent_id'] = 'hidden-id_agente_module_prediction'; -$data[0] = ui_print_agent_autocomplete_input($params); -if ($id_agente > 0) { - $predictionModuleInput = html_print_select_from_sql( - 'SELECT id_agente_modulo, nombre - FROM tagente_modulo - WHERE delete_pending = 0 - AND history_data = 1 - AND id_agente = '.$id_agente_clean.' - AND id_agente_modulo <> '.$id_agente_modulo, +if (strstr($page, 'policy_modules') === false) { + $modules = agents_get_modules($id_agente); + + $predictionModuleInput = html_print_select( + $modules, 'prediction_module', $prediction_module, '', - __('Select Module'), + '', 0, true, false, true, + '', false, - 'width: 100%;' + false, + false, + false, + false, + '', + false, + false, + true ); } else { - $predictionModuleInput = ''; + $modules = index_array(policies_get_modules($policy_id, false, ['id', 'name'])); + + $predictionModuleInput = html_print_select( + $modules, + 'id_module_policy', + $module['custom_integer_1'], + '', + '', + 0, + true, + false, + true, + '', + false, + false, + false, + false, + false, + '', + false, + false, + true + ); } -$data[1] = $predictionModuleInput; -$data[2] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;'); -$data[2] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true); +$data[0] = $predictionModuleInput; +$data[1] = html_print_select([__('Weekly'), __('Monthly'), __('Daily')], 'custom_integer_2', $custom_integer_2, '', '', 0, true, false, true, '', false, 'width: 100%;'); +$data[1] .= html_print_input_hidden('id_agente_module_prediction', $id_agente, true); + $table_simple->cellclass['prediction_module'][0] = 'w33p'; $table_simple->cellclass['prediction_module'][1] = 'w33p'; $table_simple->cellclass['prediction_module'][2] = 'w33p'; From 041a13cb49ee75353fcf9dc304b350f18cc77643 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 9 Oct 2023 16:03:04 +0200 Subject: [PATCH 059/172] #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 1c1d2cf1c1f8540e3261a7e57ca60d7e7c2e39e9 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 10 Oct 2023 16:35:36 +0200 Subject: [PATCH 060/172] #12208 Improve widget html editor --- .../include/lib/Dashboard/Widgets/post.php | 7 +++-- pandora_console/include/styles/form.css | 4 +-- .../views/dashboard/configurationWidgets.php | 31 +++++++++---------- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/post.php b/pandora_console/include/lib/Dashboard/Widgets/post.php index d6274e279d..df20869780 100755 --- a/pandora_console/include/lib/Dashboard/Widgets/post.php +++ b/pandora_console/include/lib/Dashboard/Widgets/post.php @@ -221,9 +221,10 @@ class PostWidget extends Widget 'type' => 'textarea', 'value' => $values['text'], 'return' => true, - 'rows' => 1, - 'columns' => 1, + 'rows' => 25, + 'columns' => 100, 'size' => 25, + 'style' => 'display: none;', ], ]; @@ -296,7 +297,7 @@ class PostWidget extends Widget public function getSizeModalConfiguration(): array { $size = [ - 'width' => 500, + 'width' => 1000, 'height' => 500, ]; diff --git a/pandora_console/include/styles/form.css b/pandora_console/include/styles/form.css index a0e5957358..c212d459f6 100644 --- a/pandora_console/include/styles/form.css +++ b/pandora_console/include/styles/form.css @@ -279,8 +279,8 @@ form.modal ul.wizard li { flex-wrap: nowrap; } -form.modal-dashboard ul.wizard li *, -form.modal ul.wizard li *:not(.tox.tox-tinymce *) { +form.modal-dashboard ul.wizard li > *, +form.modal ul.wizard li > *:not(.tox.tox-tinymce *) { flex: 1 1 50%; } diff --git a/pandora_console/views/dashboard/configurationWidgets.php b/pandora_console/views/dashboard/configurationWidgets.php index f985517f4f..68a51edbaa 100644 --- a/pandora_console/views/dashboard/configurationWidgets.php +++ b/pandora_console/views/dashboard/configurationWidgets.php @@ -28,15 +28,11 @@ // Includes. require_once $config['homedir'].'/include/class/HTML.class.php'; +ui_require_javascript_file('tinymce', 'vendor/tinymce/tinymce/', true); +ui_require_javascript_file('pandora', 'include/javascript/', true); $output = ''; -$output .= ui_require_javascript_file( - 'tiny_mce', - 'include/javascript/tiny_mce/', - true -); - $form = [ 'action' => '#', 'method' => 'POST', @@ -47,6 +43,18 @@ $form = [ 'extra' => 'novalidate', ]; +$js = 'tinymce.init({ + selector: "#textarea_text", + plugins: "preview, searchreplace, table, nonbreaking, link, image", + promotion: false, + branding: false, + setup: function (editor) { + editor.on("change", function () { + tinymce.triggerSave(); + }) + } +});'; + HTML::printForm( [ 'form' => $form, @@ -56,15 +64,4 @@ HTML::printForm( ] ); -$output .= ''; echo $output; From 3a2b56cc4c171616d626362812a707f6494c9d5f Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 10 Oct 2023 16:50:42 +0200 Subject: [PATCH 061/172] #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 062/172] #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 063/172] #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 064/172] 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 a7436efd8c4370c73e917185bc2d9e87f433c080 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Wed, 11 Oct 2023 13:31:25 +0200 Subject: [PATCH 065/172] #12219 Fix delete last user profile --- .../godmode/users/configure_user.php | 272 +++++++++++------- pandora_console/include/functions_profile.php | 2 +- 2 files changed, 173 insertions(+), 101 deletions(-) diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index 08040f839c..b313589403 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -157,14 +157,100 @@ if (is_ajax() === true) { return; } + + if ($delete_profile) { + $id2 = (string) get_parameter('id_user'); + $id_up = (int) get_parameter('id_user_profile'); + $perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up); + $id_perfil = $perfilUser['id_perfil']; + $perfil = db_get_row('tperfil', 'id_perfil', $id_perfil); + + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + 'Deleted profile for user '.io_safe_output($id2), + false, + false, + 'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo'] + ); + + $return = profile_delete_user_profile($id2, $id_up); + ui_print_result_message( + $return, + __('Successfully deleted'), + __('Could not be deleted') + ); + + + $has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id2); + $user_is_global_admin = users_is_admin($id2); + $delete_user_profile = (bool) get_parameter('delete_user_profile', false); + + if ($has_profile === false && $user_is_global_admin === false && $delete_user_profile === true) { + $result = delete_user($id2); + + if ($result === true) { + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + __('Deleted user %s', io_safe_output($id_user)) + ); + } + + ui_print_result_message( + $result, + __('Successfully deleted'), + __('There was a problem deleting the user') + ); + + // Delete the user in all the consoles. + if (is_metaconsole() === true) { + $servers = metaconsole_get_servers(); + foreach ($servers as $server) { + // Connect to the remote console. + metaconsole_connect($server); + + // Delete the user. + $result = delete_user($id_user); + if ($result === true) { + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + __('Deleted user %s from metaconsole', io_safe_output($id_user)) + ); + } + + // Restore the db connection. + metaconsole_restore_db(); + + // Log to the metaconsole too. + if ($result === true) { + db_pandora_audit( + AUDIT_LOG_USER_MANAGEMENT, + __( + 'Deleted user %s from %s', + io_safe_input($id_user), + io_safe_input($server['server_name']) + ) + ); + } + + ui_print_result_message( + $result, + __('Successfully deleted from %s', io_safe_input($server['server_name'])), + __('There was a problem deleting the user from %s', io_safe_input($server['server_name'])) + ); + } + } + + return $result; + } + + return $return; + } } $tab = get_parameter('tab', 'user'); - // Save autorefresh list. $autorefresh_list = (array) get_parameter_post('autorefresh_list'); $autorefresh_white_list = (($autorefresh_list[0] === '') || ($autorefresh_list[0] === '0')) ? '' : json_encode($autorefresh_list); - // Header. if (is_metaconsole() === true) { user_meta_print_header(); @@ -197,11 +283,11 @@ if (is_metaconsole() === true) { ).'
', ], ]; - $buttons[$tab]['active'] = true; } $edit_user = get_parameter('edit_user'); + ui_print_standard_header( ($edit_user) ? sprintf('%s [ %s ]', __('Update User'), $id) : __('Create User'), 'images/gm_users.png', @@ -224,11 +310,9 @@ if (is_metaconsole() === true) { ], ] ); - $sec = 'gusuarios'; } - if ((bool) $config['user_can_update_info'] === true) { $view_mode = false; } else { @@ -864,89 +948,6 @@ if ($update_user) { $user_info = $values; } -if ($delete_profile) { - $id2 = (string) get_parameter('id_user'); - $id_up = (int) get_parameter('id_user_profile'); - $perfilUser = db_get_row('tusuario_perfil', 'id_up', $id_up); - $id_perfil = $perfilUser['id_perfil']; - $perfil = db_get_row('tperfil', 'id_perfil', $id_perfil); - - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - 'Deleted profile for user '.io_safe_output($id2), - false, - false, - 'The profile with id '.$id_perfil.' in the group '.$perfilUser['id_grupo'] - ); - - $return = profile_delete_user_profile($id2, $id_up); - ui_print_result_message( - $return, - __('Successfully deleted'), - __('Could not be deleted') - ); - - - $has_profile = db_get_row('tusuario_perfil', 'id_usuario', $id2); - $user_is_global_admin = users_is_admin($id2); - - if ($has_profile === false && $user_is_global_admin === false) { - $result = delete_user($id2); - - if ($result === true) { - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - __('Deleted user %s', io_safe_output($id_user)) - ); - } - - ui_print_result_message( - $result, - __('Successfully deleted'), - __('There was a problem deleting the user') - ); - - // Delete the user in all the consoles. - if (is_metaconsole() === true) { - $servers = metaconsole_get_servers(); - foreach ($servers as $server) { - // Connect to the remote console. - metaconsole_connect($server); - - // Delete the user. - $result = delete_user($id_user); - if ($result === true) { - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - __('Deleted user %s from metaconsole', io_safe_output($id_user)) - ); - } - - // Restore the db connection. - metaconsole_restore_db(); - - // Log to the metaconsole too. - if ($result === true) { - db_pandora_audit( - AUDIT_LOG_USER_MANAGEMENT, - __( - 'Deleted user %s from %s', - io_safe_input($id_user), - io_safe_input($server['server_name']) - ) - ); - } - - ui_print_result_message( - $result, - __('Successfully deleted from %s', io_safe_input($server['server_name'])), - __('There was a problem deleting the user from %s', io_safe_input($server['server_name'])) - ); - } - } - } -} - if ((int) $status !== -1) { ui_print_result_message( $status, @@ -1157,6 +1158,13 @@ if (is_user_admin($id) === true) { ); } +html_print_div( + [ + 'id' => 'delete_profile_modal', + 'content' => '', + ] +); + $full_name = '
'.html_print_input_text_extended( 'fullname', $user_info['fullname'], @@ -1995,24 +2003,88 @@ if (is_metaconsole() === false) { } }); }); - + $('input:image[name="del"]').click(function(e) { - if ($(json_profile).length > 0) return; - if (!confirm('Are you sure?')) return; - e.preventDefault(); - var rows = $("#table_profiles tr").length; - if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') { - if (!confirm('' + '. ' + '')) { - return; - } - } + + var rows = $("#table_profiles tr").length; + let deleteuser = 0; + e.preventDefault(); var id_user_profile = $(this).siblings(); id_user_profile = id_user_profile[1].value; var row = $(this).closest('tr'); + if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole !== '1' && rows <= 3)) && user_is_global_admin !== '1') { + $("#delete_profile_modal") + .empty() + .html(""); + // Set the title. + $("#delete_profile_modal").prop("title", ""); + // Build the dialog for show the mesage. + $("#delete_profile_modal").dialog({ + resizable: true, + draggable: true, + modal: true, + width: 500, + buttons: [ + { + text: "Cancel", + click: function() { + $(this).dialog("close"); + return false; + } + }, + { + text: "Delete", + click: function() { + $(this).dialog("close"); + deleteuser = 1; + delete_user_profile(id_user_profile, row, id_user, deleteuser); + } + }, + { + text: "Preserve", + click: function() { + $(this).dialog("close"); + deleteuser = 0; + delete_user_profile(id_user_profile, row, id_user, deleteuser) + } + } + ], + overlay: { + opacity: 0.5, + background: "black" + }, + closeOnEscape: false, + open: function(event, ui) { + $(".ui-dialog-titlebar-close").hide(); + } + }); + } else { + if (((is_metaconsole === '1' && rows <= 4) || (is_metaconsole === '' && rows <= 3)) && user_is_global_admin !== '1') { + if (!confirm('' + '. ' + '')) { + return false; + } else { + delete_user_profile(id_user_profile, row, id_user, deleteuser); + } + } else { + if (!confirm('Are you sure?')) { + return false; + } else { + delete_user_profile(id_user_profile, row, id_user, deleteuser); + } + } + } + + if ($(json_profile).length > 0) return; + }); + + function delete_user_profile(id_user_profile, row, id_user, deleteuser){ + var params = []; params.push("delete_profile=1"); + params.push("edit_user=1"); + params.push("delete_user_profile=" + deleteuser); params.push("id_user=" + id_user); params.push("id_user_profile=" + id_user_profile); params.push("page=godmode/users/configure_user"); @@ -2024,14 +2096,14 @@ if (is_metaconsole() === false) { row.remove(); var rows = $("#table_profiles tr").length; - if (is_metaconsole === '' && rows <= 2 && user_is_global_admin !== '1') { + if (is_metaconsole === '' && rows <= 2 && user_is_global_admin !== '1' && deleteuser == '1') { window.location.replace(""); } else if (is_metaconsole === '1' && rows <= 3 && user_is_global_admin !== '1') { window.location.replace(""); } } }); - }); + } function checkProfiles(e) { e.preventDefault(); diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index 7cdbd1c461..e4415b3ca1 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -316,7 +316,7 @@ function profile_print_profile_table($id, $json_profile=false, $return=false, $c ] ); } else { - $data['actions'] = '
'; + $data['actions'] = ''; $data['actions'] .= html_print_input_image('del', 'images/delete.svg', 1, '', true, ['class' => 'main_menu_icon invert_filter']); $data['actions'] .= html_print_input_hidden('delete_profile', 1, true); $data['actions'] .= html_print_input_hidden('id_user_profile', $profile['id_up'], true); From 65c7738bca3a0526cdd6e45cf951c66487dac463 Mon Sep 17 00:00:00 2001 From: Rafael Date: Wed, 11 Oct 2023 15:46:42 +0200 Subject: [PATCH 066/172] 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 fbe2629de362d4dd1653eacdeff6522f03ce27d6 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 13 Oct 2023 10:39:33 +0200 Subject: [PATCH 067/172] fix policy synthetic module form --- .../godmode/agentes/module_manager_editor_prediction.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_prediction.php b/pandora_console/godmode/agentes/module_manager_editor_prediction.php index ff5043fd33..e8fee22a87 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_prediction.php +++ b/pandora_console/godmode/agentes/module_manager_editor_prediction.php @@ -292,7 +292,7 @@ if ($selector_form !== ENTERPRISE_NOT_HOOK) { } // Synthetic modules are an Enterprise feature. -$synthetic_module_form = enterprise_hook('get_synthetic_module_form'); +$synthetic_module_form = enterprise_hook('get_synthetic_module_form', [$policy_id]); if ($synthetic_module_form !== ENTERPRISE_NOT_HOOK) { $data = []; $data[0] = $synthetic_module_form; From 2062169f2f26f9e7b81f42f647558f60cc36d879 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Fri, 13 Oct 2023 12:55:58 +0200 Subject: [PATCH 068/172] #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 069/172] #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 c67a8ba25d09033756afa38af41113812dfbc20a Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 13 Oct 2023 14:31:17 +0200 Subject: [PATCH 070/172] remove required --- .../godmode/agentes/module_manager_editor_prediction.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_prediction.php b/pandora_console/godmode/agentes/module_manager_editor_prediction.php index e8fee22a87..a2806c5781 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_prediction.php +++ b/pandora_console/godmode/agentes/module_manager_editor_prediction.php @@ -186,8 +186,7 @@ if (strstr($page, 'policy_modules') === false) { false, '', false, - false, - true + false ); } else { $modules = index_array(policies_get_modules($policy_id, false, ['id', 'name'])); From 276cfb672ce4765dd2cf97f93c39afdca439fcbb Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Mon, 16 Oct 2023 09:01:41 +0200 Subject: [PATCH 071/172] #12157 Add subtype to messages --- pandora_console/include/functions_messages.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php index 189844c174..fe35d5b5a6 100644 --- a/pandora_console/include/functions_messages.php +++ b/pandora_console/include/functions_messages.php @@ -122,6 +122,7 @@ function messages_create_message( 'id_usuario_origen' => $usuario_origen, 'subject' => $subject, 'mensaje' => $mensaje, + 'subtype' => 'NOTIF.MESSAGE', 'id_source' => get_notification_source_id('message'), 'timestamp' => get_system_time(), ] From c00445eab0b2872f8733140fadbaf3c4ad647f8e Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 17 Oct 2023 09:05:22 +0200 Subject: [PATCH 072/172] #121773 Fix module name in events view --- pandora_console/operation/events/events.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index e7a20b8642..22c3bb8eda 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -540,19 +540,6 @@ if (is_ajax() === true) { ); } - if (empty($tmp->module_name) === false) { - $tmp->module_name = ui_print_truncate_text( - $tmp->module_name, - 'module_medium', - false, - true, - false, - '…', - true, - true, - ); - } - if (empty($tmp->comments) === false) { $tmp->comments = ui_print_comments($tmp->comments, 20); } From 1c609374a83becb228e92bd716704d2579c153e4 Mon Sep 17 00:00:00 2001 From: miguel angel rasteu Date: Tue, 17 Oct 2023 09:27:53 +0200 Subject: [PATCH 073/172] #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 074/172] #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 075/172] #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 076/172] #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 36f12d543255a47e987a1273aa84d0bd4a3c1ab6 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Wed, 18 Oct 2023 20:16:40 +0200 Subject: [PATCH 077/172] minor fix --- .../agentes/module_manager_editor_prediction.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/module_manager_editor_prediction.php b/pandora_console/godmode/agentes/module_manager_editor_prediction.php index a2806c5781..095708d2b1 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_prediction.php +++ b/pandora_console/godmode/agentes/module_manager_editor_prediction.php @@ -186,7 +186,15 @@ if (strstr($page, 'policy_modules') === false) { false, '', false, - false + false, + false, + false, + true, + false, + false, + '', + false, + 'pm' ); } else { $modules = index_array(policies_get_modules($policy_id, false, ['id', 'name'])); From e90497df6123e8f7c53f6f1406a93883703cc697 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Wed, 18 Oct 2023 20:17:18 +0200 Subject: [PATCH 078/172] minor fix --- pandora_console/include/functions_html.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 0dd7808092..9c12bba184 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -774,6 +774,7 @@ function html_print_select( $select2_multiple_enable_all=false, $form='', $order=false, + $custom_id=null ) { $output = "\n"; @@ -789,6 +790,10 @@ function html_print_select( $id = preg_replace('/[^a-z0-9\:\;\-\_]/i', '', $name.($idcounter[$name] ? $idcounter[$name] : '')); + if ($custom_id !== null) { + $id = $custom_id; + } + $attributes = ''; if (!empty($script)) { $attributes .= ' onchange="'.$script.'"'; From e87790ed037cf55304c0d9b9e43c96a6ddd89850 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 19 Oct 2023 10:39:18 +0200 Subject: [PATCH 079/172] 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 080/172] #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 081/172] #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 0ff07f55dd094610f0ba1aa9fca8412ffa3a01dd Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 20 Oct 2023 15:02:14 +0200 Subject: [PATCH 082/172] oum install checks --- .../lib/UpdateManager/Client.php | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/pandora_console/update_manager_client/lib/UpdateManager/Client.php b/pandora_console/update_manager_client/lib/UpdateManager/Client.php index 42d9e6367a..32f37dfd29 100644 --- a/pandora_console/update_manager_client/lib/UpdateManager/Client.php +++ b/pandora_console/update_manager_client/lib/UpdateManager/Client.php @@ -1246,6 +1246,34 @@ class Client } + private function getDirectorySize($directory) + { + if (is_string($directory) === false || is_dir($directory) === false) { + throw new \InvalidArgumentException('Invalid directory path'); + } + + $size = 0; + + if ($handle = opendir($directory)) { + while (false !== ($file = readdir($handle))) { + if ($file != '.' && $file != '..') { + $path = $directory.DIRECTORY_SEPARATOR.$file; + if (is_dir($path) === true) { + // Recursive call for subdirectories. + $size += $this->getDirectorySize($path); + } else { + $size += filesize($path); + } + } + } + + closedir($handle); + } + + return $size; + } + + /** * Update files. * @@ -1263,7 +1291,8 @@ class Client string $from, string $to, bool $test=false, - bool $classic=false + bool $classic=false, + bool $called_recursively=false ) :void { if (is_dir($from) !== true || is_readable($from) !== true) { throw new \Exception('Cannot access patch files '.$from); @@ -1284,6 +1313,18 @@ class Client throw new \Exception('Files are not readable'); } + if ($test === true && $called_recursively === false) { + // Get size of folder and its subfolders corresponding to "from" path containing those files + // that will be updated in product. + // Do once. + $source_size = $this->getDirectorySize($from); + $source_size = 999999999999; + // Check available disk space before writing files. + if (disk_free_space($to) < $source_size) { + throw new \Exception('Not enough disk space to write the files'); + } + } + $created_directories = []; while (($pf = readdir($pd)) !== false) { @@ -1308,11 +1349,13 @@ class Client $created_directories[] = $dest; } - $this->updateFiles($version, $pf.'/', $to, $test, $classic); + $this->updateFiles($version, $pf.'/', $to, $test, $classic, true); } else { // It's a file. if ($test === true) { - if (is_writable($target_folder) !== true) { + if (is_writable($target_folder) !== true + || (file_exists($dest) === true && is_writable($dest) !== true) + ) { throw new \Exception($dest.' is not writable'); } } else { From 0e58c64a390e57ff06696d42c117f534fb7da762 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Mon, 23 Oct 2023 11:14:30 +0200 Subject: [PATCH 083/172] #12260 Adjusted icon path depending on icon extension --- pandora_console/godmode/groups/group_list.php | 3 +++ .../include/javascript/jquery.pandora.controls.js | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 00bbdddb39..49638d2100 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -84,6 +84,9 @@ if (is_ajax() === true) { } $group = db_get_row('tgrupo', 'id_grupo', $id_group); + if (str_contains($group['icon'], '.png') === true) { + $group['folder'] = 'groups_small/'; + } echo json_encode($group); return; diff --git a/pandora_console/include/javascript/jquery.pandora.controls.js b/pandora_console/include/javascript/jquery.pandora.controls.js index c42f205b60..640e83c26d 100644 --- a/pandora_console/include/javascript/jquery.pandora.controls.js +++ b/pandora_console/include/javascript/jquery.pandora.controls.js @@ -331,9 +331,13 @@ id_group: id_group }, function(data) { + let routeImg = + typeof data.folder === "undefined" + ? "images/" + : "images/" + data.folder; $("img", config.spanPreview).attr( "src", - "images/" + data["icon"] + routeImg + data["icon"] ); $("a", config.spanPreview).attr("href", hrefNew); }, From 2688d7033257279418eb349cf9326ec191222cb5 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 23 Oct 2023 15:50:01 +0200 Subject: [PATCH 084/172] oum update checks --- .../update_manager_client/lib/UpdateManager/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/update_manager_client/lib/UpdateManager/Client.php b/pandora_console/update_manager_client/lib/UpdateManager/Client.php index 32f37dfd29..f8c584c5a9 100644 --- a/pandora_console/update_manager_client/lib/UpdateManager/Client.php +++ b/pandora_console/update_manager_client/lib/UpdateManager/Client.php @@ -1318,7 +1318,7 @@ class Client // that will be updated in product. // Do once. $source_size = $this->getDirectorySize($from); - $source_size = 999999999999; + // Check available disk space before writing files. if (disk_free_space($to) < $source_size) { throw new \Exception('Not enough disk space to write the files'); From 183812635442e492be4481c6c54d555e69539772 Mon Sep 17 00:00:00 2001 From: Jorge Rincon Date: Tue, 24 Oct 2023 09:57:25 +0200 Subject: [PATCH 085/172] #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 086/172] #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 .= '