2016-01-25 16:31:02 +01:00
|
|
|
<?php
|
2023-06-08 13:19:01 +02:00
|
|
|
// Pandora FMS - https://pandorafms.com
|
2016-01-25 16:31:02 +01:00
|
|
|
// ==================================================
|
2023-06-08 11:53:13 +02:00
|
|
|
// Copyright (c) 2005-2023 Pandora FMS
|
2023-06-08 13:19:01 +02:00
|
|
|
// Please see https://pandorafms.com/community/ for full contribution list
|
2016-01-25 16:31:02 +01:00
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation for version 2.
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
// Login check
|
|
|
|
global $config;
|
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
require_once 'include/functions_snmp.php';
|
2016-01-25 16:31:02 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
$save_snmp_translation = (bool) get_parameter('save_snmp_translation', 0);
|
|
|
|
$delete_snmp_translation = (bool) get_parameter('delete_snmp_translation', 0);
|
|
|
|
$update_snmp_translation = (bool) get_parameter('update_snmp_translation', 0);
|
|
|
|
$delete_snmp_filter = (bool) get_parameter('delete_snmp_filter', 0);
|
2016-01-25 16:31:02 +01:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
// skins image checks
|
2016-01-25 16:31:02 +01:00
|
|
|
if ($save_snmp_translation) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$oid = get_parameter('oid', '');
|
|
|
|
$description = get_parameter('description', '');
|
|
|
|
$post_process = get_parameter('post_process', '');
|
|
|
|
|
|
|
|
$result = snmp_save_translation($oid, $description, $post_process);
|
|
|
|
|
|
|
|
echo json_encode(['correct' => $result]);
|
|
|
|
|
|
|
|
return;
|
2016-01-25 16:31:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($delete_snmp_translation) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$oid = get_parameter('oid', '');
|
|
|
|
|
|
|
|
$result = snmp_delete_translation($oid);
|
|
|
|
|
|
|
|
echo json_encode(['correct' => $result]);
|
|
|
|
|
|
|
|
return;
|
2016-01-25 16:31:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($update_snmp_translation) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$oid = get_parameter('oid', '');
|
|
|
|
$new_oid = get_parameter('new_oid', '');
|
|
|
|
$description = get_parameter('description', '');
|
|
|
|
$post_process = get_parameter('post_process', '');
|
|
|
|
|
|
|
|
$result = snmp_update_translation($oid, $new_oid, $description, $post_process);
|
|
|
|
|
|
|
|
echo json_encode(['correct' => $result]);
|
|
|
|
|
|
|
|
return;
|
2016-01-25 16:31:02 +01:00
|
|
|
}
|
2017-10-26 11:03:08 +02:00
|
|
|
|
|
|
|
if ($delete_snmp_filter) {
|
2019-01-30 16:18:44 +01:00
|
|
|
$filter_id = get_parameter('filter_id');
|
|
|
|
db_process_sql_delete('tsnmp_filter', ['id_snmp_filter' => $filter_id]);
|
2017-10-26 11:03:08 +02:00
|
|
|
|
2019-01-30 16:18:44 +01:00
|
|
|
return;
|
2017-10-26 11:03:08 +02:00
|
|
|
}
|