mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge remote-tracking branch 'origin/develop' into ent-12019-api-2-0
This commit is contained in:
commit
80b9fc9af1
@ -1021,11 +1021,14 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
modal: {
|
modal: {
|
||||||
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
|
title: "<?php echo __('Welcome to').' '.io_safe_output(get_product_name()); ?>",
|
||||||
cancel: '<?php echo __('Do not show anymore'); ?>',
|
cancel: '<?php echo __('Do not show anymore'); ?>',
|
||||||
ok: '<?php echo __('Close'); ?>'
|
ok: '<?php echo __('Close'); ?>',
|
||||||
|
overlay: true,
|
||||||
|
overlayExtraClass: 'welcome-overlay',
|
||||||
},
|
},
|
||||||
onshow: {
|
onshow: {
|
||||||
page: 'include/ajax/welcome_window',
|
page: 'include/ajax/welcome_window',
|
||||||
method: 'loadWelcomeWindow',
|
method: 'loadWelcomeWindow',
|
||||||
|
width: 1000,
|
||||||
},
|
},
|
||||||
oncancel: {
|
oncancel: {
|
||||||
page: 'include/ajax/welcome_window',
|
page: 'include/ajax/welcome_window',
|
||||||
@ -1043,6 +1046,34 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
onload: () => {
|
||||||
|
$(document).ready(function () {
|
||||||
|
var buttonpane = $("div[aria-describedby='welcome_modal_window'] .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix");
|
||||||
|
$(buttonpane).append(`
|
||||||
|
<div class="welcome-wizard-buttons">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" class="welcome-wizard-do-not-show" value="1" />
|
||||||
|
<?php echo __('Do not show anymore'); ?>
|
||||||
|
</label>
|
||||||
|
<button class="close-wizard-button"><?php echo __('Close wizard'); ?></button>
|
||||||
|
</div>
|
||||||
|
`);
|
||||||
|
|
||||||
|
var closeWizard = $("button.close-wizard-button");
|
||||||
|
|
||||||
|
$(closeWizard).click(function (e) {
|
||||||
|
var close = $("div[aria-describedby='welcome_modal_window'] button.sub.ok.submit-next.ui-button");
|
||||||
|
var cancel = $("div[aria-describedby='welcome_modal_window'] button.sub.upd.submit-cancel.ui-button");
|
||||||
|
var checkbox = $("div[aria-describedby='welcome_modal_window'] .welcome-wizard-do-not-show:checked").length;
|
||||||
|
|
||||||
|
if (checkbox === 1) {
|
||||||
|
$(cancel).click();
|
||||||
|
} else {
|
||||||
|
$(close).click()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -575,7 +575,7 @@ $where = sprintf('delete_pending = 0 AND id_agente = %s', $id_agente);
|
|||||||
$search_string_entities = io_safe_input($search_string);
|
$search_string_entities = io_safe_input($search_string);
|
||||||
|
|
||||||
$basic_where = sprintf(
|
$basic_where = sprintf(
|
||||||
"(REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(nombre, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%' OR REPLACE(descripcion, ' ', ' ') LIKE '%%%s%%') AND",
|
"(nombre LIKE '%%%s%%' OR nombre LIKE '%%%s%%' OR descripcion LIKE '%%%s%%' OR descripcion LIKE '%%%s%%') AND",
|
||||||
$search_string,
|
$search_string,
|
||||||
$search_string_entities,
|
$search_string_entities,
|
||||||
$search_string,
|
$search_string,
|
||||||
|
@ -2404,3 +2404,50 @@ function netflow_build_map_data($start_date, $end_date, $top, $aggregate, $advan
|
|||||||
array_merge($relations, $orphan_hosts)
|
array_merge($relations, $orphan_hosts)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run whois command and return all results as array.
|
||||||
|
*
|
||||||
|
* @param integer $ip Ip for search info with command whois.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function command_whois($ip)
|
||||||
|
{
|
||||||
|
$command = 'whois '.$ip;
|
||||||
|
$result = '';
|
||||||
|
exec($command, $result);
|
||||||
|
if (empty($result) === false && is_array($result) === true) {
|
||||||
|
$resultArray = parse_whois_output($result);
|
||||||
|
} else {
|
||||||
|
$resultArray = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $resultArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse the result of command whois to array.
|
||||||
|
*
|
||||||
|
* @param array $lines Lines result of command whois.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function parse_whois_output($lines)
|
||||||
|
{
|
||||||
|
$resultArray = [];
|
||||||
|
if (is_array($lines) === true) {
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
$parts = explode(':', $line, 2);
|
||||||
|
if (count($parts) === 2 && strpos($line, '#') !== 0) {
|
||||||
|
$key = trim($parts[0]);
|
||||||
|
$value = trim($parts[1]);
|
||||||
|
$resultArray[$key] = $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $resultArray;
|
||||||
|
}
|
||||||
|
@ -311,6 +311,15 @@ class Manager implements PublicLogin
|
|||||||
|
|
||||||
if ($this->dashboardId !== 0) {
|
if ($this->dashboardId !== 0) {
|
||||||
$this->dashboardFields = $this->get();
|
$this->dashboardFields = $this->get();
|
||||||
|
if ($this->deleteDashboard === false && is_array($this->dashboardFields) === true && count($this->dashboardFields) === 0) {
|
||||||
|
db_pandora_audit(
|
||||||
|
AUDIT_LOG_HACK_ATTEMPT,
|
||||||
|
'Trying to access to dashboard that not exist'
|
||||||
|
);
|
||||||
|
include 'general/noaccess.php';
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$this->cells = Cell::getCells($this->dashboardId);
|
$this->cells = Cell::getCells($this->dashboardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,10 @@ if (! check_acl($config['id_user'], 0, 'AR')) {
|
|||||||
|
|
||||||
// Ajax callbacks.
|
// Ajax callbacks.
|
||||||
if (is_ajax() === true) {
|
if (is_ajax() === true) {
|
||||||
|
include_once $config['homedir'].'/include/functions_netflow.php';
|
||||||
$get_filter_values = get_parameter('get_filter_values', 0);
|
$get_filter_values = get_parameter('get_filter_values', 0);
|
||||||
|
$whois = (bool) get_parameter('whois', 0);
|
||||||
|
|
||||||
// Get values of the current network filter.
|
// Get values of the current network filter.
|
||||||
if ($get_filter_values) {
|
if ($get_filter_values) {
|
||||||
$id = get_parameter('id');
|
$id = get_parameter('id');
|
||||||
@ -51,6 +54,34 @@ if (is_ajax() === true) {
|
|||||||
echo json_encode($filter_values);
|
echo json_encode($filter_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($whois) {
|
||||||
|
$ip = get_parameter('ip');
|
||||||
|
$info = command_whois($ip);
|
||||||
|
$output = '';
|
||||||
|
if (is_array($info) === true && count($info) > 0) {
|
||||||
|
$table = new \stdClass();
|
||||||
|
$table->class = 'details_table dataTable info_table';
|
||||||
|
$table->data = [];
|
||||||
|
$row = 0;
|
||||||
|
foreach ($info as $key => $value) {
|
||||||
|
$table->data[$row][0] = $key;
|
||||||
|
$table->data[$row][1] = $value;
|
||||||
|
$row++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output = html_print_table($table, true);
|
||||||
|
} else {
|
||||||
|
$output = ui_print_info_message(__('No data found'));
|
||||||
|
}
|
||||||
|
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'content' => $output,
|
||||||
|
'style' => 'max-height: 600px;',
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,6 +493,7 @@ foreach ($data as $item) {
|
|||||||
array_merge($hidden_main_link, ['main_value' => $item['host']]),
|
array_merge($hidden_main_link, ['main_value' => $item['host']]),
|
||||||
'image'
|
'image'
|
||||||
);
|
);
|
||||||
|
$row['main'] .= html_print_input_image('whois', 'images/eye.png', 'whois', '', true, ['onclick' => 'whois(\''.$item['host'].'\')']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$row['main'] .= '</div>';
|
$row['main'] .= '</div>';
|
||||||
@ -572,6 +604,13 @@ html_print_div(
|
|||||||
'style' => 'position: initial;',
|
'style' => 'position: initial;',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
html_print_div(
|
||||||
|
[
|
||||||
|
'id' => 'modal_whois',
|
||||||
|
'class' => 'invisible',
|
||||||
|
]
|
||||||
|
);
|
||||||
?>
|
?>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
@ -654,4 +693,29 @@ function nf_view_click_period() {
|
|||||||
document.getElementById('period_container').style.display = !is_period ? 'none' : 'flex';
|
document.getElementById('period_container').style.display = !is_period ? 'none' : 'flex';
|
||||||
document.getElementById('end_date_container').style.display = is_period ? 'none' : 'flex';
|
document.getElementById('end_date_container').style.display = is_period ? 'none' : 'flex';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function whois(ip) {
|
||||||
|
load_modal({
|
||||||
|
target: $('#modal_whois'),
|
||||||
|
url: '<?php echo ui_get_full_url('ajax.php', false, false, false); ?>',
|
||||||
|
modal: {
|
||||||
|
title: '<?php echo __('Details'); ?>',
|
||||||
|
ok: '<?php echo __('Ok'); ?>',
|
||||||
|
},
|
||||||
|
extradata: [
|
||||||
|
{
|
||||||
|
name: "ip",
|
||||||
|
value: ip,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "whois",
|
||||||
|
value: 1,
|
||||||
|
}
|
||||||
|
],
|
||||||
|
onshow: {
|
||||||
|
page: '<?php echo $config['homedir'].'/operation/network/network_report'; ?>',
|
||||||
|
width: 800,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user