|
1 | 1 | <?php |
2 | 2 |
|
3 | | -use App\Facades\LibrenmsConfig; |
| 3 | +use LibreNMS\Util\Url; |
4 | 4 |
|
5 | 5 | // FIXME functions! |
6 | 6 | if (! $graph_type) { |
7 | 7 | $graph_type = 'pagp_bits'; |
8 | 8 | } |
9 | 9 |
|
10 | | -$daily_traffic = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.day') . '&to=' . LibrenmsConfig::get('time.now') . '&width=215&height=100'; |
11 | | -$daily_url = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.day') . '&to=' . LibrenmsConfig::get('time.now') . '&width=500&height=150'; |
| 10 | +$daily_traffic = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1d', 'width' => 215, 'height' => 100])); |
| 11 | +$daily_url = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1d', 'width' => 500, 'height' => 150])); |
12 | 12 |
|
13 | | -$weekly_traffic = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.week') . '&to=' . LibrenmsConfig::get('time.now') . '&width=215&height=100'; |
14 | | -$weekly_url = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.week') . '&to=' . LibrenmsConfig::get('time.now') . '&width=500&height=150'; |
| 13 | +$weekly_traffic = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1w', 'width' => 215, 'height' => 100])); |
| 14 | +$weekly_url = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1w', 'width' => 500, 'height' => 150])); |
15 | 15 |
|
16 | | -$monthly_traffic = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.month') . '&to=' . LibrenmsConfig::get('time.now') . '&width=215&height=100'; |
17 | | -$monthly_url = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.month') . '&to=' . LibrenmsConfig::get('time.now') . '&width=500&height=150'; |
| 16 | +$monthly_traffic = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1mo', 'width' => 215, 'height' => 100])); |
| 17 | +$monthly_url = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1mo', 'width' => 500, 'height' => 150])); |
18 | 18 |
|
19 | | -$yearly_traffic = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.year') . '&to=' . LibrenmsConfig::get('time.now') . '&width=215&height=100'; |
20 | | -$yearly_url = 'graph.php?port=' . $port['port_id'] . "&type=$graph_type&from=" . LibrenmsConfig::get('time.year') . '&to=' . LibrenmsConfig::get('time.now') . '&width=500&height=150'; |
| 19 | +$yearly_traffic = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1y', 'width' => 215, 'height' => 100])); |
| 20 | +$yearly_url = e(route('graph', ['port' => $port['port_id'], 'type' => $graph_type, 'from' => '-1y', 'width' => 500, 'height' => 150])); |
21 | 21 |
|
22 | | -echo "<a href='#' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT" . LibrenmsConfig::get('overlib_defaults') . ");\" onmouseout=\"return nd();\"> |
23 | | - <img src='$daily_traffic' border=0></a> "; |
24 | | -echo "<a href='#' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT" . LibrenmsConfig::get('overlib_defaults') . ");\" onmouseout=\"return nd();\"> |
25 | | - <img src='$weekly_traffic' border=0></a> "; |
26 | | -echo "<a href='#' onmouseover=\"return overlib('<img src=\'$monthly_url\'>', LEFT" . LibrenmsConfig::get('overlib_defaults') . ", WIDTH, 350);\" onmouseout=\"return nd();\"> |
27 | | - <img src='$monthly_traffic' border=0></a> "; |
28 | | -echo "<a href='#' onmouseover=\"return overlib('<img src=\'$yearly_url\'>', LEFT" . LibrenmsConfig::get('overlib_defaults') . ", WIDTH, 350);\" onmouseout=\"return nd();\"> |
29 | | - <img src='$yearly_traffic' border=0></a>"; |
| 22 | +echo Url::overlibLink('#', "<img src='$daily_traffic' border=0>", "<img src='$daily_url'>") . ' '; |
| 23 | +echo Url::overlibLink('#', "<img src='$weekly_traffic' border=0>", "<img src='$weekly_url'>") . ' '; |
| 24 | +echo Url::overlibLink('#', "<img src='$monthly_traffic' border=0>", "<img src='$monthly_url'>") . ' '; |
| 25 | +echo Url::overlibLink('#', "<img src='$yearly_traffic' border=0>", "<img src='$yearly_url'>"); |
30 | 26 |
|
31 | 27 | foreach (dbFetchRows('SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = ? and `device_id` = ?', [$port['ifIndex'], $device['device_id']]) as $member) { |
32 | 28 | $member = cleanPort($member); |
|
0 commit comments