Issues (2963)

includes/html/print-interface-adsl.inc.php (2 issues)

1
<?php
2
3
// This file prints a table row for each interface
4
use LibreNMS\Config;
5
use LibreNMS\Util\IP;
6
7
$port['device_id'] = $device['device_id'];
8
$port['hostname'] = $device['hostname'];
9
10
$if_id = $port['port_id'];
11
12
$port = cleanPort($port);
13
14
if (! is_integer($i / 2)) {
0 ignored issues
show
The condition is_integer($i / 2) is always true.
Loading history...
15
    $row_colour = Config::get('list_colour.even');
16
} else {
17
    $row_colour = Config::get('list_colour.odd');
18
}
19
20
if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) {
21
    $error_img = generate_port_link($port, "<i class='fa fa-flag fa-lg' style='color:red' aria-hidden='true'></i>", 'port_errors');
22
} else {
23
    $error_img = '';
24
}
25
26
echo "<tr style=\"background-color: $row_colour; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='" . Config::get('list_colour.highlight') . "';\" onmouseout=\"this.style.backgroundColor='$row_colour';\"
27
onclick=\"location.href='device/" . $device['device_id'] . '/port/' . $port['port_id'] . "/'\" style='cursor: pointer;'>
28
 <td valign=top width=350>";
29
echo '        <span class=list-large>
30
              ' . generate_port_link($port, $port['ifIndex'] . '. ' . $port['label']) . '
31
           </span><br /><span class=interface-desc>' . \LibreNMS\Util\Clean::html($port['ifAlias'], []) . '</span>';
32
33
if ($port['ifAlias']) {
34
    echo '<br />';
35
}
36
37
$break = '';
38
if ($port_details) {
39
    foreach (dbFetchRows('SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?', [$port['port_id']]) as $ip) {
40
        echo "$break <a class=interface-desc href=\"javascript:popUp('ajax/netcmd?cmd=whois&amp;query=" . $ip['ipv4_address'] . "')\">" . $ip['ipv4_address'] . '/' . $ip['ipv4_prefixlen'] . '</a>';
41
        $break = ',';
42
    }
43
44
    foreach (dbFetchRows('SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?', [$port['port_id']]) as $ip6) {
45
        echo "$break <a class=interface-desc href=\"javascript:popUp('ajax/netcmd?cmd=whois&amp;query=" . $ip6['ipv6_address'] . "')\">" . IP::parse($ip6['ipv6_address'], true) . '/' . $ip6['ipv6_prefixlen'] . '</a>';
46
        $break = ',';
47
    }
48
}
49
50
echo '</span>';
51
52
$width = '120';
53
$height = '40';
54
$from = Config::get('time.day');
55
56
echo '</td><td width=135>';
57
echo \LibreNMS\Util\Number::formatSi(($port['ifInOctets_rate'] * 8), 2, 3, 'bps') . " <i class='fa fa-arrows-v fa-lg icon-theme' aria-hidden='true'></i> " . \LibreNMS\Util\Number::formatSi(($port['ifOutOctets_rate'] * 8), 2, 3, 'bps');
58
echo '<br />';
59
$port['graph_type'] = 'port_bits';
60
echo generate_port_link(
0 ignored issues
show
Are you sure generate_port_link($port...', $port['graph_type']) of type array|string can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

60
echo /** @scrutinizer ignore-type */ generate_port_link(
Loading history...
61
    $port,
62
    "<img src='graph.php?type=" . $port['graph_type'] . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . Config::get('time.now') . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>",
63
    $port['graph_type']
64
);
65
66
echo '</td><td width=135>';
67
echo '' . \LibreNMS\Util\Number::formatSi($port['adslAturChanCurrTxRate'], 2, 3, 'bps') . '/' . \LibreNMS\Util\Number::formatSi($port['adslAtucChanCurrTxRate'], 2, 3, 'bps');
68
echo '<br />';
69
$port['graph_type'] = 'port_adsl_speed';
70
echo generate_port_link(
71
    $port,
72
    "<img src='graph.php?type=" . $port['graph_type'] . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . Config::get('time.now') . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>",
73
    $port['graph_type']
74
);
75
76
echo '</td><td width=135>';
77
echo '' . \LibreNMS\Util\Number::formatSi($port['adslAturCurrAttainableRate'], 2, 3, 'bps') . '/' . \LibreNMS\Util\Number::formatSi($port['adslAtucCurrAttainableRate'], 2, 3, 'bps');
78
echo '<br />';
79
$port['graph_type'] = 'port_adsl_attainable';
80
echo generate_port_link(
81
    $port,
82
    "<img src='graph.php?type=" . $port['graph_type'] . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . Config::get('time.now') . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>",
83
    $port['graph_type']
84
);
85
86
echo '</td><td width=135>';
87
echo '' . $port['adslAturCurrAtn'] . 'dB/' . $port['adslAtucCurrAtn'] . 'dB';
88
echo '<br />';
89
$port['graph_type'] = 'port_adsl_attenuation';
90
echo generate_port_link(
91
    $port,
92
    "<img src='graph.php?type=" . $port['graph_type'] . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . Config::get('time.now') . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>",
93
    $port['graph_type']
94
);
95
96
echo '</td><td width=135>';
97
echo '' . $port['adslAturCurrSnrMgn'] . 'dB/' . $port['adslAtucCurrSnrMgn'] . 'dB';
98
echo '<br />';
99
$port['graph_type'] = 'port_adsl_snr';
100
echo generate_port_link(
101
    $port,
102
    "<img src='graph.php?type=" . $port['graph_type'] . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . Config::get('time.now') . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>",
103
    $port['graph_type']
104
);
105
106
echo '</td><td width=135>';
107
echo '' . $port['adslAturCurrOutputPwr'] . 'dBm/' . $port['adslAtucCurrOutputPwr'] . 'dBm';
108
echo '<br />';
109
$port['graph_type'] = 'port_adsl_power';
110
echo generate_port_link(
111
    $port,
112
    "<img src='graph.php?type=" . $port['graph_type'] . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . Config::get('time.now') . '&amp;width=' . $width . '&amp;height=' . $height . '&amp;legend=no&amp;bg=' . str_replace('#', '', $row_colour) . "'>",
113
    $port['graph_type']
114
);
115
116
echo '</td>';
117