Merge branch 'master' of https://github.com/librenms/librenms into issue-2018

This commit is contained in:
laf
2015-10-11 19:32:40 +00:00
38 changed files with 6298 additions and 3324 deletions

View File

@ -795,7 +795,39 @@ function ack_alert() {
$app->response->setStatus($code);
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}
function unmute_alert() {
global $config;
$app = \Slim\Slim::getInstance();
$router = $app->router()->getCurrentRoute()->getParams();
$alert_id = mres($router['id']);
$status = 'error';
$err_msg = '';
$message = '';
$code = 500;
if (is_numeric($alert_id)) {
$status = 'ok';
$code = 200;
if (dbUpdate(array('state' => 1), 'alerts', '`id` = ? LIMIT 1', array($alert_id))) {
$message = 'Alert has been unmuted';
}
else {
$message = 'No alert by that ID';
}
}
else {
$err_msg = 'Invalid alert has been provided';
}
$output = array(
'status' => $status,
'err-msg' => $err_msg,
'message' => $message,
);
$app->response->setStatus($code);
$app->response->headers->set('Content-Type', 'application/json');
echo _json_encode($output);
}