diff --git a/html/includes/device-header.inc.php b/html/includes/device-header.inc.php
index d08dc376f3..8080c2c131 100644
--- a/html/includes/device-header.inc.php
+++ b/html/includes/device-header.inc.php
@@ -13,7 +13,7 @@
echo("
$image |
- " . generatedevicelink($device) . "
+ | " . generate_device_link($device) . "
" . $device['location'] . " |
|
");
diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php
index 5f47a11487..23486106b6 100644
--- a/html/includes/functions.inc.php
+++ b/html/includes/functions.inc.php
@@ -18,16 +18,7 @@ function rewrite_entity_descr ($descr) {
return $descr;
}
-function generateiflink($interface, $text=0, $type = NULL)
-{
-
- ## Exists only to support older version of this function (i suck)
-
- if($type) { $interface['type'] = $type; }
- return generate_if_link($interface, $text);
-}
-
-function generatedevicelink($device, $text=0, $start=0, $end=0)
+function generate_device_link($device, $text=0, $start=0, $end=0)
{
global $twoday; global $day; global $now; global $config;
if (!$start) { $start = $day; }
@@ -242,13 +233,13 @@ function print_percentage_bar ($width, $height, $percent, $left_text, $left_colo
return $output;
}
-function generate_if_link($args, $text = NULL)
+function generate_port_link($args, $text = NULL, $type = NULL)
{
global $twoday; global $now; global $config; global $day; global $month;
$args = ifNameDescr($args);
if(!$text) { $text = fixIfName($args['label']); }
+ if($type) { $args['graph_type'] = $type; }
if(!$args['graph_type']) { $args['graph_type'] = 'port_bits'; }
-
$class = ifclass($args['ifOperStatus'], $args['ifAdminStatus']);
if(!isset($args['hostname'])) { $args = array_merge($args, device_by_id_cache($args['device_id'])); }
@@ -286,7 +277,7 @@ function generate_port_thumbnail($args)
{
if(!$args['bg']) { $args['bg'] = "FFFFF"; }
$args['content'] = "
";
- $output = generate_if_link($args, $args['content']);
+ $output = generate_port_link($args, $args['content']);
echo $output;
}
diff --git a/html/includes/graphs/application/auth.inc.php b/html/includes/graphs/application/auth.inc.php
index c8a5701dfb..80256e0a58 100644
--- a/html/includes/graphs/application/auth.inc.php
+++ b/html/includes/graphs/application/auth.inc.php
@@ -4,7 +4,7 @@ if(is_numeric($id) && application_permitted($id))
{
$app = get_application_by_id($id);
$device = device_by_id_cache($app['device_id']);
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$title .= $graph_subtype;
$auth = TRUE;
}
diff --git a/html/includes/graphs/bgp/auth.inc.php b/html/includes/graphs/bgp/auth.inc.php
index 97ff118e15..204df1d81d 100644
--- a/html/includes/graphs/bgp/auth.inc.php
+++ b/html/includes/graphs/bgp/auth.inc.php
@@ -9,7 +9,7 @@ if(is_numeric($id))
{
$device = device_by_id_cache($data['device_id']);
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$title .= " :: BGP :: " . htmlentities($data['bgp_peerid']);
$auth = TRUE;
}
diff --git a/html/includes/graphs/customer/auth.inc.php b/html/includes/graphs/customer/auth.inc.php
index 54c76e8367..e740d68a7b 100755
--- a/html/includes/graphs/customer/auth.inc.php
+++ b/html/includes/graphs/customer/auth.inc.php
@@ -3,7 +3,7 @@
if ($_SESSION['userlevel'] >= "5")
{
$id = mres($_GET['id']);
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$auth = TRUE;
}
diff --git a/html/includes/graphs/device/auth.inc.php b/html/includes/graphs/device/auth.inc.php
index 7487d44a44..acd186fefe 100644
--- a/html/includes/graphs/device/auth.inc.php
+++ b/html/includes/graphs/device/auth.inc.php
@@ -3,7 +3,7 @@
if(is_numeric($id) && device_permitted($id))
{
$device = device_by_id_cache($id);
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$auth = TRUE;
}
diff --git a/html/includes/graphs/diskio/auth.inc.php b/html/includes/graphs/diskio/auth.inc.php
index 89bd5d7f82..2b76cac5b4 100644
--- a/html/includes/graphs/diskio/auth.inc.php
+++ b/html/includes/graphs/diskio/auth.inc.php
@@ -12,7 +12,7 @@ if(is_numeric($id))
$rrd_filename = $config['rrd_dir'] . "/" . $disk['hostname'] . "/ucd_diskio-" . safename($disk['diskio_descr'] . ".rrd");
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$title .= " :: Disk :: " . htmlentities($disk['diskio_descr']);
$auth = TRUE;
}
diff --git a/html/includes/graphs/mempool/auth.inc.php b/html/includes/graphs/mempool/auth.inc.php
index 7b19754183..b549cef04e 100755
--- a/html/includes/graphs/mempool/auth.inc.php
+++ b/html/includes/graphs/mempool/auth.inc.php
@@ -9,7 +9,7 @@ if(is_numeric($id))
{
$device = device_by_id_cache($mempool['device_id']);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("mempool-".$mempool['mempool_type']."-".$mempool['mempool_index'].".rrd");
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$title .= " :: Memory Pool :: " . htmlentities($mempool['mempool_descr']);
$auth = TRUE;
}
diff --git a/html/includes/graphs/multiport/auth.inc.php b/html/includes/graphs/multiport/auth.inc.php
index 8d62f590a7..f6881336bd 100644
--- a/html/includes/graphs/multiport/auth.inc.php
+++ b/html/includes/graphs/multiport/auth.inc.php
@@ -7,8 +7,8 @@
# $device = device_by_id_cache($port['device_id']);
#}
-#$title = generatedevicelink($device);
-#$title .= " :: Port ".generateiflink($port);
+#$title = generate_device_link($device);
+#$title .= " :: Port ".generate_port_link($port);
$title = "Multi Port :: ";
diff --git a/html/includes/graphs/port/auth.inc.php b/html/includes/graphs/port/auth.inc.php
index 002feb7d0e..a62c579f69 100644
--- a/html/includes/graphs/port/auth.inc.php
+++ b/html/includes/graphs/port/auth.inc.php
@@ -3,8 +3,8 @@
if(is_numeric($id) && port_permitted($id)) {
$port = get_port_by_id($id);
$device = device_by_id_cache($port['device_id']);
- $title = generatedevicelink($device);
- $title .= " :: Port ".generateiflink($port);
+ $title = generate_device_link($device);
+ $title .= " :: Port ".generate_port_link($port);
$auth = TRUE;
}
diff --git a/html/includes/graphs/processor/auth.inc.php b/html/includes/graphs/processor/auth.inc.php
index 98363488be..ae06324027 100755
--- a/html/includes/graphs/processor/auth.inc.php
+++ b/html/includes/graphs/processor/auth.inc.php
@@ -7,7 +7,7 @@ if(is_numeric($proc['device_id']) && device_permitted($proc['device_id']))
{
$device = device_by_id_cache($proc['device_id']);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("processor-" . $proc['processor_type'] . "-" . $proc['processor_index'] . ".rrd");
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$title .= " :: Processor :: " . htmlentities($proc['processor_descr']);
$auth = TRUE;
}
diff --git a/html/includes/graphs/sensor/auth.inc.php b/html/includes/graphs/sensor/auth.inc.php
index 1fd0d832b6..c6453f5186 100644
--- a/html/includes/graphs/sensor/auth.inc.php
+++ b/html/includes/graphs/sensor/auth.inc.php
@@ -11,7 +11,7 @@ if(is_numeric($id))
### This doesn't quite work for all yet.
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename($sensor['sensor_class']."-" . $sensor['sensor_type'] . "-".$sensor['sensor_index'].".rrd");
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$title .= " :: Sensor :: " . htmlentities($sensor['sensor_descr']);
$auth = TRUE;
}
diff --git a/html/includes/graphs/storage/auth.inc.php b/html/includes/graphs/storage/auth.inc.php
index 0343201a41..769dd03085 100755
--- a/html/includes/graphs/storage/auth.inc.php
+++ b/html/includes/graphs/storage/auth.inc.php
@@ -10,7 +10,7 @@ if(is_numeric($id))
$device = device_by_id_cache($storage['device_id']);
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/" . safename("storage-" . $storage['storage_mib'] . "-" . $storage['storage_descr'] . ".rrd");
- $title = generatedevicelink($device);
+ $title = generate_device_link($device);
$title .= " :: Storage :: " . htmlentities($storage['storage_descr']);
$auth = TRUE;
}
diff --git a/html/includes/hostbox.inc b/html/includes/hostbox.inc
index 9a095df17f..97406f2cfa 100644
--- a/html/includes/hostbox.inc
+++ b/html/includes/hostbox.inc
@@ -17,7 +17,7 @@
echo('
' . $image . ' |
- ' . generatedevicelink($device) . '
+ | ' . generate_device_link($device) . '
' . $device['sysName'] . ' |
' . $device['os_text'] . '
' . $device['version'] . ' |
diff --git a/html/includes/print-event-short.inc b/html/includes/print-event-short.inc
index f0f27fba4f..78250a2cd2 100644
--- a/html/includes/print-event-short.inc
+++ b/html/includes/print-event-short.inc
@@ -17,7 +17,7 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
");
if($entry['type'] == "interface") {
- $entry['link'] = "".generateiflink(getifbyid($entry['reference']))."";
+ $entry['link'] = "".generate_port_link(getifbyid($entry['reference']))."";
}
echo($entry['link'] ." ". htmlspecialchars($entry['message'])
diff --git a/html/includes/print-event.inc b/html/includes/print-event.inc
index 6b2c9f287d..cca256adb2 100644
--- a/html/includes/print-event.inc
+++ b/html/includes/print-event.inc
@@ -20,12 +20,12 @@ if(isset($bg) && $bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$li
$dev['device_id'] = $entry['host'];
$dev['hostname'] = $hostname;
echo(" |
- " . generatedevicelink($dev, shorthost($dev['hostname'])) . "
+ " . generate_device_link($dev, shorthost($dev['hostname'])) . "
| ");
}
if($entry['type'] == "interface") {
- $entry['link'] = "".generateiflink(getifbyid($entry['reference']))."";
+ $entry['link'] = "".generate_port_link(getifbyid($entry['reference']))."";
} else {
$entry['link'] = "System";
}
diff --git a/html/includes/print-interface-adsl.inc.php b/html/includes/print-interface-adsl.inc.php
index d215f10162..918cfc12ee 100644
--- a/html/includes/print-interface-adsl.inc.php
+++ b/html/includes/print-interface-adsl.inc.php
@@ -17,14 +17,14 @@
if($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
- $error_img = generateiflink($interface,"
","port_errors");
+ $error_img = generate_port_link($interface,"
","port_errors");
} else { $error_img = ""; }
echo("
");
echo("
- " . generateiflink($interface, $interface['ifIndex'] . ". ".$interface['label']) . "
+ " . generate_port_link($interface, $interface['ifIndex'] . ". ".$interface['label']) . "
".$interface['ifAlias']."");
@@ -53,7 +53,7 @@
echo(formatRates($interface['ifInOctets_rate'] * 8)." ".formatRates($interface['ifOutOctets_rate'] * 8));
echo(" ");
$interface['graph_type'] = "port_bits";
- echo(generateiflink($interface, " ", $interface['graph_type']));
@@ -61,35 +61,35 @@
echo("".formatRates($interface['adslAturChanCurrTxRate']) . "/". formatRates($interface['adslAtucChanCurrTxRate']));
echo(" ");
$interface['graph_type'] = "port_adsl_speed";
- echo(generateiflink($interface, " ", $interface['graph_type']));
echo(" | ");
echo("".formatRates($interface['adslAturCurrAttainableRate']) . "/". formatRates($interface['adslAtucCurrAttainableRate']));
echo(" ");
$interface['graph_type'] = "port_adsl_attainable";
- echo(generateiflink($interface, " ", $interface['graph_type']));
echo(" | ");
echo("".$interface['adslAturCurrAtn'] . "dB/". $interface['adslAtucCurrAtn'] . "dB");
echo(" ");
$interface['graph_type'] = "port_adsl_attenuation";
- echo(generateiflink($interface, " ", $interface['graph_type']));
echo(" | ");
echo("".$interface['adslAturCurrSnrMgn'] . "dB/". $interface['adslAtucCurrSnrMgn'] . "dB");
echo(" ");
$interface['graph_type'] = "port_adsl_snr";
- echo(generateiflink($interface, " ", $interface['graph_type']));
echo(" | ");
echo("".$interface['adslAturCurrOutputPwr'] . "dBm/". $interface['adslAtucCurrOutputPwr'] . "dBm");
echo(" ");
$interface['graph_type'] = "port_adsl_power";
- echo(generateiflink($interface, " ", $interface['graph_type']));
diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php
index b48e1251c1..636b10d892 100644
--- a/html/includes/print-interface.inc.php
+++ b/html/includes/print-interface.inc.php
@@ -20,7 +20,7 @@
if($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
- $error_img = generateiflink($interface," ","port_errors");
+ $error_img = generate_port_link($interface, " ", "port_errors");
} else { $error_img = ""; }
if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)){
@@ -31,7 +31,7 @@
| ");
echo("
- " . generateiflink($interface, $interface['ifIndex'] . ". ".$interface['label']) . " $error_img $mac
+ " . generate_port_link($interface, $interface['ifIndex'] . ". ".$interface['label']) . " $error_img $mac
".$interface['ifAlias']."");
@@ -57,11 +57,11 @@
if($port_details) {
$interface['graph_type'] = "port_bits";
- echo(generateiflink($interface, " ", $interface['graph_type']));
+ echo(generate_port_link($interface, " "));
$interface['graph_type'] = "port_upkts";
- echo(generateiflink($interface, " ",$interface['graph_type']));
+ echo(generate_port_link($interface, " "));
$interface['graph_type'] = "port_errors";
- echo(generateiflink($interface, " ",$interface['graph_type']));
+ echo(generate_port_link($interface, " "));
}
echo(" | ");
@@ -121,7 +121,7 @@ echo(" | ");
if ( strpos($interface['label'], "oopback") === false && !$graph_type) {
$link_query = mysql_query("select * from links AS L, ports AS I, devices AS D WHERE L.local_interface_id = '$if_id' AND L.remote_interface_id = I.interface_id AND I.device_id = D.device_id");
while($link = mysql_fetch_array($link_query)) {
-# echo("
" . generateiflink($link, makeshortif($link['label'])) . " on " . generatedevicelink($link, shorthost($link['hostname'])) . "
");
+# echo("
" . generate_port_link($link, makeshortif($link['label'])) . " on " . generate_device_link($link, shorthost($link['hostname'])) . "
");
# $br = "
";
$int_links[$link['interface_id']] = $link['interface_id'];
$int_links_phys[$link['interface_id']] = 1;
@@ -181,7 +181,7 @@ echo("");
if($int_links_phys[$int_link]) { echo("
"); } else {
echo("
"); }
- echo("" . generateiflink($link_if, makeshortif($link_if['label'])) . " on " . generatedevicelink($link_if, shorthost($link_if['hostname'])) );
+ echo("" . generate_port_link($link_if, makeshortif($link_if['label'])) . " on " . generate_device_link($link_if, shorthost($link_if['hostname'])) );
if($int_links_v6[$int_link]) { echo(" v6"); }
if($int_links_v4[$int_link]) { echo(" v4"); }
@@ -200,19 +200,19 @@ echo("");
P.cpwVcID = '".$pseudowire['cpwVcID']."' AND
P.interface_id = I.interface_id"));
$pw_peer_int = ifNameDescr($pw_peer_int);
- echo("$br
" . generateiflink($pw_peer_int, makeshortif($pw_peer_int['label'])) ." on ". generatedevicelink($pw_peer_dev, shorthost($pw_peer_dev['hostname'])) . "");
+ echo("$br
" . generate_port_link($pw_peer_int, makeshortif($pw_peer_int['label'])) ." on ". generate_device_link($pw_peer_dev, shorthost($pw_peer_dev['hostname'])) . "");
$br = "
";
}
$members = mysql_query("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = '".$interface['ifIndex']."' and `device_id` = '".$device['device_id']."'");
while($member = mysql_fetch_array($members)) {
- echo("$br
" . generateiflink($member) . " (PAgP)");
+ echo("$br
" . generate_port_link($member) . " (PAgP)");
$br = "
";
}
if($interface['pagpGroupIfIndex'] && $interface['pagpGroupIfIndex'] != $interface['ifIndex']) {
$parent = mysql_fetch_array(mysql_query("SELECT * FROM `ports` WHERE `ifIndex` = '".$interface['pagpGroupIfIndex']."' and `device_id` = '".$device['device_id']."'"));
- echo("$br
" . generateiflink($parent) . " (PAgP)");
+ echo("$br
" . generate_port_link($parent) . " (PAgP)");
$br = "
";
}
diff --git a/html/includes/print-service.inc b/html/includes/print-service.inc
index b685c793a0..f25db907d2 100644
--- a/html/includes/print-service.inc
+++ b/html/includes/print-service.inc
@@ -36,7 +36,7 @@ if($device_id) {
if(!$samehost) {
$device['device_id'] = $device_id;
$device['hostname'] = $device_hostname;
- echo("" . generatedevicelink($device) . " | ");
+ echo("" . generate_device_link($device) . " | ");
} else {
echo(" | ");
}
diff --git a/html/includes/print-syslog.inc b/html/includes/print-syslog.inc
index d72a7d7c73..7a05933c0f 100644
--- a/html/includes/print-syslog.inc
+++ b/html/includes/print-syslog.inc
@@ -16,7 +16,7 @@ if(!is_integer($syslog_iter/2)) { $bg_colour = $list_colour_a; } else { $bg_colo
$entry['hostname'] = shorthost($entry['hostname'], 20);
if($_GET['page'] != "device") {
- echo("".generatedevicelink($entry)." | ");
+ echo("".generate_device_link($entry)." | ");
}
echo("
diff --git a/html/includes/print-vlan.inc b/html/includes/print-vlan.inc
index 36761768fd..fc78ffe860 100644
--- a/html/includes/print-vlan.inc
+++ b/html/includes/print-vlan.inc
@@ -29,7 +29,7 @@ while($port = mysql_fetch_array($ports_query)) {
} else {
- echo($vlan['port_sep'] . generateiflink($port, makeshortif($port['ifDescr'])));
+ echo($vlan['port_sep'] . generate_port_link($port, makeshortif($port['ifDescr'])));
$vlan['port_sep'] = ", ";
}
}
diff --git a/html/includes/print-vrf.inc b/html/includes/print-vrf.inc
index 86defec0e4..7f8352ab6a 100644
--- a/html/includes/print-vrf.inc
+++ b/html/includes/print-vrf.inc
@@ -26,7 +26,7 @@ while($port = mysql_fetch_array($ports_query)) {
".truncate(short_port_descr($port['ifAlias']), 22, '')."
");
} else {
- echo($vrf['port_sep'] . generateiflink($port, makeshortif($port['ifDescr'])));
+ echo($vrf['port_sep'] . generate_port_link($port, makeshortif($port['ifDescr'])));
$vrf['port_sep'] = ", ";
}
}
diff --git a/html/pages/bgp.inc.php b/html/pages/bgp.inc.php
index 21470902a7..8ccca1ad04 100644
--- a/html/pages/bgp.inc.php
+++ b/html/pages/bgp.inc.php
@@ -37,11 +37,11 @@ else
$peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipaddr AS A, ports AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id"));
- if($peerhost) { $peername = generatedevicelink($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); }
+ if($peerhost) { $peername = generate_device_link($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); }
echo(" |
|
- " . $peer['bgpLocalAddr'] . " ".generatedevicelink($peer, shorthost($peer['hostname']))." |
+ " . $peer['bgpLocalAddr'] . " ".generate_device_link($peer, shorthost($peer['hostname']))." |
-> |
" . $peer['bgpPeerIdentifier'] . " ".$peername." |
$peer_type |
diff --git a/html/pages/bill.inc.php b/html/pages/bill.inc.php
index 76434309de..5732af8036 100644
--- a/html/pages/bill.inc.php
+++ b/html/pages/bill.inc.php
@@ -88,7 +88,7 @@ if(bill_permitted($bill_id)) {
while ($port = mysql_fetch_array($ports)) {
- echo(generateiflink($port) . " on " . generatedevicelink($port) . "
");
+ echo(generate_port_link($port) . " on " . generate_device_link($port) . "
");
}
diff --git a/html/pages/bill/edit.php b/html/pages/bill/edit.php
index 210e998082..d4f5a5ac6c 100644
--- a/html/pages/bill/edit.php
+++ b/html/pages/bill/edit.php
@@ -25,7 +25,7 @@ if(mysql_affected_rows())
if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; }
echo("
");
echo("");
- echo(generatedevicelink($port) . " - " . generateiflink($port));
+ echo(generate_device_link($port) . " - " . generate_port_link($port));
if($port['ifAlias']) { echo(" - " . $port['ifAlias']); }
echo(" | ");
echo(" |