This commit is contained in:
fbsanchez 2021-02-09 12:05:59 +01:00
parent 3db4a3a595
commit 2639533cc1
6 changed files with 62 additions and 18 deletions

View File

@ -148,7 +148,9 @@ if (__PAN_XHPROF__ === 1) {
} }
if ($config['force_instant_logout'] === true) { if (isset($config['force_instant_logout']) === true
&& $config['force_instant_logout'] === true
) {
// Force user logout. // Force user logout.
if (session_status() !== PHP_SESSION_ACTIVE) { if (session_status() !== PHP_SESSION_ACTIVE) {
session_start(); session_start();

View File

@ -107,7 +107,7 @@ try {
); );
// Div for error/succes dialog. // Div for error/succes dialog.
$output .= '<div id="snmp_result_msg" style="display:none"></div>'; $output = '<div id="snmp_result_msg" style="display:none"></div>';
// Dialog error. // Dialog error.
$output .= '<div id="dialog_error" style="display:none" title="'.__('SNMP modules').'">'; $output .= '<div id="dialog_error" style="display:none" title="'.__('SNMP modules').'">';
@ -183,6 +183,7 @@ try {
if ($method == 'snmp_browser_create_modules') { if ($method == 'snmp_browser_create_modules') {
// Get target ids from form. // Get target ids from form.
$id_items = get_parameter('id_item2', null); $id_items = get_parameter('id_item2', null);
$id_target = null;
if (empty($id_items) === false) { if (empty($id_items) === false) {
$id_target = explode(',', $id_items[0]); $id_target = explode(',', $id_items[0]);
} }
@ -263,7 +264,5 @@ try {
} }
} }
} catch (\Exception $e) { } catch (\Exception $e) {
$e->getMessage(); hd($e);
} finally {
exit;
} }

View File

@ -536,6 +536,8 @@ function html_print_select_groups(
$include_groups[$nothing_value] = $nothing; $include_groups[$nothing_value] = $nothing;
} }
$json_exclusions = '';
$json_inclusions = '';
if (is_array($delete_groups) === true) { if (is_array($delete_groups) === true) {
$json_exclusions = json_encode($delete_groups); $json_exclusions = json_encode($delete_groups);
} }

View File

@ -675,6 +675,8 @@ function modules_create_agent_module(
$time = 0; $time = 0;
if (empty($values['interval']) === false) { if (empty($values['interval']) === false) {
$time = (time() - (int) $values['interval']); $time = (time() - (int) $values['interval']);
} else {
$values['interval'] = null;
} }
$result = db_process_sql_insert( $result = db_process_sql_insert(

View File

@ -1094,17 +1094,55 @@ function snmp_browser_print_container(
*/ */
function snmp_browser_create_modules_snmp(string $module_target, array $snmp_values, ?array $id_target) function snmp_browser_create_modules_snmp(string $module_target, array $snmp_values, ?array $id_target)
{ {
$target_ip = null;
$community = null;
$target_oid = null;
$snmp_version = null;
$snmp3_auth_user = null;
$snmp3_security_level = null;
$snmp3_auth_method = null;
$snmp3_auth_pass = null;
$snmp3_privacy_method = null;
$snmp3_privacy_pass = null;
if (is_array($snmp_values)) { if (is_array($snmp_values)) {
$snmp_version = $snmp_values['snmp_browser_version']; if (isset($snmp_values['snmp_browser_version']) === true) {
$community = $snmp_values['community']; $snmp_version = $snmp_values['snmp_browser_version'];
$target_ip = $snmp_values['target_ip']; }
$snmp3_auth_user = $snmp_values['snmp3_browser_auth_user'];
$snmp3_security_level = $snmp_values['snmp3_browser_security_level']; if (isset($snmp_values['community']) === true) {
$snmp3_auth_method = $snmp_values['snmp3_browser_auth_method']; $community = $snmp_values['community'];
$snmp3_auth_pass = $snmp_values['snmp3_browser_auth_pass']; }
$snmp3_privacy_method = $snmp_values['snmp3_privacy_method'];
$snmp3_privacy_pass = $snmp_values['snmp3_browser_privacy_pass']; if (isset($snmp_values['target_ip']) === true) {
$targets_oids = $snmp_values['oids']; $target_ip = $snmp_values['target_ip'];
}
if (isset($snmp_values['snmp3_browser_auth_user']) === true) {
$snmp3_auth_user = $snmp_values['snmp3_browser_auth_user'];
}
if (isset($snmp_values['snmp3_browser_security_level']) === true) {
$snmp3_security_level = $snmp_values['snmp3_browser_security_level'];
};
if (isset($snmp_values['snmp3_browser_auth_method']) === true) {
$snmp3_auth_method = $snmp_values['snmp3_browser_auth_method'];
}
if (isset($snmp_values['snmp3_browser_auth_pass']) === true) {
$snmp3_auth_pass = $snmp_values['snmp3_browser_auth_pass'];
}
if (isset($snmp_values['snmp3_privacy_method']) === true) {
$snmp3_privacy_method = $snmp_values['snmp3_privacy_method'];
};
if (isset($snmp_values['snmp3_browser_privacy_pass']) === true) {
$snmp3_privacy_pass = $snmp_values['snmp3_browser_privacy_pass'];
}
if (isset($snmp_values['oids']) === true) {
$targets_oids = $snmp_values['oids'];
}
} }
$fail_modules = []; $fail_modules = [];
@ -1326,7 +1364,7 @@ function snmp_browser_create_modules_snmp(string $module_target, array $snmp_val
} }
} }
if (is_array($ids)) { if (isset($ids) === true && is_array($ids) === true) {
foreach ($ids as $id) { foreach ($ids as $id) {
// Id < 0 for error codes. // Id < 0 for error codes.
if (!$id || $id < 0) { if (!$id || $id < 0) {
@ -1354,6 +1392,8 @@ function snmp_browser_create_modules_snmp(string $module_target, array $snmp_val
*/ */
function snmp_browser_print_create_module_massive($target='agent', $snmp_conf, $return=false) function snmp_browser_print_create_module_massive($target='agent', $snmp_conf, $return=false)
{ {
global $config;
// String for labels. // String for labels.
switch ($target) { switch ($target) {
case 'agent': case 'agent':
@ -1365,7 +1405,7 @@ function snmp_browser_print_create_module_massive($target='agent', $snmp_conf, $
break; break;
} }
$output .= "<form target='_blank' id='create_module_massive' action='#' method='post'>"; $output = "<form target='_blank' id='create_module_massive' action='#' method='post'>";
$strict_user = db_get_value( $strict_user = db_get_value(
'strict_acl', 'strict_acl',

View File

@ -139,7 +139,6 @@ function snmp_browser_show_add_module_massive(module_target = 'agent') {
var snmp_extradata = snmp_browser_create_modules(module_target); var snmp_extradata = snmp_browser_create_modules(module_target);
// Load dinamically modal form. // Load dinamically modal form.
load_modal({ load_modal({
target: $('#modal'),
form: 'snmp_browser_add_module_form', form: 'snmp_browser_add_module_form',
extradata: [ extradata: [
{ {