mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Change item link filter by image filter in network/flow explorer
Former-commit-id: 521cca18646273361711e75ad85f64a9b9988046
This commit is contained in:
parent
1fa4ef4555
commit
1f89cccbbe
@ -2392,12 +2392,21 @@ function html_print_checkbox_switch($name, $value, $checked=false, $return=false
|
|||||||
/**
|
/**
|
||||||
* Prints an image HTML element.
|
* Prints an image HTML element.
|
||||||
*
|
*
|
||||||
* @param string $src Image source filename.
|
* @param string $src Image source filename.
|
||||||
* @param boolean $return Whether to return or print
|
* @param boolean $return Whether to return or print.
|
||||||
* @param array $options Array with optional HTML options to set. At this moment, the
|
* @param array $options Array with optional HTML options to set.
|
||||||
* following options are supported: alt, style, title, width, height, class, pos_tree.
|
* At this moment, the following options are supported:
|
||||||
* @param boolean $return_src Whether to return src field of image ('images/*.*') or complete html img tag ('<img src="..." alt="...">').
|
* align, border, hspace, ismap, vspace, style, title, height,
|
||||||
* @param boolean $relative Whether to use relative path to image or not (i.e. $relative= true : /pandora/<img_src>).
|
* longdesc, usemap, width, id, class, lang, xml:lang, onclick,
|
||||||
|
* ondblclick, onmousedown, onmouseup, onmouseover, onmousemove,
|
||||||
|
* onmouseout, onkeypress, onkeydown, onkeyup, pos_tree, alt.
|
||||||
|
* @param boolean $return_src Whether to return src field of image
|
||||||
|
* ('images/*.*') or complete html img tag ('<img src="..." alt="...">').
|
||||||
|
* @param boolean $relative Whether to use relative path to image or not
|
||||||
|
* (i.e. $relative= true : /pandora/<img_src>).
|
||||||
|
* @param boolean $no_in_meta Do not show on metaconsole folder at first. Go
|
||||||
|
* directly to the node.
|
||||||
|
* @param boolean $isExternalLink Do not shearch for images in Pandora.
|
||||||
*
|
*
|
||||||
* @return string HTML code if return parameter is true.
|
* @return string HTML code if return parameter is true.
|
||||||
*/
|
*/
|
||||||
@ -2412,9 +2421,9 @@ function html_print_image(
|
|||||||
) {
|
) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
// If metaconsole is in use then don't use skins
|
// If metaconsole is in use then don't use skins.
|
||||||
if (!is_metaconsole()) {
|
if (!is_metaconsole()) {
|
||||||
// Checks if user's skin is available
|
// Checks if user's skin is available.
|
||||||
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
|
$isFunctionSkins = enterprise_include_once('include/functions_skins.php');
|
||||||
|
|
||||||
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
|
||||||
@ -2426,11 +2435,11 @@ function html_print_image(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If metaconsole is activated and image doesn't exists try to search on normal console
|
// If metaconsole is activated and image doesn't exists try to search on normal console.
|
||||||
if (is_metaconsole()) {
|
if (is_metaconsole()) {
|
||||||
if (!$relative) {
|
if (!$relative) {
|
||||||
$working_dir = str_replace('\\', '/', getcwd());
|
$working_dir = str_replace('\\', '/', getcwd());
|
||||||
// Windows compatibility
|
// Windows compatibility.
|
||||||
if ($no_in_meta) {
|
if ($no_in_meta) {
|
||||||
$src = '../../'.$src;
|
$src = '../../'.$src;
|
||||||
} else if (strstr($working_dir, 'enterprise/meta') === false) {
|
} else if (strstr($working_dir, 'enterprise/meta') === false) {
|
||||||
@ -2468,22 +2477,22 @@ function html_print_image(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only return src field of image
|
// Only return src field of image.
|
||||||
if ($return_src) {
|
if ($return_src) {
|
||||||
if (!$return) {
|
if (!$return) {
|
||||||
echo io_safe_input($src);
|
echo io_safe_input($src);
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return io_safe_input($src);
|
return io_safe_input($src);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = '<img src="'.$src.'" ';
|
$output = '<img src="'.$src.'" ';
|
||||||
// Dont use safe_input here or the performance will dead
|
// Dont use safe_input here or the performance will dead.
|
||||||
$style = '';
|
$style = '';
|
||||||
|
|
||||||
if (!empty($options)) {
|
if (!empty($options)) {
|
||||||
// Deprecated or value-less attributes
|
// Deprecated or value-less attributes.
|
||||||
if (isset($options['align'])) {
|
if (isset($options['align'])) {
|
||||||
$style .= 'align:'.$options['align'].';';
|
$style .= 'align:'.$options['align'].';';
|
||||||
// Align is deprecated, use styles.
|
// Align is deprecated, use styles.
|
||||||
@ -2491,23 +2500,23 @@ function html_print_image(
|
|||||||
|
|
||||||
if (isset($options['border'])) {
|
if (isset($options['border'])) {
|
||||||
$style .= 'border:'.$options['border'].'px;';
|
$style .= 'border:'.$options['border'].'px;';
|
||||||
// Border is deprecated, use styles
|
// Border is deprecated, use styles.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['hspace'])) {
|
if (isset($options['hspace'])) {
|
||||||
$style .= 'margin-left:'.$options['hspace'].'px;';
|
$style .= 'margin-left:'.$options['hspace'].'px;';
|
||||||
// hspace is deprecated, use styles
|
// hspace is deprecated, use styles.
|
||||||
$style .= 'margin-right:'.$options['hspace'].'px;';
|
$style .= 'margin-right:'.$options['hspace'].'px;';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['ismap'])) {
|
if (isset($options['ismap'])) {
|
||||||
$output .= 'ismap="ismap" ';
|
$output .= 'ismap="ismap" ';
|
||||||
// Defines the image as a server-side image map
|
// Defines the image as a server-side image map.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options['vspace'])) {
|
if (isset($options['vspace'])) {
|
||||||
$style .= 'margin-top:'.$options['vspace'].'px;';
|
$style .= 'margin-top:'.$options['vspace'].'px;';
|
||||||
// hspace is deprecated, use styles
|
// hspace is deprecated, use styles.
|
||||||
$style .= 'margin-bottom:'.$options['vspace'].'px;';
|
$style .= 'margin-bottom:'.$options['vspace'].'px;';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2515,7 +2524,7 @@ function html_print_image(
|
|||||||
$style .= $options['style'];
|
$style .= $options['style'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// If title is provided activate forced title
|
// If title is provided activate forced title.
|
||||||
if (isset($options['title']) && $options['title'] != '') {
|
if (isset($options['title']) && $options['title'] != '') {
|
||||||
if (isset($options['class'])) {
|
if (isset($options['class'])) {
|
||||||
$options['class'] .= ' forced_title';
|
$options['class'] .= ' forced_title';
|
||||||
@ -2523,12 +2532,12 @@ function html_print_image(
|
|||||||
$options['class'] = 'forced_title';
|
$options['class'] = 'forced_title';
|
||||||
}
|
}
|
||||||
|
|
||||||
// New way to show the force_title (cleaner and better performance)
|
// New way to show the force_title (cleaner and better performance).
|
||||||
$output .= 'data-title="'.io_safe_input_html($options['title']).'" ';
|
$output .= 'data-title="'.io_safe_input_html($options['title']).'" ';
|
||||||
$output .= 'data-use_title_for_force_title="1" ';
|
$output .= 'data-use_title_for_force_title="1" ';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Valid attributes (invalid attributes get skipped)
|
// Valid attributes (invalid attributes get skipped).
|
||||||
$attrs = [
|
$attrs = [
|
||||||
'height',
|
'height',
|
||||||
'longdesc',
|
'longdesc',
|
||||||
@ -2562,7 +2571,7 @@ function html_print_image(
|
|||||||
|
|
||||||
if (!isset($options['alt']) && isset($options['title'])) {
|
if (!isset($options['alt']) && isset($options['title'])) {
|
||||||
$options['alt'] = io_safe_input_html($options['title']);
|
$options['alt'] = io_safe_input_html($options['title']);
|
||||||
// Set alt to title if it's not set
|
// Set alt to title if it's not set.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($style)) {
|
if (!empty($style)) {
|
||||||
@ -3122,13 +3131,24 @@ function html_print_switch($attributes=[])
|
|||||||
*
|
*
|
||||||
* @param string $text Text to show.
|
* @param string $text Text to show.
|
||||||
* @param array $params Params to be written like inputs hidden.
|
* @param array $params Params to be written like inputs hidden.
|
||||||
|
* @param string $text Text of image.
|
||||||
*
|
*
|
||||||
* @return string With HTML code.
|
* @return string With HTML code.
|
||||||
*/
|
*/
|
||||||
function html_print_link_with_params($text, $params=[])
|
function html_print_link_with_params($text, $params=[], $type='text')
|
||||||
{
|
{
|
||||||
$html = '<form method=post>';
|
$html = '<form method=post>';
|
||||||
$html .= html_print_submit_button($text, $text, false, 'class="button-as-link"', true);
|
switch ($type) {
|
||||||
|
case 'image':
|
||||||
|
$html .= html_print_input_image($text, $text, $text, '', true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'text':
|
||||||
|
default:
|
||||||
|
$html .= html_print_submit_button($text, $text, false, 'class="button-as-link"', true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($params as $param => $value) {
|
foreach ($params as $param => $value) {
|
||||||
$html .= html_print_input_hidden($param, $value, true);
|
$html .= html_print_input_hidden($param, $value, true);
|
||||||
}
|
}
|
||||||
|
@ -4172,6 +4172,11 @@ form ul.form_flex li ul li {
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.div-v-centered {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.pandora_upper {
|
.pandora_upper {
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
@ -233,12 +233,20 @@ if (!empty($main_value)) {
|
|||||||
// Print the data and build the chart.
|
// Print the data and build the chart.
|
||||||
$table->data = [];
|
$table->data = [];
|
||||||
$chart_data = [];
|
$chart_data = [];
|
||||||
|
$hide_filter = !empty($main_value) && ($action === 'udp' || $action === 'tcp');
|
||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
$row = [];
|
$row = [];
|
||||||
$row['main'] = html_print_link_with_params(
|
$row['main'] = '<div class="div-v-centered">';
|
||||||
$item['host'],
|
$row['main'] .= $item['host'];
|
||||||
array_merge($hidden_main_link, ['main_value' => $item['host']])
|
if (!$hide_filter) {
|
||||||
);
|
$row['main'] .= html_print_link_with_params(
|
||||||
|
'images/filter.png',
|
||||||
|
array_merge($hidden_main_link, ['main_value' => $item['host']]),
|
||||||
|
'image'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row['main'] .= '</div>';
|
||||||
if (!$is_network) {
|
if (!$is_network) {
|
||||||
$row['flows'] = format_for_graph($item['sum_flows'], 2);
|
$row['flows'] = format_for_graph($item['sum_flows'], 2);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user