Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Cleanup printing ifAlias #4874

Merged
merged 3 commits into from Dec 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions html/ajax_listports.php
Expand Up @@ -23,8 +23,7 @@
if (is_numeric($_GET['device_id'])) {
foreach (dbFetch('SELECT * FROM ports WHERE device_id = ?', array($_GET['device_id'])) as $interface) {
$interface = ifNameDescr($interface);
$string = mres($interface['label'].' - '.$interface['ifAlias']);
$string = display($interface['label'].' - '.$interface['ifAlias']);
echo "obj.options[obj.options.length] = new Option('".$string."','".$interface['port_id']."');\n";
// echo("obj.options[obj.options.length] = new Option('".$interface['ifDescr']." - ".$interface['ifAlias']."','".$interface['port_id']."');\n");
}
}
2 changes: 1 addition & 1 deletion html/ajax_search.php
Expand Up @@ -104,7 +104,7 @@

foreach ($results as $result) {
$name = $result['ifDescr'] == $result['ifAlias'] ? $result['ifName'] : $result['ifDescr'];
$description = $result['ifAlias'];
$description = display($result['ifAlias']);

if ($result['deleted'] == 0 && ($result['ignore'] == 0 || $result['ignore'] == 0) && ($result['ifInErrors_delta'] > 0 || $result['ifOutErrors_delta'] > 0)) {
// Errored ports
Expand Down
4 changes: 2 additions & 2 deletions html/includes/functions.inc.php
Expand Up @@ -605,7 +605,7 @@ function generate_port_link($port, $text = null, $type = null, $overlib = 1, $si

$content = '<div class=list-large>'.$port['hostname'].' - '.fixifName($port['label']).'</div>';
if ($port['ifAlias']) {
$content .= escape_quotes($port['ifAlias']).'<br />';
$content .= display($port['ifAlias']).'<br />';
}

$content .= "<div style=\'width: 850px\'>";
Expand Down Expand Up @@ -856,7 +856,7 @@ function generate_ap_link($args, $text = null, $type = null)

$content = '<div class=list-large>'.$args['text'].' - '.fixifName($args['label']).'</div>';
if ($args['ifAlias']) {
$content .= $args['ifAlias'].'<br />';
$content .= display($args['ifAlias']).'<br />';
}

$content .= "<div style=\'width: 850px\'>";
Expand Down
2 changes: 1 addition & 1 deletion html/includes/graphs/device/bits.inc.php
Expand Up @@ -30,7 +30,7 @@
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = shorten_interface_type($port['label']);
$rrd_list[$i]['descr_in'] = $port['label'];
$rrd_list[$i]['descr_out'] = $port['ifAlias'];
$rrd_list[$i]['descr_out'] = display($port['ifAlias']);
$rrd_list[$i]['ds_in'] = $ds_in;
$rrd_list[$i]['ds_out'] = $ds_out;
$i++;
Expand Down
2 changes: 1 addition & 1 deletion html/includes/graphs/location/bits.inc.php
Expand Up @@ -30,7 +30,7 @@
$rrd_list[$i]['filename'] = $rrd_filename;
$rrd_list[$i]['descr'] = $port['label'];
$rrd_list[$i]['descr_in'] = $device['hostname'];
$rrd_list[$i]['descr_out'] = $port['ifAlias'];
$rrd_list[$i]['descr_out'] = display($port['ifAlias']);
$rrd_list[$i]['ds_in'] = $ds_in;
$rrd_list[$i]['ds_out'] = $ds_out;
$i++;
Expand Down
2 changes: 1 addition & 1 deletion html/includes/graphs/port/auth.inc.php
Expand Up @@ -6,7 +6,7 @@
$title = generate_device_link($device);
$title .= ' :: Port '.generate_port_link($port);
if ($port['ifAlias'] != '') {
$title .= ', '.$port['ifAlias'];
$title .= ', '.display($port['ifAlias']);
}

$graph_title = shorthost($device['hostname']).'::'.strtolower(makeshortif($port['ifDescr']));
Expand Down
2 changes: 1 addition & 1 deletion html/includes/modal/new_bill.inc.php
Expand Up @@ -57,7 +57,7 @@
// Need to pre-populate port as we've got a port pre-selected
foreach (dbFetch('SELECT * FROM ports WHERE device_id = ?', array($port_device_id)) as $interface) {
$interface = ifNameDescr($interface);
$string = $interface['label'].' - '.$interface['ifAlias'];
$string = $interface['label'].' - '.display($interface['ifAlias']);
$selected = $interface['port_id'] === $port['port_id'] ? " selected" : "";
echo "<option value='${interface['port_id']}' $selected>$string</option>\n";
}
Expand Down
2 changes: 1 addition & 1 deletion html/includes/print-interface-adsl.inc.php
Expand Up @@ -25,7 +25,7 @@
<td valign=top width=350>";
echo ' <span class=list-large>
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label']).'
</span><br /><span class=interface-desc>'.$port['ifAlias'].'</span>';
</span><br /><span class=interface-desc>'.display($port['ifAlias']).'</span>';

if ($port['ifAlias']) {
echo '<br />';
Expand Down
4 changes: 2 additions & 2 deletions html/includes/print-interface.inc.php
Expand Up @@ -39,11 +39,11 @@
if ($device['os'] == 'nos') {
echo ' <span class=list-large>
'.generate_port_link($port, $port['label'])." $error_img $mac
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
</span><br /><span class=interface-desc>".display($port['ifAlias']).'</span>';
} else {
echo ' <span class=list-large>
'.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac
</span><br /><span class=interface-desc>".$port['ifAlias'].'</span>';
</span><br /><span class=interface-desc>".display($port['ifAlias']).'</span>';
}

if ($port['ifAlias']) {
Expand Down
2 changes: 1 addition & 1 deletion html/includes/print-vlan.inc.php
Expand Up @@ -38,7 +38,7 @@
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
<a href='device/device=".$device['device_id'].'/tab=port/port='.$port['port_id']."/' onmouseover=\"return overlib('\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname'].' - '.$port['ifDescr'].'</div>\
'.$port['ifAlias']." \
'.display($port['ifAlias'])." \
<img src=\'graph.php?type=$graph_type&amp;id=".$port['port_id'].'&amp;from='.$config['time']['twoday'].'&amp;to='.$config['time']['now']."&amp;width=450&amp;height=150\'>\
', 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='.$config['time']['twoday'].'&amp;to='.$config['time']['now']."&amp;width=132&amp;height=40&amp;legend=no'>
</a>
Expand Down
4 changes: 2 additions & 2 deletions html/includes/print-vrf.inc.php
Expand Up @@ -21,11 +21,11 @@
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
<a href='device/".$device['device_id'].'/port/'.$port['port_id']."/' onmouseover=\"return overlib('\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname'].' - '.$port['ifDescr'].'</div>\
'.$port['ifAlias']." \
'.display($port['ifAlias'])." \
<img src=\'graph.php?type=$graph_type&amp;id=".$port['port_id'].'&amp;from='.$config['time']['twoday'].'&amp;to='.$config['time']['now']."&amp;width=450&amp;height=150\'>\
', 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='.$config['time']['twoday'].'&amp;to='.$config['time']['now']."&amp;width=132&amp;height=40&amp;legend=no'>
</a>
<div style='font-size: 9px;'>".substr(short_port_descr($port['ifAlias']), 0, 22).'</div>
<div style='font-size: 9px;'>".substr(short_port_descr(display($port['ifAlias'])), 0, 22).'</div>
</div>';
} else {
echo $vrf['port_sep'].generate_port_link($port, makeshortif($port['ifDescr']));
Expand Down
2 changes: 1 addition & 1 deletion html/includes/reports/ports.csv.inc.php
Expand Up @@ -165,7 +165,7 @@
$port['in_rate'],
$port['out_rate'],
$type,
$port['ifAlias'],
display($port['ifAlias']),
);
}
}
2 changes: 1 addition & 1 deletion html/includes/table/address-search.inc.php
Expand Up @@ -103,7 +103,7 @@
'hostname' => generate_device_link($interface),
'interface' => generate_port_link($interface).' '.$error_img,
'address' => $address,
'description' => $interface['ifAlias'],
'description' => display($interface['ifAlias']),
);
}
}//end foreach
Expand Down
2 changes: 1 addition & 1 deletion html/includes/table/edit-ports.inc.php
Expand Up @@ -70,7 +70,7 @@
'ignore' => '<input type="checkbox" class="ignore-check" name="ignore_'.$port['port_id'].'"'.($port['ignore'] ? 'checked' : '').'>
<input type="hidden" name="oldign_'.$port['port_id'].'" value="'.($port['ignore'] ? 1 : 0).'"">',
'port_tune' => '<input type="checkbox" id="override_config" name="override_config" data-attrib="ifName_tune:'.$port['ifName'].'" data-device_id="'.$port['device_id'].'" data-size="small" '.$checked.'>',
'ifAlias' => '<div class="form-group"><input class="form-control input-sm" id="if-alias" name="if-alias" data-device_id="'.$port['device_id'].'" data-port_id="'.$port['port_id'].'" data-ifName="'.$port['ifName'].'" value="'.$port['ifAlias'].'"><span class="form-control-feedback"><i class="fa" aria-hidden="true"></i></span></div>',
'ifAlias' => '<div class="form-group"><input class="form-control input-sm" id="if-alias" name="if-alias" data-device_id="'.$port['device_id'].'" data-port_id="'.$port['port_id'].'" data-ifName="'.$port['ifName'].'" value="'.display($port['ifAlias']).'"><span class="form-control-feedback"><i class="fa" aria-hidden="true"></i></span></div>',
'ifSpeed' => '<div class="form-group has-feedback"><input type="text" pattern="[0-9]*" inputmode="numeric" class="form-control input-sm" id="if-speed" name="if-speed" data-device_id="'.$port['device_id'].'" data-port_id="'.$port['port_id'].'" data-ifName="'.$port['ifName'].'" value="'.$port['ifSpeed'].'"><span class="form-control-feedback"><i class="fa" aria-hidden="true"></i></span></div>',
);
}//end foreach
Expand Down
2 changes: 1 addition & 1 deletion html/includes/table/ports.inc.php
Expand Up @@ -154,7 +154,7 @@
'ifInErrors' => $port['ifInErrors'],
'ifOutErrors' => $port['ifOutErrors'],
'ifType' => humanmedia($port['ifType']),
'description' => $port['ifAlias'],
'description' => display($port['ifAlias']),
'actions' => $actions,
);
}
Expand Down
2 changes: 1 addition & 1 deletion html/includes/table/stp-ports.inc.php
Expand Up @@ -34,7 +34,7 @@
$root_device = dbFetchRow("SELECT `devices`.*, `stp`.`device_id`, `stp`.`bridgeAddress` FROM `devices` JOIN `stp` ON `devices`.`device_id`=`stp`.`device_id` WHERE `stp`.`bridgeAddress` = ?", array($stp_ports_db['designatedRoot']));

$response[] = array (
'port_id' => generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."<br>".$stp_ports_db['ifAlias'],
'port_id' => generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."<br>".display($stp_ports_db['ifAlias']),
'priority' => $stp_ports_db['priority'],
'state' => $stp_ports_db['state'],
'enable' => $stp_ports_db['enable'],
Expand Down
2 changes: 1 addition & 1 deletion html/pages/bill.inc.php
Expand Up @@ -75,7 +75,7 @@ function print_port_list()

// Collected Earlier
foreach ($ports as $port) {
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
$portalias = (empty($port['ifAlias']) ? '' : ' - '.display($port['ifAlias']).'');

echo '<div class="list-group-item">';
echo generate_port_link($port, $port['ifName'].$portalias).' on '.generate_device_link($port);
Expand Down
2 changes: 1 addition & 1 deletion html/pages/bill/edit.inc.php
Expand Up @@ -103,7 +103,7 @@ function billType() {
<div class="list-group">
<?php foreach ($ports as $port) {
$emptyCheck = true;
$portalias = (empty($port['ifAlias']) ? '' : ' - '.$port['ifAlias'].'');
$portalias = (empty($port['ifAlias']) ? '' : ' - '.display($port['ifAlias']).'');

?>
<div class="list-group-item">
Expand Down
4 changes: 2 additions & 2 deletions html/pages/device/ports.inc.php
Expand Up @@ -107,12 +107,12 @@
<a href="'.generate_port_url($port)."\" onmouseover=\"return overlib('\
<div style=\'background-color: #ffffff;\'>\
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #555;\'>".$device['hostname'].' - '.$port['ifDescr'].'</div>\
'.$port['ifAlias']." \
'.display($port['ifAlias'])." \
<img src=\'graph.php?type=".$graph_type.'&amp;id='.$port['port_id'].'&amp;from='.$from.'&amp;to='.$config['time']['now']."&amp;width=450&amp;height=150\'>\
</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;'>".substr(short_port_descr($port['ifAlias']), 0, 32).'</div>
<div style='font-size: 9px;'>".substr(short_port_descr(display($port['ifAlias'])), 0, 32).'</div>
</div>';
}

Expand Down
4 changes: 2 additions & 2 deletions html/pages/device/ports/neighbours.inc.php
Expand Up @@ -18,12 +18,12 @@
}

echo '<tr bgcolor="'.$bg_colour.'">';
echo '<td><span style="font-weight: bold;">'.generate_port_link($neighbour).'</span><br />'.$neighbour['ifAlias'].'</td>';
echo '<td><span style="font-weight: bold;">'.generate_port_link($neighbour).'</span><br />'.display($neighbour['ifAlias']).'</td>';

if (is_numeric($neighbour['remote_port_id']) && $neighbour['remote_port_id']) {
$remote_port = get_port_by_id($neighbour['remote_port_id']);
$remote_device = device_by_id_cache($remote_port['device_id']);
echo '<td>'.generate_port_link($remote_port).'<br />'.$remote_port['ifAlias'].'</td>';
echo '<td>'.generate_port_link($remote_port).'<br />'.display($remote_port['ifAlias']).'</td>';
echo '<td>'.generate_device_link($remote_device).'<br />'.$remote_device['hardware'].'</td>';
} else {
echo '<td>'.$neighbour['remote_port'].'</td>';
Expand Down
2 changes: 1 addition & 1 deletion html/pages/device/pseudowires.inc.php
Expand Up @@ -73,7 +73,7 @@
echo "<tr style=\"background-color: #$bg;\"><td rowspan=2 style='font-size:18px; padding:4px;'>".$pw_a['cpwVcID'].'</td><td>'.generate_port_link($pw_a)."</td>
<td rowspan=2> <img src='images/16/arrow_right.png'> </td>
<td>".generate_device_link($pw_b).'</td><td>'.generate_port_link($pw_b).'</td></tr>';
echo "<tr style=\"background-color: #$bg;\"><td colspan=2>".$pw_a['ifAlias'].'</td><td>'.$pw_b['ifAlias'].'</td></tr>';
echo "<tr style=\"background-color: #$bg;\"><td colspan=2>".display($pw_a['ifAlias']).'</td><td>'.display($pw_b['ifAlias']).'</td></tr>';

if ($vars['view'] == 'minigraphs') {
echo "<tr style=\"background-color: #$bg;\"><td></td><td colspan=2>";
Expand Down
2 changes: 1 addition & 1 deletion html/pages/edituser.inc.php
Expand Up @@ -121,7 +121,7 @@
foreach ($interface_perms as $interface_perm) {
echo '<tr>
<td>
<strong>'.$interface_perm['hostname'].' - '.$interface_perm['ifDescr'].'</strong>'.''.$interface_perm['ifAlias']."
<strong>'.$interface_perm['hostname'].' - '.$interface_perm['ifDescr'].'</strong>'.''.display($interface_perm['ifAlias'])."
</td>
<td>
&nbsp;&nbsp;<a href='edituser/action=delifperm/user_id=".$vars['user_id'].'/port_id='.$interface_perm['port_id']."'><img src='images/16/cross.png' align=absmiddle border=0></a>
Expand Down
4 changes: 2 additions & 2 deletions html/pages/iftype.inc.php
Expand Up @@ -46,8 +46,8 @@
foreach ($ports as $port) {
$done = 'yes';
unset($class);
$port['ifAlias'] = str_ireplace($type.': ', '', $port['ifAlias']);
$port['ifAlias'] = str_ireplace('[PNI]', 'Private', $port['ifAlias']);
$port['ifAlias'] = str_ireplace($type.': ', '', display($port['ifAlias']));
$port['ifAlias'] = str_ireplace('[PNI]', 'Private', display($port['ifAlias']));
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
if ($bg == '#ffffff') {
$bg = '#e5e5e5';
Expand Down
2 changes: 1 addition & 1 deletion html/pages/ports/list.inc.php
Expand Up @@ -77,7 +77,7 @@ function formatUnits(units,decimals,display,base) {
ifSpeed: '<?php echo mres($vars['ifSpeed']); ?>',
ifType: '<?php echo mres($vars['ifType']); ?>',
port_descr_type: '<?php echo mres($vars['port_descr_type']); ?>',
ifAlias: '<?php echo htmlspecialchars($vars['ifAlias']); ?>',
ifAlias: '<?php echo $vars['ifAlias']; ?>',
location: '<?php echo mres($vars['location']); ?>',
disabled: '<?php echo mres($vars['disabled']); ?>',
ignore: '<?php echo mres($vars['ignore']); ?>',
Expand Down
2 changes: 1 addition & 1 deletion html/pages/pseudowires.inc.php
Expand Up @@ -76,7 +76,7 @@
echo "<tr style=\"background-color: #$bg;\"><td rowspan=2 style='font-size:18px; padding:4px;'>".$pw_a['cpwVcID'].'</td><td>'.generate_device_link($pw_a).'</td><td>'.generate_port_link($pw_a)."</td>
<td rowspan=2> <img src='images/16/arrow_right.png'> </td>
<td>".generate_device_link($pw_b).'</td><td>'.generate_port_link($pw_b).'</td></tr>';
echo "<tr style=\"background-color: #$bg;\"><td colspan=2>".$pw_a['ifAlias'].'</td><td colspan=2>'.$pw_b['ifAlias'].'</td></tr>';
echo "<tr style=\"background-color: #$bg;\"><td colspan=2>".display($pw_a['ifAlias']).'</td><td colspan=2>'.display($pw_b['ifAlias']).'</td></tr>';

if ($vars['view'] == 'minigraphs') {
echo "<tr style=\"background-color: #$bg;\"><td></td><td colspan=2>";
Expand Down
2 changes: 1 addition & 1 deletion html/pages/routing/vrf.inc.php
Expand Up @@ -167,7 +167,7 @@
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;'>".substr(short_port_descr($port['ifAlias']), 0, 22).'</div>
echo "<div style='font-size: 9px;'>".substr(short_port_descr(display($port['ifAlias'])), 0, 22).'</div>
</div>';
break;

Expand Down