html element.
*
- * The element will have an id like: "password-$name"
- *
- * @param mixed parameters:
+ * @param array $options Parameters:
* - id: string
* - style: string
+ * - class: string
+ * - title: string
* - hidden: boolean
- * - content: string
- * @param bool return or echo flag
+ * - content: string.
+ * @param boolean $return Return or echo flag.
*
* @return string HTML code if return parameter is true.
*/
-function html_print_div($options, $return=false)
-{
+function html_print_div(
+ array $options,
+ bool $return=false
+) {
$output = '
html element.
*
* @param array $options Parameters
- * - id: string
- * - style: string
- * - title: string
+ * - id: string.
+ * - style: string.
+ * - title: string.
* - href: string.
+ * - content: string.
* @param boolean $return Return or echo flag.
*
* @return string HTML code if return parameter is true.
diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php
index 1544a9f8fa..cad1dbf91a 100755
--- a/pandora_console/include/functions_io.php
+++ b/pandora_console/include/functions_io.php
@@ -227,7 +227,7 @@ function io_safe_output_array(&$item, $key=false, $utf8=true)
* @param string|array $value String or array of strings to be cleaned.
* @param boolean $utf8 Flag, set the output encoding in utf8, by default true.
*
- * @return string
+ * @return mixed
*/
function io_safe_output($value, $utf8=true)
{
diff --git a/pandora_console/include/functions_network.php b/pandora_console/include/functions_network.php
index 9d81bf8bdc..9df4f8dbc4 100644
--- a/pandora_console/include/functions_network.php
+++ b/pandora_console/include/functions_network.php
@@ -21,70 +21,6 @@
// Write here requires and definitions.
-/**
- * Get the tnetwok_matrix summatory data.
- *
- * @param integer $top Number of hosts to show.
- * @param boolean $talker Talker (true) or listetener (false).
- * @param integer $start Utimestamp of start time.
- * @param integer $end Utimestamp of end time.
- * @param string $ip_filter Ip to filter.
- * @param boolean $order_by_bytes True by top by bytes. False by packets.
- * @param array $host_filter Host filter array.
- *
- * @return array With requested data.
- */
-function network_matrix_get_top(
- $top,
- $talker,
- $start,
- $end,
- $ip_filter='',
- $order_by_bytes=true,
- $host_filter=[]
-) {
- $field_to_group = ($talker === true) ? 'source' : 'destination';
- $field_to_order = ($order_by_bytes === true) ? 'sum_bytes' : 'sum_pkts';
- $filter_sql = '';
- if (!empty($ip_filter)) {
- $filter_field = ($talker === true) ? 'destination' : 'source';
- $filter_sql = sprintf('AND %s="%s"', $filter_field, $ip_filter);
- }
-
- $host_filter_sql = '';
- if (!empty($host_filter)) {
- $host_filter_sql = sprintf(
- ' AND %s IN ("%s")',
- $field_to_group,
- implode('","', $host_filter)
- );
- }
-
- $sql = sprintf(
- 'SELECT SUM(bytes) sum_bytes, SUM(pkts) sum_pkts, %s host
- FROM tnetwork_matrix
- WHERE utimestamp > %d AND utimestamp < %d
- %s
- %s
- GROUP BY %s
- ORDER BY %s DESC
- LIMIT %d',
- $field_to_group,
- $start,
- $end,
- $filter_sql,
- $host_filter_sql,
- $field_to_group,
- $field_to_order,
- $top
- );
-
- $data = db_get_all_rows_sql($sql);
-
- return ($data !== false) ? $data : [];
-}
-
-
/**
* Get the possible actions on networking.
*
@@ -169,84 +105,6 @@ function network_format_bytes($value)
}
-/**
- * Build netflow data structure to network map.
- *
- * @param integer $start Time in timestamp format.
- * @param integer $end Time in timestamp format.
- * @param integer $top Max data to show.
- * @param boolean $talker True to get top tolkers. False for listeners.
- *
- * @return array With map structure.
- */
-function network_build_map_data($start, $end, $top, $talker)
-{
- $data = network_matrix_get_top($top, $talker, $start, $end);
-
- $hosts = array_map(
- function ($elem) {
- return $elem['host'];
- },
- $data
- );
- $inverse_hosts = array_flip($hosts);
-
- $nodes = array_map(
- function ($elem) {
- return network_init_node_map($elem);
- },
- $hosts
- );
-
- $relations = [];
- $orphan_relations = [];
- foreach ($hosts as $host) {
- $host_top = network_matrix_get_top(
- $top,
- !$talker,
- $start,
- $end,
- $host,
- true,
- $hosts
- );
- foreach ($host_top as $sd) {
- $src_index = $inverse_hosts[$host];
- $dst_index = $inverse_hosts[$sd['host']];
- if (isset($src_index) === false || isset($dst_index) === false) {
- continue;
- }
-
- network_init_relation_map(
- $relations,
- $src_index,
- $dst_index,
- network_format_bytes($sd['sum_bytes'])
- );
- }
-
- // Put the orphans on Other node.
- if (empty($host_top)) {
- $other_id = (end($inverse_hosts) + 1);
- // TODOS: Add the data.
- network_init_relation_map(
- $orphan_relations,
- $other_id,
- $inverse_hosts[$host]
- );
- }
- }
-
- // Put the Others node and their relations.
- if (empty($orphan_relations) === false) {
- $nodes[] = network_init_node_map(__('Others'));
- $relations = array_merge($relations, $orphan_relations);
- }
-
- return network_general_map_configuration($nodes, $relations);
-}
-
-
/**
* Return the array to pass to constructor to NetworkMap.
*
diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php
index d7b2f8236a..ef30d852f0 100644
--- a/pandora_console/include/functions_notifications.php
+++ b/pandora_console/include/functions_notifications.php
@@ -1080,6 +1080,27 @@ function notifications_print_dropdown_element($message_info)
break;
}
+ $split_subject = explode(' ', io_safe_output($message_info['subject']));
+ $is_image = false;
+ $img = '';
+ foreach ($split_subject as $item) {
+ if ($is_image) {
+ if (preg_match('/src/', $item)) {
+ $img .= $item.' >';
+ $is_image = false;
+ }
+ }
+
+ if (preg_match('/img/', $item)) {
+ $img = '
![]()
__('Local modules'), 'class' => 'invert_filter']);
$tdata[1] = '
'.format_numeric($server_performance['total_local_modules']).'';
$tdata[2] = '
'.format_numeric($server_performance['local_modules_rate'], 2).'';
- $tdata[3] = html_print_image('images/database.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec ';
+ $tdata[3] = html_print_image('images/module.png', true, ['title' => __('Ratio').': '.__('Modules by second'), 'class' => 'invert_filter']).'/sec ';
$table_srv->rowclass[] = '';
$table_srv->data[] = $tdata;
@@ -13580,43 +13572,6 @@ function reporting_header_table_for_pdf($title='', $description='')
}
-/**
- * Build the required data to build network traffic top N report
- *
- * @param int Period (time window).
- * @param array Information about the item of report.
- * @param bool Pdf or not
- *
- * @return array With report presentation info and report data.
- */
-function reporting_nt_top_n_report($period, $content, $pdf)
-{
- $return = [];
- $return['type'] = 'nt_top_n';
- $return['title'] = $content['name'];
- $return['landscape'] = $content['landscape'];
- $return['pagebreak'] = $content['pagebreak'];
- $return['description'] = $content['description'];
-
- // Get the data sent and received
- $return['data'] = [];
- $start_time = ($period['datetime'] - (int) $content['period']);
- $return['data']['send'] = network_matrix_get_top(
- $content['top_n_value'],
- true,
- $start_time,
- $period['datetime']
- );
- $return['data']['recv'] = network_matrix_get_top(
- $content['top_n_value'],
- false,
- $start_time,
- $period['datetime']
- );
- return $return;
-}
-
-
/**
* Will display an hourly analysis of the selected period.
*
diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php
index 4d8f65ded6..9877842e0a 100644
--- a/pandora_console/include/functions_reporting_html.php
+++ b/pandora_console/include/functions_reporting_html.php
@@ -403,10 +403,6 @@ function reporting_html_print_report($report, $mini=false, $report_info=1)
reporting_enterprise_html_SLA_monthly($table, $item, $mini);
break;
- case 'nt_top_n':
- reporting_html_nt_top_n($table, $item, $mini);
- break;
-
case 'SLA_weekly':
reporting_enterprise_html_SLA_weekly($table, $item, $mini);
break;
@@ -5018,25 +5014,25 @@ function reporting_get_agents_by_status($data, $graph_width=250, $graph_height=1
$agent_data = [];
$agent_data[0] = html_print_image('images/agent_critical.png', true, ['title' => __('Agents critical')]);
- $agent_data[1] = "
".format_numeric($data['agent_critical']).'';
+ $agent_data[1] = "
".format_numeric($data['agent_critical']).'';
$agent_data[2] = html_print_image('images/agent_warning.png', true, ['title' => __('Agents warning')]);
- $agent_data[3] = "
".format_numeric($data['agent_warning']).'';
+ $agent_data[3] = "
".format_numeric($data['agent_warning']).'';
$table_agent->data[] = $agent_data;
$agent_data = [];
$agent_data[0] = html_print_image('images/agent_ok.png', true, ['title' => __('Agents ok')]);
- $agent_data[1] = "
".format_numeric($data['agent_ok']).'';
+ $agent_data[1] = "
".format_numeric($data['agent_ok']).'';
$agent_data[2] = html_print_image('images/agent_unknown.png', true, ['title' => __('Agents unknown')]);
- $agent_data[3] = "
".format_numeric($data['agent_unknown']).'';
+ $agent_data[3] = "
".format_numeric($data['agent_unknown']).'';
$table_agent->data[] = $agent_data;
$agent_data = [];
$agent_data[0] = html_print_image('images/agent_notinit.png', true, ['title' => __('Agents not init')]);
- $agent_data[1] = "
".format_numeric($data['agent_not_init']).'';
+ $agent_data[1] = "
".format_numeric($data['agent_not_init']).'';
$agent_data[2] = '';
$agent_data[3] = '';
@@ -5591,65 +5587,6 @@ function reporting_get_event_histogram_meta($width)
}
-/**
- * Print network traffic data into top n tables
- * (one for received data and another for sent)
- *
- * @param stdClass Table class to paint the report
- * @param array Associative array with info about
- * @param bool Unused
- */
-function reporting_html_nt_top_n($table, $item, $mini)
-{
- // Prepare the table
- $table_top = new stdClass();
- $table_top->cellpadding = 0;
- $table_top->cellspacing = 0;
- $table_top->width = '100%';
- $table_top->class = 'databox data';
- $table_top->cellpadding = 0;
- $table_top->cellspacing = 0;
- $table_top->width = '100%';
- $table_top->class = 'databox data';
- $table_top->head['host'] = __('Agent');
- $table_top->head['bytes'] = __('Kilobytes');
- $table_top->head['pkts'] = __('Packages');
-
- // Build the table for sent packages
- if (empty($item['data']['send'])) {
- $table->data['send_title'] = '
'.__('No network traffic sent data').'
';
- } else {
- foreach ($item['data']['send'] as $s_item) {
- $table_top->data[] = [
- 'host' => $s_item['host'],
- 'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
- 'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
- ];
- }
-
- $table->data['send_title'] = '
'.__('Network traffic sent').'
';
- $table->data['send'] = html_print_table($table_top, true);
- }
-
- // Reset the table and build the table for received packages
- $table_top->data = [];
- if (empty($item['data']['send'])) {
- $table->data['recv_title'] = '
'.__('No network traffic received data').'
';
- } else {
- foreach ($item['data']['recv'] as $s_item) {
- $table_top->data[] = [
- 'host' => $s_item['host'],
- 'bytes' => remove_right_zeros(number_format(($s_item['sum_bytes'] / 1024), $config['graph_precision'])),
- 'pkts' => remove_right_zeros(number_format($s_item['sum_pkts'], $config['graph_precision'])),
- ];
- }
-
- $table->data['recv_title'] = '
'.__('Network traffic received').'
';
- $table->data['recv'] = html_print_table($table_top, true);
- }
-}
-
-
function reporting_html_planned_downtimes_table($planned_downtimes)
{
global $config;
diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php
index 192940c8ed..fbf647d392 100755
--- a/pandora_console/include/functions_reports.php
+++ b/pandora_console/include/functions_reports.php
@@ -891,13 +891,6 @@ function reports_get_report_types($template=false, $not_editor=false)
];
}
- if (!is_metaconsole()) {
- $types['nt_top_n'] = [
- 'optgroup' => __('Network traffic'),
- 'name' => __('Network Traffic Top N'),
- ];
- }
-
if ($template === false) {
$types['permissions_report'] = [
'optgroup' => __('Permissions report'),
diff --git a/pandora_console/include/functions_servers.php b/pandora_console/include/functions_servers.php
index 75cc19c0ee..69f14e42f1 100644
--- a/pandora_console/include/functions_servers.php
+++ b/pandora_console/include/functions_servers.php
@@ -1202,7 +1202,7 @@ function servers_show_type($id)
case 8:
$return = html_print_image(
- 'images/module_wux.png',
+ 'images/module-wux.png',
true,
[
'title' => get_product_name().' WUX server',
diff --git a/pandora_console/include/functions_snmp_browser.php b/pandora_console/include/functions_snmp_browser.php
index 5c55dd4e69..89aacde9c6 100644
--- a/pandora_console/include/functions_snmp_browser.php
+++ b/pandora_console/include/functions_snmp_browser.php
@@ -604,9 +604,11 @@ function snmp_browser_print_oid(
if ($custom_action != '') {
$table->head[0] = '
'.$closer.$custom_action.'';
} else {
+ $table->headstyle[0] = 'text-align: left';
$table->head[0] = $closer;
}
+ $table->headstyle[1] = 'text-align: left';
$table->head[1] = __('OID Information');
$output .= html_print_table($table, true);
@@ -636,7 +638,7 @@ function snmp_browser_print_oid(
__('Create network component'),
'create_network_component',
false,
- 'class="sub add float-left"',
+ 'class="sub add float-left mrgn_right_20px"',
true
);
@@ -1065,16 +1067,16 @@ function snmp_browser_print_container(
);
$output .= '
';
- $output .= '
'.html_print_image('images/spinner.gif', true).'
';
+ $output .= '
'.html_print_image('images/spinner.gif', true).'
';
$output .= '
';
$output .= '
';
- $output .= '
';
+ $output .= '
';
$output .= '