'; // Dialog error. $output .= '
'; // Dialog success. $output .= ' '; // Dialog no agent selected. $output .= ' '; echo $output; } return; } if ($action == 'snmpget') { // SNMP get. $target_oid = htmlspecialchars_decode(get_parameter('oid', '')); $custom_action = get_parameter('custom_action', ''); if ($custom_action != '') { $custom_action = urldecode(base64_decode($custom_action)); } $oid = snmp_browser_get_oid( $target_ip, $community, $target_oid, $snmp_version, $snmp3_auth_user, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_privacy_method, $snmp3_privacy_pass, $server_to_exec ); snmp_browser_print_oid( $oid, $custom_action, false, $community, $snmp_version ); return; } if ($method == 'snmp_browser_create_modules') { // Get target ids from form. $id_items = get_parameter('id_item2', null); if (!is_null($id_items)) { $id_target = explode(',', $id_items[0]); } if (empty($id_items[0])) { echo json_encode([0 => -1]); exit; } $snmp_extradata = get_parameter('snmp_extradata', ''); if (!is_array($snmp_extradata)) { // Decode SNMP values. $snmp_extradata = json_decode(io_safe_output($snmp_extradata), true); } foreach ($snmp_extradata as $snmp_conf) { $snmp_conf_values[$snmp_conf['name']] = $snmp_conf['value']; } $fail_modules = snmp_browser_create_modules_snmp($module_target, $snmp_conf_values, $id_target); // Return fail modules for error/success message. echo json_encode($fail_modules); exit; } if ($method == 'snmp_browser_print_create_module_massive') { // Get SNMP conf vaues from modal onshow extradata. $snmp_extradata = get_parameter('extradata', ''); $return = snmp_browser_print_create_module_massive($module_target, $snmp_extradata, true); echo $return; exit; } if ($method == 'snmp_browser_print_create_policy') { $return = snmp_browser_print_create_policy(); echo $return; exit; } if ($method == 'snmp_browser_create_policy') { enterprise_include_once('include/functions_policies.php'); $policy_name = get_parameter('name', ''); $policy_id_group = get_parameter('id_group', 0); $policy_description = get_parameter('description', ''); $values = [ 'id_group' => $policy_id_group, 'description' => $policy_description, ]; // Check if policy exist. $policy_exists = policies_get_id($policy_name); if ($policy_exists != false) { $id_policy = 0; } else { $id_policy = (boolean) policies_create_policy($policy_name, $values); } $return = [ 'error' => (int) $id_policy, 'title' => [ __('Failed'), __('Success'), ], 'text' => [ ui_print_error_message(__('Failed to create policy'), '', true), ui_print_success_message(__('Policy created succesfully'), '', true), ], ]; echo json_encode($return); exit; } }