2016-01-03 02:12:41 +01:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* LibreNMS
|
|
|
|
*
|
|
|
|
* Copyright (c) 2015 Søren Friis Rosiak <sorenrosiak@gmail.com>
|
|
|
|
* 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, either version 3 of the License, or (at your
|
|
|
|
* option) any later version. Please see LICENSE.txt at the top level of
|
|
|
|
* the source code distribution for details.
|
|
|
|
*/
|
2016-04-26 15:06:29 -07:00
|
|
|
header('Content-type: application/json');
|
2016-01-03 02:12:41 +01:00
|
|
|
|
|
|
|
$status = 'error';
|
|
|
|
$message = 'unknown error';
|
|
|
|
|
2016-01-04 20:23:32 +01:00
|
|
|
$device_id = mres($_POST['device_id']);
|
|
|
|
$port_id_notes = mres($_POST['port_id_notes']);
|
2016-03-08 12:14:27 +00:00
|
|
|
$attrib_value = $_POST['notes'];
|
2016-01-03 02:12:41 +01:00
|
|
|
|
2016-01-04 20:23:32 +01:00
|
|
|
if (isset($attrib_value) && set_dev_attrib(array('device_id' => $device_id), $port_id_notes, $attrib_value)) {
|
2016-01-03 02:12:41 +01:00
|
|
|
$status = 'ok';
|
|
|
|
$message = 'Updated';
|
2016-08-18 20:28:22 -05:00
|
|
|
} else {
|
2016-01-03 02:12:41 +01:00
|
|
|
$status = 'error';
|
|
|
|
$message = 'ERROR: Could not update';
|
|
|
|
}
|
|
|
|
die(json_encode(array(
|
|
|
|
'status' => $status,
|
|
|
|
'message' => $message,
|
2016-01-04 20:23:32 +01:00
|
|
|
'attrib_type' => $port_id_notes,
|
|
|
|
'attrib_value' => $attrib_value,
|
|
|
|
'device_id' => $device_id
|
|
|
|
|
2016-01-03 02:12:41 +01:00
|
|
|
)));
|