mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Apply fixes from StyleCI (#12120)
This commit is contained in:
@@ -14,30 +14,30 @@
|
||||
|
||||
header('Content-type: application/json');
|
||||
|
||||
if (!Auth::user()->hasGlobalAdmin()) {
|
||||
$response = array(
|
||||
if (! Auth::user()->hasGlobalAdmin()) {
|
||||
$response = [
|
||||
'status' => 'error',
|
||||
'message' => 'Need to be admin',
|
||||
);
|
||||
];
|
||||
echo _json_encode($response);
|
||||
exit;
|
||||
}
|
||||
|
||||
$status = 'error';
|
||||
$status = 'error';
|
||||
$message = 'Error updating processor information';
|
||||
|
||||
$device_id = mres($_POST['device_id']);
|
||||
$processor_id = mres($_POST['processor_id']);
|
||||
$data = mres($_POST['data']);
|
||||
|
||||
if (!is_numeric($device_id)) {
|
||||
if (! is_numeric($device_id)) {
|
||||
$message = 'Missing device id';
|
||||
} elseif (!is_numeric($processor_id)) {
|
||||
} elseif (! is_numeric($processor_id)) {
|
||||
$message = 'Missing processor id';
|
||||
} elseif (!is_numeric($data)) {
|
||||
} elseif (! is_numeric($data)) {
|
||||
$message = 'Missing value';
|
||||
} else {
|
||||
if (dbUpdate(array('processor_perc_warn'=>$data), 'processors', '`processor_id`=? AND `device_id`=?', array($processor_id,$device_id)) >= 0) {
|
||||
if (dbUpdate(['processor_perc_warn'=>$data], 'processors', '`processor_id`=? AND `device_id`=?', [$processor_id, $device_id]) >= 0) {
|
||||
$message = 'Processor information updated';
|
||||
$status = 'ok';
|
||||
} else {
|
||||
@@ -45,9 +45,9 @@ if (!is_numeric($device_id)) {
|
||||
}
|
||||
}
|
||||
|
||||
$response = array(
|
||||
$response = [
|
||||
'status' => $status,
|
||||
'message' => $message,
|
||||
'extra' => $extra,
|
||||
);
|
||||
];
|
||||
echo _json_encode($response);
|
||||
|
||||
Reference in New Issue
Block a user