1 | <?php |
||
2 | |||
3 | if (! Auth::user()->hasGlobalAdmin()) { |
||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
4 | $response = [ |
||
5 | 'status' => 'error', |
||
6 | 'message' => 'Need to be admin', |
||
7 | ]; |
||
8 | echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); |
||
9 | exit; |
||
10 | } |
||
11 | $customoid_id = $_POST['customoid_id']; |
||
12 | |||
13 | if (is_numeric($customoid_id) && $customoid_id > 0) { |
||
14 | $oid = dbFetchRow('SELECT * FROM `customoids` WHERE `customoid_id` = ? LIMIT 1', [$customoid_id]); |
||
15 | |||
16 | if ($oid['customoid_alert'] == 1) { |
||
17 | $alerts = true; |
||
18 | } else { |
||
19 | $alerts = false; |
||
20 | } |
||
21 | if ($oid['customoid_passed'] == 1) { |
||
22 | $cpassed = true; |
||
23 | $passed = 'on'; |
||
24 | } else { |
||
25 | $cpassed = false; |
||
26 | $passed = ''; |
||
27 | } |
||
28 | |||
29 | header('Content-type: application/json'); |
||
30 | echo json_encode([ |
||
31 | 'name' => $oid['customoid_descr'], |
||
32 | 'oid' => $oid['customoid_oid'], |
||
33 | 'datatype' => $oid['customoid_datatype'], |
||
34 | 'unit' => $oid['customoid_unit'], |
||
35 | 'divisor' => $oid['customoid_divisor'], |
||
36 | 'multiplier' => $oid['customoid_multiplier'], |
||
37 | 'limit' => $oid['customoid_limit'], |
||
38 | 'limit_warn' => $oid['customoid_limit_warn'], |
||
39 | 'limit_low' => $oid['customoid_limit_low'], |
||
40 | 'limit_low_warn' => $oid['customoid_limit_low_warn'], |
||
41 | 'alerts' => $alerts, |
||
42 | 'cpassed' => $cpassed, |
||
43 | 'passed' => $passed, |
||
44 | 'user_func' => $oid['user_func'], |
||
45 | ]); |
||
46 | } |
||
47 |