1 | <?php |
||
2 | |||
3 | if (Auth::user()->hasGlobalRead()) { |
||
4 | if ($vars['addsrv']) { |
||
5 | if (Auth::user()->hasGlobalAdmin()) { |
||
6 | $updated = '1'; |
||
7 | |||
8 | $service_id = add_service($vars['device'], $vars['type'], $vars['descr'], $vars['ip'], $vars['params'], $vars['ignore'], $vars['disabled'], 0, $vars['name']); |
||
9 | if ($service_id) { |
||
0 ignored issues
–
show
|
|||
10 | $message .= $message_break . 'Service added (' . $service_id . ')!'; |
||
11 | $message_break .= '<br />'; |
||
12 | } |
||
13 | } |
||
14 | } |
||
15 | |||
16 | // Build the types list. |
||
17 | foreach (scandir(\LibreNMS\Config::get('nagios_plugins')) as $file) { |
||
18 | if (substr($file, 0, 6) === 'check_') { |
||
19 | $check_name = substr($file, 6); |
||
20 | $servicesform .= "<option value='$check_name'>$check_name</option>"; |
||
21 | } |
||
22 | } |
||
23 | |||
24 | $dev = device_by_id_cache($device['device_id']); |
||
25 | $devicesform = "<option value='" . $dev['device_id'] . "'>" . $dev['hostname'] . '</option>'; |
||
26 | |||
27 | if ($updated) { |
||
28 | print_message('Device Settings Saved'); |
||
29 | } |
||
30 | |||
31 | echo '<div class="col-sm-6 col-sm-offset-3">'; |
||
32 | |||
33 | include_once 'includes/html/print-service-add.inc.php'; |
||
34 | } else { |
||
35 | include 'includes/html/error-no-perm.inc.php'; |
||
36 | } |
||
37 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: