From c7e3ec793ed36a646fd6f0c54e61537fbc321f37 Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 24 Oct 2016 22:54:59 +0000 Subject: [PATCH] fix: Cleanup printing ifAlias --- html/ajax_listports.php | 3 +-- html/ajax_search.php | 2 +- html/includes/functions.inc.php | 4 ++-- html/includes/graphs/device/bits.inc.php | 2 +- html/includes/graphs/location/bits.inc.php | 2 +- html/includes/graphs/port/auth.inc.php | 2 +- html/includes/modal/new_bill.inc.php | 2 +- html/includes/print-interface-adsl.inc.php | 2 +- html/includes/print-interface.inc.php | 4 ++-- html/includes/print-vlan.inc.php | 2 +- html/includes/print-vrf.inc.php | 4 ++-- html/includes/reports/ports.csv.inc.php | 2 +- html/includes/table/address-search.inc.php | 2 +- html/includes/table/edit-ports.inc.php | 2 +- html/includes/table/ports.inc.php | 2 +- html/includes/table/stp-ports.inc.php | 2 +- html/pages/bill.inc.php | 2 +- html/pages/bill/edit.inc.php | 2 +- html/pages/device/ports.inc.php | 4 ++-- html/pages/device/ports/neighbours.inc.php | 4 ++-- html/pages/device/pseudowires.inc.php | 2 +- html/pages/edituser.inc.php | 2 +- html/pages/iftype.inc.php | 4 ++-- html/pages/ports/list.inc.php | 2 +- html/pages/pseudowires.inc.php | 2 +- html/pages/routing/vrf.inc.php | 2 +- includes/common.php | 2 +- 27 files changed, 33 insertions(+), 34 deletions(-) diff --git a/html/ajax_listports.php b/html/ajax_listports.php index 7c61af1cae91..2c5e58b85845 100644 --- a/html/ajax_listports.php +++ b/html/ajax_listports.php @@ -31,8 +31,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"); } } diff --git a/html/ajax_search.php b/html/ajax_search.php index 526ef157a517..fb20f15e983b 100644 --- a/html/ajax_search.php +++ b/html/ajax_search.php @@ -108,7 +108,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 diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 5be11d8d571b..9a6b14ebd365 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -605,7 +605,7 @@ function generate_port_link($port, $text = null, $type = null, $overlib = 1, $si $content = '
'.$port['hostname'].' - '.fixifName($port['label']).'
'; if ($port['ifAlias']) { - $content .= escape_quotes($port['ifAlias']).'
'; + $content .= display($port['ifAlias']).'
'; } $content .= "
"; @@ -856,7 +856,7 @@ function generate_ap_link($args, $text = null, $type = null) $content = '
'.$args['text'].' - '.fixifName($args['label']).'
'; if ($args['ifAlias']) { - $content .= $args['ifAlias'].'
'; + $content .= display($args['ifAlias']).'
'; } $content .= "
"; diff --git a/html/includes/graphs/device/bits.inc.php b/html/includes/graphs/device/bits.inc.php index 968999de8061..dd209e6716f0 100644 --- a/html/includes/graphs/device/bits.inc.php +++ b/html/includes/graphs/device/bits.inc.php @@ -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++; diff --git a/html/includes/graphs/location/bits.inc.php b/html/includes/graphs/location/bits.inc.php index 1abbc1917020..5b863a165452 100644 --- a/html/includes/graphs/location/bits.inc.php +++ b/html/includes/graphs/location/bits.inc.php @@ -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++; diff --git a/html/includes/graphs/port/auth.inc.php b/html/includes/graphs/port/auth.inc.php index cddf39f67c52..a058b4bf74f7 100644 --- a/html/includes/graphs/port/auth.inc.php +++ b/html/includes/graphs/port/auth.inc.php @@ -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'])); diff --git a/html/includes/modal/new_bill.inc.php b/html/includes/modal/new_bill.inc.php index 4cf61d00085c..27e049c104ba 100644 --- a/html/includes/modal/new_bill.inc.php +++ b/html/includes/modal/new_bill.inc.php @@ -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 "\n"; } diff --git a/html/includes/print-interface-adsl.inc.php b/html/includes/print-interface-adsl.inc.php index f914f9be2a17..10b0a41f3b7d 100644 --- a/html/includes/print-interface-adsl.inc.php +++ b/html/includes/print-interface-adsl.inc.php @@ -25,7 +25,7 @@ "; echo ' '.generate_port_link($port, $port['ifIndex'].'. '.$port['label']).' -
'.$port['ifAlias'].''; +
'.display($port['ifAlias']).''; if ($port['ifAlias']) { echo '
'; diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index 0a96fde91d03..1f3298057fa7 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -39,11 +39,11 @@ if ($device['os'] == 'nos') { echo ' '.generate_port_link($port, $port['label'])." $error_img $mac -
".$port['ifAlias'].''; +
".display($port['ifAlias']).''; } else { echo ' '.generate_port_link($port, $port['ifIndex'].'. '.$port['label'])." $error_img $mac -
".$port['ifAlias'].''; +
".display($port['ifAlias']).''; } if ($port['ifAlias']) { diff --git a/html/includes/print-vlan.inc.php b/html/includes/print-vlan.inc.php index 107985ac5411..58f7e0bea858 100644 --- a/html/includes/print-vlan.inc.php +++ b/html/includes/print-vlan.inc.php @@ -38,7 +38,7 @@
".makeshortif($port['ifDescr'])."
".$device['hostname'].' - '.$port['ifDescr'].'
\ - '.$port['ifAlias']." \ + '.display($port['ifAlias'])." \ \ ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >"." diff --git a/html/includes/print-vrf.inc.php b/html/includes/print-vrf.inc.php index b1fa705b9bd4..9fda54d9ac24 100644 --- a/html/includes/print-vrf.inc.php +++ b/html/includes/print-vrf.inc.php @@ -21,11 +21,11 @@
".makeshortif($port['ifDescr'])."
".$device['hostname'].' - '.$port['ifDescr'].'
\ - '.$port['ifAlias']." \ + '.display($port['ifAlias'])." \ \ ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >"." -
".truncate(short_port_descr($port['ifAlias']), 22, '').'
+
".truncate(short_port_descr(display($port['ifAlias'])), 22, '').'
'; } else { echo $vrf['port_sep'].generate_port_link($port, makeshortif($port['ifDescr'])); diff --git a/html/includes/reports/ports.csv.inc.php b/html/includes/reports/ports.csv.inc.php index 89a1c6214d52..50704dfbd486 100644 --- a/html/includes/reports/ports.csv.inc.php +++ b/html/includes/reports/ports.csv.inc.php @@ -165,7 +165,7 @@ $port['in_rate'], $port['out_rate'], $type, - $port['ifAlias'], + display($port['ifAlias']), ); } } diff --git a/html/includes/table/address-search.inc.php b/html/includes/table/address-search.inc.php index 132b8a49c0d6..7ef2cf538110 100644 --- a/html/includes/table/address-search.inc.php +++ b/html/includes/table/address-search.inc.php @@ -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 diff --git a/html/includes/table/edit-ports.inc.php b/html/includes/table/edit-ports.inc.php index 5eec910397c8..c18c2fee9a0a 100644 --- a/html/includes/table/edit-ports.inc.php +++ b/html/includes/table/edit-ports.inc.php @@ -70,7 +70,7 @@ 'ignore' => ' ', 'port_tune' => '', - 'ifAlias' => '
', + 'ifAlias' => '
', 'ifSpeed' => '
', ); }//end foreach diff --git a/html/includes/table/ports.inc.php b/html/includes/table/ports.inc.php index 69158835ac76..7e858720899a 100644 --- a/html/includes/table/ports.inc.php +++ b/html/includes/table/ports.inc.php @@ -154,7 +154,7 @@ 'ifInErrors' => $port['ifInErrors'], 'ifOutErrors' => $port['ifOutErrors'], 'ifType' => humanmedia($port['ifType']), - 'description' => $port['ifAlias'], + 'description' => display($port['ifAlias']), 'actions' => $actions, ); } diff --git a/html/includes/table/stp-ports.inc.php b/html/includes/table/stp-ports.inc.php index aa45723cdba5..cbff751cfcce 100644 --- a/html/includes/table/stp-ports.inc.php +++ b/html/includes/table/stp-ports.inc.php @@ -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'])."
".$stp_ports_db['ifAlias'], + 'port_id' => generate_port_link($stp_ports_db, $stp_ports_db['ifName'])."
".display($stp_ports_db['ifAlias']), 'priority' => $stp_ports_db['priority'], 'state' => $stp_ports_db['state'], 'enable' => $stp_ports_db['enable'], diff --git a/html/pages/bill.inc.php b/html/pages/bill.inc.php index 78abdaa2594c..b4afc65caaa9 100644 --- a/html/pages/bill.inc.php +++ b/html/pages/bill.inc.php @@ -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 '
'; echo generate_port_link($port, $port['ifName'].$portalias).' on '.generate_device_link($port); diff --git a/html/pages/bill/edit.inc.php b/html/pages/bill/edit.inc.php index 79e3c066b9c1..efeae5611d96 100644 --- a/html/pages/bill/edit.inc.php +++ b/html/pages/bill/edit.inc.php @@ -103,7 +103,7 @@ function billType() {
diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index 3b280ce1b6fb..519283fd010e 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -107,12 +107,12 @@ \
".$device['hostname'].' - '.$port['ifDescr'].'
\ - '.$port['ifAlias']." \ + '.display($port['ifAlias'])." \ \
\ ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >"." -
".truncate(short_port_descr($port['ifAlias']), 32, '').'
+
".truncate(short_port_descr(display($port['ifAlias'])), 32, '').'
'; } diff --git a/html/pages/device/ports/neighbours.inc.php b/html/pages/device/ports/neighbours.inc.php index f6034b53d064..9f747e77354c 100644 --- a/html/pages/device/ports/neighbours.inc.php +++ b/html/pages/device/ports/neighbours.inc.php @@ -18,12 +18,12 @@ } echo ''; - echo ''.generate_port_link($neighbour).'
'.$neighbour['ifAlias'].''; + echo ''.generate_port_link($neighbour).'
'.display($neighbour['ifAlias']).''; 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 ''.generate_port_link($remote_port).'
'.$remote_port['ifAlias'].''; + echo ''.generate_port_link($remote_port).'
'.display($remote_port['ifAlias']).''; echo ''.generate_device_link($remote_device).'
'.$remote_device['hardware'].''; } else { echo ''.$neighbour['remote_port'].''; diff --git a/html/pages/device/pseudowires.inc.php b/html/pages/device/pseudowires.inc.php index 1e12facf2e11..e26b31f8c210 100644 --- a/html/pages/device/pseudowires.inc.php +++ b/html/pages/device/pseudowires.inc.php @@ -73,7 +73,7 @@ echo "".$pw_a['cpwVcID'].''.generate_port_link($pw_a)." ".generate_device_link($pw_b).''.generate_port_link($pw_b).''; - echo "".$pw_a['ifAlias'].''.$pw_b['ifAlias'].''; + echo "".display($pw_a['ifAlias']).''.display($pw_b['ifAlias']).''; if ($vars['view'] == 'minigraphs') { echo ""; diff --git a/html/pages/edituser.inc.php b/html/pages/edituser.inc.php index 85379787247c..7303e546f749 100644 --- a/html/pages/edituser.inc.php +++ b/html/pages/edituser.inc.php @@ -121,7 +121,7 @@ foreach ($interface_perms as $interface_perm) { echo ' - '.$interface_perm['hostname'].' - '.$interface_perm['ifDescr'].''.''.$interface_perm['ifAlias']." + '.$interface_perm['hostname'].' - '.$interface_perm['ifDescr'].''.''.display($interface_perm['ifAlias'])."    diff --git a/html/pages/iftype.inc.php b/html/pages/iftype.inc.php index 85010808cae3..19b0a026dde8 100644 --- a/html/pages/iftype.inc.php +++ b/html/pages/iftype.inc.php @@ -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'; diff --git a/html/pages/ports/list.inc.php b/html/pages/ports/list.inc.php index 6900ad4aa3d2..2defa4254a55 100644 --- a/html/pages/ports/list.inc.php +++ b/html/pages/ports/list.inc.php @@ -77,7 +77,7 @@ function formatUnits(units,decimals,display,base) { ifSpeed: '', ifType: '', port_descr_type: '', - ifAlias: '', + ifAlias: '', location: '', disabled: '', ignore: '', diff --git a/html/pages/pseudowires.inc.php b/html/pages/pseudowires.inc.php index c053720b77d3..1946c0e9e60d 100644 --- a/html/pages/pseudowires.inc.php +++ b/html/pages/pseudowires.inc.php @@ -76,7 +76,7 @@ echo "".$pw_a['cpwVcID'].''.generate_device_link($pw_a).''.generate_port_link($pw_a)." ".generate_device_link($pw_b).''.generate_port_link($pw_b).''; - echo "".$pw_a['ifAlias'].''.$pw_b['ifAlias'].''; + echo "".display($pw_a['ifAlias']).''.display($pw_b['ifAlias']).''; if ($vars['view'] == 'minigraphs') { echo ""; diff --git a/html/pages/routing/vrf.inc.php b/html/pages/routing/vrf.inc.php index 3fe633be3087..fea5c8131a01 100644 --- a/html/pages/routing/vrf.inc.php +++ b/html/pages/routing/vrf.inc.php @@ -167,7 +167,7 @@ text-align: center; float: left; background-color: ".$list_colour_b_b.";'>
".makeshortif($port['ifDescr']).'
'; print_port_thumbnail($port); - echo "
".truncate(short_port_descr($port['ifAlias']), 22, '').'
+ echo "
".truncate(short_port_descr(display($port['ifAlias'])), 22, '').'
'; break; diff --git a/includes/common.php b/includes/common.php index 62e8a279e6e2..37b1a1d75722 100644 --- a/includes/common.php +++ b/includes/common.php @@ -1496,5 +1496,5 @@ function clean($value) */ function display($value) { - return htmlentities(stripslashes(strip_tags($value))); + return htmlentities(stripslashes(stripslashes(strip_tags($value)))); }