1 | <?php |
||
2 | |||
3 | $no_refresh = true; |
||
4 | |||
5 | if (! Auth::user()->hasGlobalAdmin()) { |
||
6 | include 'includes/html/error-no-perm.inc.php'; |
||
7 | } else { |
||
8 | if ($vars['addsrv']) { |
||
9 | if (Auth::user()->hasGlobalAdmin()) { |
||
10 | $updated = '1'; |
||
11 | |||
12 | $service_id = add_service($vars['device'], $vars['type'], $vars['descr'], $vars['ip'], $vars['params'], $vars['ignore'], $vars['disabled'], 0, $vars['name']); |
||
13 | if ($service_id) { |
||
0 ignored issues
–
show
|
|||
14 | $message .= $message_break . 'Service added (' . $service_id . ')!'; |
||
15 | $message_break .= '<br />'; |
||
16 | } |
||
17 | } |
||
18 | } |
||
19 | foreach (list_available_services() as $current_service) { |
||
20 | $servicesform .= "<option value='$current_service'>$current_service</option>"; |
||
21 | } |
||
22 | |||
23 | foreach (dbFetchRows('SELECT * FROM `devices` ORDER BY `hostname`') as $device) { |
||
24 | $devicesform .= "<option value='" . $device['device_id'] . "'>" . format_hostname($device) . '</option>'; |
||
25 | } |
||
26 | |||
27 | if ($updated) { |
||
28 | print_message('Device Settings Saved'); |
||
29 | } |
||
30 | |||
31 | $pagetitle[] = 'Add service'; |
||
32 | |||
33 | echo "<div class='row'> |
||
34 | <div class='col-sm-3'> |
||
35 | </div> |
||
36 | <div class='col-sm-6'>"; |
||
37 | |||
38 | include_once 'includes/html/print-service-add.inc.php'; |
||
39 | |||
40 | echo '</div> |
||
41 | </div>'; |
||
42 | }//end if |
||
43 |
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: