mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
refactor: Remove inappropriate usages of truncate() (#5028)
Where truncate() is used as substr(), replace with substr()
This commit is contained in:
committed by
Neil Lathwood
parent
e469aa97b0
commit
a83e126b40
@@ -44,9 +44,9 @@ if (count($sensors)) {
|
||||
$link = generate_url($link_array);
|
||||
|
||||
if ($sensor['poller_type'] == "ipmi") {
|
||||
$sensor['sensor_descr'] = truncate(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 48, '');
|
||||
$sensor['sensor_descr'] = substr(ipmiSensorName($device['hardware'], $sensor['sensor_descr'], $ipmiSensorsNames), 0, 48);
|
||||
} else {
|
||||
$sensor['sensor_descr'] = truncate($sensor['sensor_descr'], 48, '');
|
||||
$sensor['sensor_descr'] = substr($sensor['sensor_descr'], 0, 48);
|
||||
}
|
||||
|
||||
$overlib_content = '<div style="width: 580px;"><h2>'.$device['hostname'].' - '.$sensor['sensor_descr'].'</h1>';
|
||||
|
@@ -112,7 +112,7 @@ if ($vars['view'] == 'minigraphs') {
|
||||
</div>\
|
||||
', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >"."<img src='graph.php?type=".$graph_type.'&id='.$port['port_id'].'&from='.$from.'&to='.$config['time']['now']."&width=180&height=45&legend=no'>
|
||||
</a>
|
||||
<div style='font-size: 9px;'>".truncate(short_port_descr($port['ifAlias']), 32, '').'</div>
|
||||
<div style='font-size: 9px;'>".substr(short_port_descr($port['ifAlias']), 0, 32).'</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
@@ -65,8 +65,8 @@ if ($config['warn']['ifdown']) {
|
||||
generate_device_link($interface, shorthost($interface['hostname'])) . "<br />
|
||||
<span class=\"interface-updown\">Port Down</span><br />
|
||||
<!-- <img src='graph.php?type=bits&if=" . $interface['port_id'] . '&from=' . $config['time']['day'] . '&to=' . $config['time']['now'] . "&width=100&height=32' /> -->
|
||||
" . generate_port_link($interface, truncate(makeshortif($interface['label']), 13, '')) . ' <br />
|
||||
' . ($interface['ifAlias'] ? '<span class="body-date-1">' . truncate($interface['ifAlias'], 20, '') . '</span>' : '')
|
||||
" . generate_port_link($interface, substr(makeshortif($interface['label']), 0, 13)) . ' <br />
|
||||
' . ($interface['ifAlias'] ? '<span class="body-date-1">' . substr($interface['ifAlias'], 0, 20) . '</span>' : '')
|
||||
);
|
||||
++$count_boxes;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ if (isset($config['enable_bgp']) && $config['enable_bgp']) {
|
||||
generate_device_link($peer, shorthost($peer['hostname'])) . "<br />
|
||||
<span class=bgp-down>BGP Down</span>
|
||||
<span class='" . (strstr($peer['bgpPeerIdentifier'], ':') ? 'front-page-bgp-small' : 'front-page-bgp-normal') . "'>" . $peer['bgpPeerIdentifier'] . '</span><br />
|
||||
<span class=body-date-1>AS' . truncate($peer['bgpPeerRemoteAs'] . ' ' . $peer['astext'], 14, '') . '</span>'
|
||||
<span class=body-date-1>AS' . substr($peer['bgpPeerRemoteAs'] . ' ' . $peer['astext'], 0, 14) . '</span>'
|
||||
);
|
||||
++$count_boxes;
|
||||
}
|
||||
|
@@ -167,7 +167,7 @@ if ($_SESSION['userlevel'] >= '5') {
|
||||
text-align: center; float: left; background-color: ".$list_colour_b_b.";'>
|
||||
<div style='font-weight: bold;'>".makeshortif($port['ifDescr']).'</div>';
|
||||
print_port_thumbnail($port);
|
||||
echo "<div style='font-size: 9px;'>".truncate(short_port_descr($port['ifAlias']), 22, '').'</div>
|
||||
echo "<div style='font-size: 9px;'>".substr(short_port_descr($port['ifAlias']), 0, 22).'</div>
|
||||
</div>';
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user