From 6c45f51e64c34d233102d76f3d4a31c53e893ebe Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Thu, 25 Jul 2019 16:07:42 +0200 Subject: [PATCH 01/94] Deleted help icon --- pandora_console/include/functions_profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_profile.php b/pandora_console/include/functions_profile.php index 3308cd89b7..dc9f92eb64 100644 --- a/pandora_console/include/functions_profile.php +++ b/pandora_console/include/functions_profile.php @@ -314,7 +314,7 @@ function profile_print_profile_table($id) $tags = tags_get_all_tags(); $data['tags'] = html_print_select($tags, 'assign_tags[]', '', '', __('Any'), '', true, true); - $data['hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true).ui_print_help_icon('no_hierarchy', true); + $data['hierarchy'] = html_print_checkbox('no_hierarchy', 1, false, true); $data['actions'] = html_print_input_image('add', 'images/add.png', 1, '', true); $data['actions'] .= html_print_input_hidden('id', $id, true); From a9a2ca5178077b49b58454e9a3fafab046574625 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Fri, 30 Aug 2019 11:58:50 +0200 Subject: [PATCH 02/94] Change label for disabled status - #4573 --- pandora_console/godmode/agentes/agent_manager.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 6ee2343fc0..76eacc0808 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -667,7 +667,7 @@ $table_adv_status .= html_print_checkbox_switch( $disabled, true ); -$table_adv_status .= '

'.__('Disabled').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'

'; +$table_adv_status .= '

'.__('Disabled mode').': '.ui_print_help_tip(__('If the remote configuration is enabled, it will also go into standby mode when disabling it.'), true).'

'; $table_adv_status .= ''; // Url address. From 90b61533f856dfb9b8f7693c3d9bc89a47e71243 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 10 Sep 2019 10:26:28 +0200 Subject: [PATCH 03/94] Fixed visual bugs in black theme - #4572 --- pandora_console/general/news_dialog.php | 2 +- pandora_console/images/icon_error_db.png | Bin 2165 -> 2379 bytes pandora_console/images/icon_error_mr.png | Bin 2183 -> 2415 bytes pandora_console/images/icon_info_mr.png | Bin 1653 -> 1690 bytes pandora_console/images/icon_success_db.png | Bin 2255 -> 2082 bytes pandora_console/images/icon_success_mr.png | Bin 2228 -> 1987 bytes pandora_console/images/icon_warning_db.png | Bin 2121 -> 1882 bytes .../include/styles/pandora_black.css | 41 +++++++++++++++++- 8 files changed, 40 insertions(+), 3 deletions(-) diff --git a/pandora_console/general/news_dialog.php b/pandora_console/general/news_dialog.php index 37ca016edf..9ab685d39f 100644 --- a/pandora_console/general/news_dialog.php +++ b/pandora_console/general/news_dialog.php @@ -40,7 +40,7 @@ if (!empty($news)) { // Prints news dialog template echo ''; // Learn mode / Normal mode. $table_adv_module_mode = '

'.__('Module definition').':

'; From b12facc89b35131b49027cdd882e228dff43625b Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 12 Sep 2019 12:25:31 +0200 Subject: [PATCH 05/94] Remove hint in metaconsole monitoring view --- pandora_console/include/functions_html.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 08d60dbb6e..2f66590a1c 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2812,9 +2812,12 @@ function html_print_autocomplete_modules( ['style' => 'background: url(images/search_module.png) no-repeat right;'] ); html_print_input_hidden($name.'_hidden', $id_agent_module); - ui_print_help_tip(__('Type at least two characters to search the module.'), false); - $javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false); + if (!is_metaconsole()) { + ui_print_help_tip(__('Type at least two characters to search the module.'), false); + } + + $javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false); ?> From 7a20ec8e8217a8d31ee62cced9840ea210e25fb0 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 4 Nov 2019 16:04:26 +0100 Subject: [PATCH 10/94] Fixed CLI delete data --- pandora_server/util/pandora_manage.pl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3b72f91063..cb60ebfaa2 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -639,9 +639,9 @@ sub pandora_delete_module_data ($$) { my $buffer = 1000; while(1) { - my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); - my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); + my $nd = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos WHERE id_agente_modulo=?', $id_module); + my $ndinc = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_inc WHERE id_agente_modulo=?', $id_module); + my $ndlog4x = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_log4x WHERE id_agente_modulo=?', $id_module); my $ndstring = get_db_value ($dbh, 'SELECT count(id_agente_modulo) FROM tagente_datos_string WHERE id_agente_modulo=?', $id_module); my $ntot = $nd + $ndinc + $ndlog4x + $ndstring; @@ -651,19 +651,19 @@ sub pandora_delete_module_data ($$) { } if($nd > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos', 'id_agente_modulo='.$id_module, $buffer); } if($ndinc > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_inc WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos_inc', 'id_agente_modulo='.$id_module, $buffer); } if($ndlog4x > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_log4x WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos_log4x', 'id_agente_modulo='.$id_module, $buffer); } if($ndstring > 0) { - db_do ($dbh, 'DELETE FROM tagente_datos_string WHERE id_agente_modulo=? LIMIT ?', $id_module, $buffer); + db_delete_limit($dbh, 'tagente_datos_string', 'id_agente_modulo='.$id_module, $buffer); } } @@ -4421,7 +4421,7 @@ sub cli_delete_data($) { print_log "DELETING THE DATA OF THE AGENT $name\n\n"; - pandora_delete_data($dbh, 'module', $id_agent); + pandora_delete_data($dbh, 'agent', $id_agent); } } else { my $id_agent = get_agent_id($dbh,$name); @@ -4429,7 +4429,7 @@ sub cli_delete_data($) { print_log "DELETING THE DATA OF THE AGENT $name\n\n"; - pandora_delete_data($dbh, 'module', $id_agent); + pandora_delete_data($dbh, 'agent', $id_agent); } } elsif($opt eq '-g' || $opt eq '--g') { From 7c73d5f51aa0a3ff1ca86d69f751ff30bad34b46 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Mon, 4 Nov 2019 17:56:28 +0100 Subject: [PATCH 11/94] Added confirmation to delete a visual console --- pandora_console/godmode/reporting/map_builder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/reporting/map_builder.php b/pandora_console/godmode/reporting/map_builder.php index 8f5774b3a9..32f9f97c17 100644 --- a/pandora_console/godmode/reporting/map_builder.php +++ b/pandora_console/godmode/reporting/map_builder.php @@ -454,10 +454,10 @@ if (!$maps && !is_metaconsole()) { 4 => 'action_buttons', ]; $data[3] = ''.html_print_image('images/copy.png', true).''; - $data[4] = ''.html_print_image('images/cross.png', true).''; + $data[4] = ''.html_print_image('images/cross.png', true).''; } else { $data[3] = ''.html_print_image('images/copy.png', true).''; - $data[4] = ''.html_print_image('images/cross.png', true).''; + $data[4] = ''.html_print_image('images/cross.png', true).''; } } else { $data[3] = ''; From b40f0012db580a0b617a1e04f3e02688d4c370be Mon Sep 17 00:00:00 2001 From: alejandro-campos Date: Tue, 5 Nov 2019 14:34:43 +0100 Subject: [PATCH 12/94] fix bug in meta visual console: group item not retrieving values properly --- .../include/functions_visual_map.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 1c6afb9eed..417b6dc587 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -1900,6 +1900,8 @@ function visual_map_print_item( echo ''; } } else { + $is_meta = is_metaconsole(); + $agents_critical = agents_get_agents( [ 'disabled' => 0, @@ -1908,7 +1910,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $agents_warning = agents_get_agents( [ @@ -1918,7 +1923,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $agents_unknown = agents_get_agents( [ @@ -1928,7 +1936,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $agents_ok = agents_get_agents( [ @@ -1938,7 +1949,10 @@ function visual_map_print_item( ], ['COUNT(*) as total'], 'AR', - false + false, + false, + 0, + $is_meta ); $total_agents = ($agents_critical[0]['total'] + $agents_warning[0]['total'] + $agents_unknown[0]['total'] + $agents_ok[0]['total']); $stat_agent_ok = ($agents_ok[0]['total'] / $total_agents * 100); From 5ea93011d3ce77371c0ee685d22eb59d024d7015 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 12 Nov 2019 09:53:10 +0100 Subject: [PATCH 13/94] Changed title name or description in items table of reports --- .../godmode/reporting/reporting_builder.list_items.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/reporting/reporting_builder.list_items.php b/pandora_console/godmode/reporting/reporting_builder.list_items.php index 1b7d3b4df6..00e93efa28 100755 --- a/pandora_console/godmode/reporting/reporting_builder.list_items.php +++ b/pandora_console/godmode/reporting/reporting_builder.list_items.php @@ -386,7 +386,7 @@ if ($items) { } $table->head[4] = __('Time lapse'); - $table->head[5] = __('Name').' / '.__('Description'); + $table->head[5] = __('Name or Description'); if (check_acl($config['id_user'], 0, 'RM')) { $table->head[6] = ''.__('Op.').''; if ($report_w || $report_m) { From c652f758f4097ad523e99c580f718383541ca056 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 12 Nov 2019 13:06:59 +0100 Subject: [PATCH 14/94] Changed label agent version for agents with satellite os --- pandora_console/operation/gis_maps/ajax.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pandora_console/operation/gis_maps/ajax.php b/pandora_console/operation/gis_maps/ajax.php index c794b69c20..1ec3d93a35 100644 --- a/pandora_console/operation/gis_maps/ajax.php +++ b/pandora_console/operation/gis_maps/ajax.php @@ -302,7 +302,11 @@ switch ($opt) { $osversion_offset = 0; } - $row[] = ui_print_os_icon($agent['id_os'], true, true).' ('.substr($agent['os_version'], $osversion_offset, 15).')'; + if ($agent['os_version'] != '') { + $agent_os_version = ' ('.substr($agent['os_version'], $osversion_offset, 15).')'; + } + + $row[] = ui_print_os_icon($agent['id_os'], true, true).$agent_os_version; $table->data[] = $row; // URL @@ -331,7 +335,12 @@ switch ($opt) { // Agent version $row = []; - $row[] = __('Agent Version'); + if (strtolower(get_os_name($agent['id_os'])) == 'satellite') { + $row[] = __('Satellite Version'); + } else { + $row[] = __('Agent Version'); + } + $row[] = $agent['agent_version']; $table->data[] = $row; From f9215af803dc57a16cbc1d70937988f784bdd3e4 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Tue, 12 Nov 2019 17:33:58 +0100 Subject: [PATCH 15/94] Added tooltip to CSV datatable button --- pandora_console/include/functions_ui.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 3f2736c698..4cd7d338c3 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -3233,6 +3233,7 @@ function ui_print_datatable(array $parameters) { extend: "csv", text : "'.__('Export current page to CSV').'", + titleAttr: "'.__('Export current page to CSV').'", title: "export_'.$parameters['id'].'_current_page_'.date('Y-m-d').'", fieldSeparator: "'.$config['csv_divider'].'", exportOptions : { From f6b86042b21a7e15a184f943d9433dbe21ac3a85 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 13 Nov 2019 12:19:09 +0100 Subject: [PATCH 16/94] Fixed bug in select for linked visual console --- pandora_console/include/functions_visual_map_editor.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/pandora_console/include/functions_visual_map_editor.php b/pandora_console/include/functions_visual_map_editor.php index 0e678c6111..ed99a7b429 100755 --- a/pandora_console/include/functions_visual_map_editor.php +++ b/pandora_console/include/functions_visual_map_editor.php @@ -1447,9 +1447,6 @@ function visual_map_editor_print_hack_translate_strings() + From 68832409315a1bda3050dc18aead95520297de6f Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Mon, 2 Dec 2019 11:54:39 +0100 Subject: [PATCH 27/94] Added control for int values --- pandora_console/include/functions_config.php | 24 ++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 4ee9e682b8..ce1ef90898 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -1403,19 +1403,35 @@ function config_update_config() $error_update[] = __('Database password'); } - if (!config_update_value('history_db_days', get_parameter('history_db_days'))) { + $history_db_days = get_parameter('history_db_days'); + if (!is_numeric($history_db_days) + || $history_db_days <= 0 + || !config_update_value('history_db_days', $history_db_days) + ) { $error_update[] = __('Days'); } - if (!config_update_value('history_event_days', get_parameter('history_event_days'))) { + $history_event_days = get_parameter('history_event_days'); + if (!is_numeric($history_event_days) + || $history_event_days <= 0 + || !config_update_value('history_event_days', $history_event_days) + ) { $error_update[] = __('Event Days'); } - if (!config_update_value('history_db_step', get_parameter('history_db_step'))) { + $history_db_step = get_parameter('history_db_step'); + if (!is_numeric($history_db_step) + || $history_db_step <= 0 + || !config_update_value('history_db_step', $history_db_step) + ) { $error_update[] = __('Step'); } - if (!config_update_value('history_db_delay', get_parameter('history_db_delay'))) { + $history_db_delay = get_parameter('history_db_delay'); + if (!is_numeric($history_db_delay) + || $history_db_delay <= 0 + || !config_update_value('history_db_delay', $history_db_delay) + ) { $error_update[] = __('Delay'); } break; From fecd2c74b59bd7a924724c50591cc7f6a56fb399 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 3 Dec 2019 13:00:59 +0100 Subject: [PATCH 28/94] Added button to refresh graph in container graphs --- .../godmode/reporting/graph_container.php | 14 ++++++++++++++ pandora_console/include/ajax/graph.ajax.php | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/reporting/graph_container.php b/pandora_console/godmode/reporting/graph_container.php index 3b87fc63e3..ca2acf7ca7 100644 --- a/pandora_console/godmode/reporting/graph_container.php +++ b/pandora_console/godmode/reporting/graph_container.php @@ -125,6 +125,20 @@ if ($report_r && $report_w) { get_graphs_container(id_container,hash,time); } }); + + $("div[id^=period_container_] a").on('click', function(e){ + if ($("div[id^=period_container_][id$=_default]").css('display') == 'none') { + $('#refresh_custom_time').show(); + $('#refresh_custom_time').on('click', function(e){ + var time = $('input[id *= hidden-period_container_'+hash+']').val(); + get_graphs_container(id_container,hash,time); + }); + } + else if ($("div[id^=period_container_][id$=_manual]").css('display') == 'none') { + $('#refresh_custom_time').hide(); + } + }); + } }); } diff --git a/pandora_console/include/ajax/graph.ajax.php b/pandora_console/include/ajax/graph.ajax.php index 410a6dd972..ad840f2e6c 100644 --- a/pandora_console/include/ajax/graph.ajax.php +++ b/pandora_console/include/ajax/graph.ajax.php @@ -171,8 +171,9 @@ if ($get_graphs) { '', false, $periods, - 'vertical-align: middle;' + 'vertical-align: middle; margin-bottom:0;' ); + $single_table .= html_print_image('images/refresh_mc.png', true, ['id' => 'refresh_custom_time', 'title' => 'Refresh graph', 'style' => 'cursor:pointer; vertical-align: middle; display:none;']); $single_table .= ''; $single_table .= ''; $single_table .= ''; From d4720c2260d7c1918b818b42f8c558e3a6364149 Mon Sep 17 00:00:00 2001 From: marcos Date: Tue, 3 Dec 2019 13:59:03 +0100 Subject: [PATCH 29/94] add firts changes --- pandora_console/general/header.php | 18 +- .../include/ajax/order_interpreter.php | 62 +++++++ .../include/class/OrderInterpreter.class.php | 157 ++++++++++++++++++ .../include/styles/order_interpreter.css | 29 ++++ 4 files changed, 264 insertions(+), 2 deletions(-) create mode 100644 pandora_console/include/ajax/order_interpreter.php create mode 100644 pandora_console/include/class/OrderInterpreter.class.php create mode 100644 pandora_console/include/styles/order_interpreter.css diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index 368accd39b..b36785329c 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -13,6 +13,8 @@ require_once 'include/functions_messages.php'; require_once 'include/functions_servers.php'; require_once 'include/functions_notifications.php'; +require_once 'include/ajax/order_interpreter.php'; +ui_require_css_file('order_interpreter'); // Check permissions // Global errors/warnings checking. @@ -120,8 +122,13 @@ if ($config['menu_type'] == 'classic') { } $search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" - onkeyup="javascript: fieldKeyWordEmpty = false;" class="search_input" />'; + onkeyup="showinterpreter()" class="search_input" />'; + $search_bar .= ''; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; $search_bar .= ""; $search_bar .= ''; @@ -630,7 +637,14 @@ if ($config['menu_type'] == 'classic') { var fixed_header = ; var new_chat = ; - + + function showinterpreter(){ + if( $('#keywords').val() === ''){ + $('#result_order').hide(); + }else { + $('#result_order').show(); + } + } /** * Loads modal from AJAX to add feedback. */ diff --git a/pandora_console/include/ajax/order_interpreter.php b/pandora_console/include/ajax/order_interpreter.php new file mode 100644 index 0000000000..5edc8913f3 --- /dev/null +++ b/pandora_console/include/ajax/order_interpreter.php @@ -0,0 +1,62 @@ +ajaxMethod($method) === true) { + $order_interpreter->{$method}(); + } else { + $order_interpreter->error('Unavailable method.'); + } +} else { + $order_interpreter->error('Method not found. ['.$method.']'); +} + + +// Stop any execution. +exit; diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php new file mode 100644 index 0000000000..92474d617e --- /dev/null +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -0,0 +1,157 @@ + $msg] + ); + } + + + /** + * Checks if target method is available to be called using AJAX. + * + * @param string $method Target method. + * + * @return boolean True allowed, false not. + */ + public function ajaxMethod($method) + { + global $config; + + // Check access. + check_login(); + + return in_array($method, $this->AJAXMethods); + } + + + /** + * Constructor. + * + * @param boolean $must_run Must run or not. + * @param string $ajax_controller Controller. + * + * @return object + * @throws Exception On error. + */ + public function __construct( + $ajax_controller='include/ajax/order_interpreter' + ) { + $this->ajaxController = $ajax_controller; + $this->pages_name = [ + 0 => __('Agent view'), + 1 => __('Agent Management'), + 2 => __('Manage Agents'), + 3 => __('Manage Policies'), + ]; + $this->pages_url = [ + 0 => ui_get_full_url(), + 1 => ui_get_full_url(), + 2 => ui_get_full_url(), + 3 => ui_get_full_url(), + ]; + + } + + + /** + * Method to print order interpreted on header search input. + * + * @return void + */ + public function getResult() + { + // Take value from input search. + $text = get_parameter('text', ''); + + foreach ($this->pages_name as $key => $value) { + if (preg_match('/'.$text.'/', $value)) { + echo 'pene gordo'; + } + } + + return; + + } + + + /** + * Load JS content. + * function that enables the functions to the buttons when its action is + * completed. + * Assign the url of each button. + * + * @return string HTML code for javascript functionality. + */ + public function loadJS() + { + ob_start(); + ?> + + Date: Tue, 3 Dec 2019 14:26:31 +0100 Subject: [PATCH 30/94] resolv blank page --- pandora_console/include/ajax/order_interpreter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/ajax/order_interpreter.php b/pandora_console/include/ajax/order_interpreter.php index 5edc8913f3..8e4cc557b4 100644 --- a/pandora_console/include/ajax/order_interpreter.php +++ b/pandora_console/include/ajax/order_interpreter.php @@ -30,8 +30,9 @@ global $config; require_once $config['homedir'].'/include/class/OrderInterpreter.class.php'; + if (is_ajax() === false) { - exit; + return; } $ajaxPage = 'include/ajax/order_interpreter'; From 14b8379ccb84f660def22c5950499367ad8795f9 Mon Sep 17 00:00:00 2001 From: marcos Date: Tue, 3 Dec 2019 15:11:16 +0100 Subject: [PATCH 31/94] ajax call, controller, class, match result, return array inputs(example to return) --- pandora_console/general/header.php | 16 ++++++++++++++++ .../include/class/OrderInterpreter.class.php | 12 ++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index b36785329c..ee741e62f2 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -642,6 +642,22 @@ if ($config['menu_type'] == 'classic') { if( $('#keywords').val() === ''){ $('#result_order').hide(); }else { + $.ajax({ + type: "POST", + url: "ajax.php", + dataType: "text", + data: { + page: 'include/ajax/order_interpreter', + method: 'getResult', + text: $('#keywords').val(), + }, + success: function (data) { + console.log(data); + }, + error: function (data) { + console.error("Fatal error in AJAX call to interpreter order", data) + } + }); $('#result_order').show(); } } diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php index 92474d617e..bf253bebd8 100644 --- a/pandora_console/include/class/OrderInterpreter.class.php +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -117,20 +117,20 @@ class OrderInterpreter extends Wizard /** * Method to print order interpreted on header search input. * - * @return void + * @return array */ - public function getResult() + public function getResult():array { // Take value from input search. $text = get_parameter('text', ''); - + $array_found = []; foreach ($this->pages_name as $key => $value) { - if (preg_match('/'.$text.'/', $value)) { - echo 'pene gordo'; + if (preg_match('/.*'.$text.'.*/', $value)) { + $array_found[$key] = ''.$value.''; } } - return; + return $array_found; } From 7eec91b9460a673c77be8fcc70773e6a9d387715 Mon Sep 17 00:00:00 2001 From: marcos Date: Tue, 3 Dec 2019 18:19:32 +0100 Subject: [PATCH 32/94] Show result in normal window --- pandora_console/general/header.php | 14 +++---- .../include/class/OrderInterpreter.class.php | 30 ++++++++++----- .../include/styles/order_interpreter.css | 37 +++++-------------- 3 files changed, 37 insertions(+), 44 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index ee741e62f2..47696d8226 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -124,11 +124,8 @@ if ($config['menu_type'] == 'classic') { $search_bar .= 'onfocus="javascript: if (fieldKeyWordEmpty) $(\'#keywords\').val(\'\');" onkeyup="showinterpreter()" class="search_input" />'; - $search_bar .= ''; + + $search_bar .= '
'; // $search_bar .= 'onClick="javascript: document.quicksearch.submit()"'; $search_bar .= ""; $search_bar .= ''; @@ -629,7 +626,7 @@ if ($config['menu_type'] == 'classic') { }); } - // Resize event + // Resize event. window.addEventListener("resize", function() { attatch_to_image(); }); @@ -645,7 +642,7 @@ if ($config['menu_type'] == 'classic') { $.ajax({ type: "POST", url: "ajax.php", - dataType: "text", + dataType: "html", data: { page: 'include/ajax/order_interpreter', method: 'getResult', @@ -653,7 +650,8 @@ if ($config['menu_type'] == 'classic') { }, success: function (data) { console.log(data); - }, + $('#result_order').html(data); + }, error: function (data) { console.error("Fatal error in AJAX call to interpreter order", data) } diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php index bf253bebd8..0e30df76ad 100644 --- a/pandora_console/include/class/OrderInterpreter.class.php +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -99,16 +99,24 @@ class OrderInterpreter extends Wizard ) { $this->ajaxController = $ajax_controller; $this->pages_name = [ - 0 => __('Agent view'), + 0 => __('Tactical View'), 1 => __('Agent Management'), - 2 => __('Manage Agents'), + 2 => __('List Alerts'), 3 => __('Manage Policies'), ]; $this->pages_url = [ - 0 => ui_get_full_url(), - 1 => ui_get_full_url(), - 2 => ui_get_full_url(), - 3 => ui_get_full_url(), + 0 => ui_get_full_url( + 'index.php?sec=view&sec2=operation/agentes/tactical' + ), + 1 => ui_get_full_url( + 'index.php?sec=gagente&sec2=godmode/agentes/modificar_agente' + ), + 2 => ui_get_full_url( + 'index.php?sec=galertas&sec2=godmode/alerts/alert_list' + ), + 3 => ui_get_full_url( + 'index.php?sec=gmodules&sec2=enterprise/godmode/policies/policies' + ), ]; } @@ -119,18 +127,22 @@ class OrderInterpreter extends Wizard * * @return array */ - public function getResult():array + public function getResult() { // Take value from input search. $text = get_parameter('text', ''); $array_found = []; + echo '
'; + echo '
    '; foreach ($this->pages_name as $key => $value) { if (preg_match('/.*'.$text.'.*/', $value)) { - $array_found[$key] = ''.$value.''; + echo '
  • '; + echo ''; + echo 'GO TO '.$value.'
    '; } } - return $array_found; + echo '
Date: Tue, 3 Dec 2019 18:31:13 +0100 Subject: [PATCH 33/94] update css and preg_match --- .../include/class/OrderInterpreter.class.php | 22 ++++++++++--------- .../include/styles/order_interpreter.css | 2 ++ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php index 0e30df76ad..0f673e25f6 100644 --- a/pandora_console/include/class/OrderInterpreter.class.php +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -125,24 +125,26 @@ class OrderInterpreter extends Wizard /** * Method to print order interpreted on header search input. * - * @return array + * @return void */ public function getResult() { // Take value from input search. $text = get_parameter('text', ''); $array_found = []; - echo '
'; - echo '