";
-if (is_metaconsole()) {
- echo '
-
-
- '.__('Draw live filter').'
- |
-
- ';
-
+// Add nodes list.
+if (is_metaconsole() === true) {
$list_servers = [];
-
$servers = db_get_all_rows_sql(
'SELECT *
FROM tmetaconsole_setup'
@@ -244,62 +241,245 @@ if (is_metaconsole()) {
metaconsole_restore_db();
}
- echo '';
- echo ''.__('Connection').' | ';
- echo ''.html_print_select(
- $list_servers,
- 'connection_name',
- $connection_name,
+ $nodeListInput = html_print_label_input_block(
+ __('Connection'),
+ html_print_select(
+ $list_servers,
+ 'connection_name',
+ $connection_name,
+ '',
+ '',
+ 0,
+ true,
+ false,
+ false
+ )
+ );
+} else {
+ $nodeListInput = '';
+}
+
+$class_not_period = ($is_period === true) ? 'nf_hidden' : 'nf_display';
+$class_period = ($is_period === true) ? 'nf_display' : 'nf_hidden';
+
+$max_values = [
+ '2' => '2',
+ '5' => '5',
+ '10' => '10',
+ '15' => '15',
+ '20' => '20',
+ '25' => '25',
+ '50' => '50',
+ $max_aggregates => $max_aggregates,
+];
+
+$aggregate_list = [];
+$aggregate_list = [
+ 'srcip' => __('Src Ip Address'),
+ 'dstip' => __('Dst Ip Address'),
+ 'srcport' => __('Src Port'),
+ 'dstport' => __('Dst Port'),
+];
+
+$advanced_toggle = '';
+$advanced_toggle .= '';
+if ($netflow_disable_custom_lvfilters) {
+ $advanced_toggle .= ' | ';
+ $advanced_toggle .= ' | ';
+} else {
+ $advanced_toggle .= ''.__('Filter').' | ';
+ $advanced_toggle .= ''.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).' | ';
+}
+
+$advanced_toggle .= ''.__('Load filter').' | ';
+$user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
+$user_groups[0] = 0;
+// Add all groups.
+$sql = 'SELECT *
+ FROM tnetflow_filter
+ WHERE id_group IN ('.implode(',', array_keys($user_groups)).')';
+$advanced_toggle .= "".html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true);
+$advanced_toggle .= html_print_input_hidden('filter_selected', $filter_selected, false);
+$advanced_toggle .= ' | ';
+$advanced_toggle .= ' ';
+
+$advanced_toggle .= "";
+if ($netflow_disable_custom_lvfilters) {
+ $advanced_toggle .= ' | ';
+ $advanced_toggle .= ' | ';
+} else {
+ $advanced_toggle .= "".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip: 25.46.157.214,160.253.135.249'), true).' | ';
+ $advanced_toggle .= ''.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).' | ';
+}
+
+if ($netflow_disable_custom_lvfilters) {
+ $advanced_toggle .= ' | ';
+ $advanced_toggle .= ' | ';
+} else {
+ $advanced_toggle .= "".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip: 25.46.157.214,160.253.135.249'), true).' | ';
+ $advanced_toggle .= ''.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).' | ';
+}
+
+$advanced_toggle .= ' ';
+
+$advanced_toggle .= "";
+if ($netflow_disable_custom_lvfilters) {
+ $advanced_toggle .= ' | ';
+ $advanced_toggle .= ' | ';
+} else {
+ $advanced_toggle .= "".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22: 80,22'), true).' | ';
+ $advanced_toggle .= ''.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).' | ';
+}
+
+if ($netflow_disable_custom_lvfilters) {
+ $advanced_toggle .= ' | ';
+ $advanced_toggle .= ' | ';
+} else {
+ $advanced_toggle .= "".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22: 80,22'), true).' | ';
+ $advanced_toggle .= ''.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).' | ';
+}
+
+$advanced_toggle .= ' ';
+
+$advanced_toggle .= "";
+if ($netflow_disable_custom_lvfilters) {
+ $advanced_toggle .= ' | ';
+ $advanced_toggle .= ' | ';
+} else {
+ $advanced_toggle .= ''.ui_print_help_icon('pcap_filter', true).' | ';
+ $advanced_toggle .= "".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true).' | ';
+}
+
+$advanced_toggle .= ' ';
+$advanced_toggle .= '';
+
+$onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;";
+$radio_buttons = __('Yes').' '.html_print_radio_button_extended(
+ 'address_resolution',
+ 1,
+ '',
+ $address_resolution,
+ false,
+ $onclick,
+ '',
+ true
+).' ';
+$radio_buttons .= __('No').' '.html_print_radio_button(
+ 'address_resolution',
+ 0,
+ '',
+ $address_resolution,
+ true
+);
+$advanced_toggle .= ''.__('IP address resolution').''.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true).' | ';
+$advanced_toggle .= ''.$radio_buttons.' | ';
+
+$advanced_toggle .= ''.__('Source ip').' | ';
+$advanced_toggle .= ''.html_print_input_text('router_ip', $filter['router_ip'], false, 40, 80, true).' | ';
+
+$advanced_toggle .= ' ';
+
+$advanced_toggle .= ' ';
+
+// Read filter type.
+if (empty($filter['advanced_filter']) === false) {
+ $filter_type = 1;
+} else {
+ $filter_type = 0;
+}
+
+$filterTable = new stdClass();
+$filterTable->id = '';
+$filterTable->class = 'filter-table-adv';
+$filterTable->size = [];
+$filterTable->size[0] = '33%';
+$filterTable->size[1] = '33%';
+$filterTable->size[2] = '33%';
+$filterTable->data = [];
+
+if (empty($nodeListInput) === false) {
+ $filterTable->data[-1][] = $nodeListInput;
+}
+
+$filterTable->data[0][0] = html_print_label_input_block(
+ __('Interval'),
+ html_print_extended_select_for_time(
+ 'period',
+ $period,
'',
'',
0,
- true,
false,
- false
- ).' | ';
- echo '
';
-}
+ true
+ ),
+ [ 'div_id' => 'period_container' ]
+);
- echo '';
-
- $class_not_period = ($is_period) ? 'nf_hidden' : 'nf_display';
- $class_period = ($is_period) ? 'nf_display' : 'nf_hidden';
- echo '';
- echo ''.__('Interval').'';
- echo ''.__('Start date').'';
- echo ' | ';
- echo '';
- echo html_print_extended_select_for_time('period', $period, '', '', 0, false, true, false, true, $class_period);
- echo html_print_input_text('date_lower', $date_lower, false, 13, 10, true, false, false, '', $class_not_period);
- echo html_print_image(
- 'images/calendar_view_day.png',
- true,
+$filterTable->data[0][0] .= html_print_label_input_block(
+ __('Start date'),
+ html_print_div(
[
- 'alt' => 'calendar',
- 'class' => $class_not_period,
- ]
- ).html_print_input_text('time_lower', $time_lower, false, 10, 8, true, false, false, '', $class_not_period);
- echo html_print_checkbox(
- 'is_period',
- 1,
- ($is_period === true) ? 1 : 0,
- true,
- false,
- 'nf_view_click_period(event)'
- );
- echo ui_print_help_tip(__('Select this checkbox to write interval instead a date.'), true);
- echo ' | ';
+ 'class' => '',
+ 'content' => html_print_input_text(
+ 'date_lower',
+ $date_lower,
+ false,
+ 13,
+ 10,
+ true
+ ).html_print_image(
+ 'images/calendar_view_day.png',
+ true,
+ [
+ 'alt' => 'calendar',
+ 'class' => 'main_menu_icon invert_filter',
+ ]
+ ).html_print_input_text(
+ 'time_lower',
+ $time_lower,
+ false,
+ 10,
+ 8,
+ true
+ ),
+ ],
+ true
+ ),
+ [ 'div_id' => 'end_date_container' ]
+);
- echo ''.__('End date').' | ';
- echo ''.html_print_input_text('date', $date, false, 13, 10, true).html_print_image(
- 'images/calendar_view_day.png',
- true,
- ['alt' => 'calendar']
- ).html_print_input_text('time', $time, false, 10, 8, true);
- echo ' | ';
+$filterTable->data[0][1] = html_print_label_input_block(
+ __('End date'),
+ html_print_div(
+ [
+ 'class' => '',
+ 'content' => html_print_input_text(
+ 'date',
+ $date,
+ false,
+ 13,
+ 10,
+ true
+ ).html_print_image(
+ 'images/calendar_view_day.png',
+ true,
+ ['alt' => 'calendar']
+ ).html_print_input_text(
+ 'time',
+ $time,
+ false,
+ 10,
+ 8,
+ true
+ ),
+ ],
+ true
+ )
+);
- echo ''.__('Resolution').ui_print_help_tip(__('The interval will be divided in chunks the length of the resolution.'), true).' | ';
- echo ''.html_print_select(
+$filterTable->data[0][2] = html_print_label_input_block(
+ __('Resolution'),
+ html_print_select(
netflow_resolution_select_params(),
'interval_length',
$interval_length,
@@ -309,13 +489,27 @@ if (is_metaconsole()) {
true,
false,
false
- ).' | ';
+ ).ui_print_input_placeholder(
+ __('The interval will be divided in chunks the length of the resolution.'),
+ true
+ )
+);
- echo '
';
- echo '';
+$filterTable->data[1][] = html_print_label_input_block(
+ __('Defined period'),
+ html_print_checkbox_switch(
+ 'is_period',
+ 1,
+ ($is_period === true) ? 1 : 0,
+ true,
+ false,
+ 'nf_view_click_period(event)'
+ )
+);
- echo ''.__('Type').' | ';
- echo ''.html_print_select(
+$filterTable->data[1][] = html_print_label_input_block(
+ __('Type'),
+ html_print_select(
netflow_get_chart_types(),
'chart_type',
$chart_type,
@@ -323,224 +517,157 @@ if (is_metaconsole()) {
'',
0,
true
- ).' | ';
+ )
+);
- echo ''.__('Max. values').' | ';
- $max_values = [
- '2' => '2',
- '5' => '5',
- '10' => '10',
- '15' => '15',
- '20' => '20',
- '25' => '25',
- '50' => '50',
- $max_aggregates => $max_aggregates,
- ];
- echo ''.html_print_select($max_values, 'max_aggregates', $max_aggregates, '', '', 0, true).''.html_print_image('images/edit.svg', true, ['id' => 'pencil', 'class' => 'main_menu_icon invert_filter']).'';
- echo ' | ';
-
- echo ''.__('Aggregate by').' | ';
- $aggregate_list = [];
- $aggregate_list = [
- 'srcip' => __('Src Ip Address'),
- 'dstip' => __('Dst Ip Address'),
- 'srcport' => __('Src Port'),
- 'dstport' => __('Dst Port'),
- ];
- echo ''.html_print_select($aggregate_list, 'aggregate', $filter['aggregate'], '', '', 0, true, false, true, '', false).' | ';
-
- echo '
';
-
- // Read filter type.
- if ($filter['advanced_filter'] != '') {
- $filter_type = 1;
- } else {
- $filter_type = 0;
- }
-
- echo "";
-
- echo "".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).' | ';
-
- echo '
';
- echo "";
-
- echo ''.__('Name').' | ';
- echo "".html_print_input_text(
- 'name',
- $filter['id_name'],
- false,
- 20,
- 80,
- true
- ).' | ';
- $own_info = get_user_info($config['id_user']);
- echo ''.__('Group').' | ';
- echo "".html_print_select_groups($config['id_user'], 'AR', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).' | ';
- echo '
';
-
- $advanced_toggle = '';
-
- $advanced_toggle .= '';
- if ($netflow_disable_custom_lvfilters) {
- $advanced_toggle .= ' | ';
- $advanced_toggle .= ' | ';
- } else {
- $advanced_toggle .= ''.__('Filter').' | ';
- $advanced_toggle .= ''.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).' | ';
- }
-
-
-
- $advanced_toggle .= ''.__('Load filter').' | ';
- $user_groups = users_get_groups($config['id_user'], 'AR', $own_info['is_admin'], true);
- $user_groups[0] = 0;
- // Add all groups.
- $sql = 'SELECT *
- FROM tnetflow_filter
- WHERE id_group IN ('.implode(',', array_keys($user_groups)).')';
- $advanced_toggle .= "".html_print_select_from_sql($sql, 'filter_id', $filter_id, '', __('Select a filter'), 0, true);
- $advanced_toggle .= html_print_input_hidden('filter_selected', $filter_selected, false);
- $advanced_toggle .= ' | ';
- $advanced_toggle .= '
';
-
- $advanced_toggle .= "";
- if ($netflow_disable_custom_lvfilters) {
- $advanced_toggle .= ' | ';
- $advanced_toggle .= ' | ';
- } else {
- $advanced_toggle .= "".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip: 25.46.157.214,160.253.135.249'), true).' | ';
- $advanced_toggle .= ''.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).' | ';
- }
-
- if ($netflow_disable_custom_lvfilters) {
- $advanced_toggle .= ' | ';
- $advanced_toggle .= ' | ';
- } else {
- $advanced_toggle .= "".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip: 25.46.157.214,160.253.135.249'), true).' | ';
- $advanced_toggle .= ''.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).' | ';
- }
-
- $advanced_toggle .= '
';
-
- $advanced_toggle .= "";
- if ($netflow_disable_custom_lvfilters) {
- $advanced_toggle .= ' | ';
- $advanced_toggle .= ' | ';
- } else {
- $advanced_toggle .= "".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22: 80,22'), true).' | ';
- $advanced_toggle .= ''.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).' | ';
- }
-
- if ($netflow_disable_custom_lvfilters) {
- $advanced_toggle .= ' | ';
- $advanced_toggle .= ' | ';
- } else {
- $advanced_toggle .= "".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22: 80,22'), true).' | ';
- $advanced_toggle .= ''.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).' | ';
- }
-
- $advanced_toggle .= '
';
-
- $advanced_toggle .= "";
- if ($netflow_disable_custom_lvfilters) {
- $advanced_toggle .= ' | ';
- $advanced_toggle .= ' | ';
- } else {
- $advanced_toggle .= ''.ui_print_help_icon('pcap_filter', true).' | ';
- $advanced_toggle .= "".html_print_textarea('advanced_filter', 4, 40, $filter['advanced_filter'], "style='min-height: 0px; width: 90%;'", true).' | ';
- }
-
- $advanced_toggle .= '
';
- $advanced_toggle .= '';
-
- $onclick = "if (!confirm('".__('Warning').'. '.__('IP address resolution can take a lot of time')."')) return false;";
- $radio_buttons = __('Yes').' '.html_print_radio_button_extended(
- 'address_resolution',
- 1,
+$filterTable->data[1][] = html_print_label_input_block(
+ __('Aggregated by'),
+ html_print_select(
+ $aggregate_list,
+ 'aggregate',
+ $filter['aggregate'],
'',
- $address_resolution,
- false,
- $onclick,
'',
- true
- ).' ';
- $radio_buttons .= __('No').' '.html_print_radio_button(
- 'address_resolution',
0,
+ true,
+ false,
+ true,
'',
- $address_resolution,
+ false
+ )
+);
+
+$filterTable->data[2][] = html_print_label_input_block(
+ __('Max values'),
+ html_print_div(
+ [
+ 'class' => '',
+ 'content' => html_print_select(
+ $max_values,
+ 'max_aggregates',
+ $max_aggregates,
+ '',
+ '',
+ 0,
+ true
+ ).html_print_anchor(
+ [
+ 'id' => 'max_values',
+ 'href' => '#',
+ 'onClick' => 'edit_max_value()',
+ 'content' => html_print_image(
+ 'images/edit.svg',
+ true,
+ [
+ 'id' => 'pencil',
+ 'class' => 'main_menu_icon invert_filter',
+ ]
+ ),
+ ],
+ true
+ ),
+ ],
true
- );
- $advanced_toggle .= ''.__('IP address resolution').''.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true).' | ';
- $advanced_toggle .= ''.$radio_buttons.' | ';
+ )
+);
- $advanced_toggle .= ''.__('Source ip').' | ';
- $advanced_toggle .= ''.html_print_input_text('router_ip', $filter['router_ip'], false, 40, 80, true).' | ';
-
- $advanced_toggle .= '
';
-
- $advanced_toggle .= '
';
-
- echo '';
- echo ui_toggle(
+$filterTable->colspan[3][0] = 3;
+$filterTable->data[3][0] = html_print_label_input_block(
+ '',
+ ui_toggle(
$advanced_toggle,
__('Advanced'),
'',
'',
true,
true,
- 'white_box white_box_opened',
- 'no-border flex-row'
- );
- echo ' |
';
- echo '
';
+ '',
+ 'white-box-content',
+ 'box-flat white_table_graph'
+ )
+);
- echo "