. * * @package LibreNMS * @link http://librenms.org * @copyright 2018 Neil Lathwood * @author Neil Lathwood */ header('Content-type: application/json'); $alert_id = $vars['alert_id']; $sub_type = $vars['sub_type']; $note = $vars['note'] ?: ''; $status = 'error'; if (is_numeric($alert_id)) { if ($sub_type === 'get_note') { $note = dbFetchCell("SELECT `note` FROM `alerts` WHERE `id` = ?", [$alert_id]); $message = 'Alert note retrieved'; $status = 'ok'; } else { if (dbUpdate(['note' => $note], 'alerts', '`id` = ?', [$alert_id])) { $status = 'ok'; $message = 'Note updated'; } else { $message = 'Could not update note'; } } } else { $message = 'Invalid alert id'; } die(json_encode([ 'status' => $status, 'message' => $message, 'note' => $note, ]));