refactor: Remove inappropriate usages of truncate() (#5028)

Where truncate() is used as substr(), replace with substr()
This commit is contained in:
Tony Murray
2016-11-20 05:12:25 -06:00
committed by Neil Lathwood
parent e469aa97b0
commit a83e126b40
27 changed files with 34 additions and 34 deletions

View File

@@ -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>';

View File

@@ -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.'&amp;id='.$port['port_id'].'&amp;from='.$from.'&amp;to='.$config['time']['now']."&amp;width=180&amp;height=45&amp;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>';
}

View File

@@ -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&amp;if=" . $interface['port_id'] . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . "&amp;width=100&amp;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;
}

View File

@@ -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;