From 0d99fe7a53823a9284fb3ec7fb8bbab55b624612 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Sun, 1 May 2011 20:29:31 +0000 Subject: [PATCH] cleanieclean git-svn-id: http://www.observium.org/svn/observer/trunk@2215 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/device/routing/bgp.inc.php | 148 ++++++++++++-------------- 1 file changed, 70 insertions(+), 78 deletions(-) diff --git a/html/pages/device/routing/bgp.inc.php b/html/pages/device/routing/bgp.inc.php index e3179fdcc..0eded8a2b 100644 --- a/html/pages/device/routing/bgp.inc.php +++ b/html/pages/device/routing/bgp.inc.php @@ -5,46 +5,45 @@ BGP » "); +echo("BGP » "); - if (!isset($_GET['optb'])) { echo(""); } - echo("Basic"); - if (!isset($_GET['optb'])) { echo(""); } +if (!isset($_GET['optb'])) { echo(""); } +echo("Basic"); +if (!isset($_GET['optb'])) { echo(""); } - echo(" | "); +echo(" | "); - if ($_GET['optb'] == "updates") { echo(""); } - echo("Updates"); - if ($_GET['optb'] == "updates") { echo(""); } +if ($_GET['optb'] == "updates") { echo(""); } +echo("Updates"); +if ($_GET['optb'] == "updates") { echo(""); } - echo(" | Prefixes: "); +echo(" | Prefixes: "); - if ($_GET['optb'] == "prefixes_ipv4unicast") { echo(""); } - echo("IPv4"); - if ($_GET['optb'] == "prefixes_ipv4unicast") { echo(""); } +if ($_GET['optb'] == "prefixes_ipv4unicast") { echo(""); } +echo("IPv4"); +if ($_GET['optb'] == "prefixes_ipv4unicast") { echo(""); } - echo(" | "); +echo(" | "); - if ($_GET['optb'] == "prefixes_vpnv4unicast") { echo(""); } - echo("VPNv4"); - if ($_GET['optb'] == "prefixes_vpnv4unicast") { echo(""); } +if ($_GET['optb'] == "prefixes_vpnv4unicast") { echo(""); } +echo("VPNv4"); +if ($_GET['optb'] == "prefixes_vpnv4unicast") { echo(""); } - echo(" | "); +echo(" | "); - if ($_GET['optb'] == "prefixes_ipv6unicast") { echo(""); } - echo("IPv6"); - if ($_GET['optb'] == "prefixes_ipv6unicast") { echo(""); } +if ($_GET['optb'] == "prefixes_ipv6unicast") { echo(""); } +echo("IPv6"); +if ($_GET['optb'] == "prefixes_ipv6unicast") { echo(""); } - echo(" | Traffic: "); - - if ($_GET['optb'] == "macaccounting_bits") { echo(""); } - echo("Bits"); - if ($_GET['optb'] == "macaccounting_bits") { echo(""); } - echo(" | "); - if ($_GET['optb'] == "macaccounting_pkts") { echo(""); } - echo("Packets"); - if ($_GET['optb'] == "macaccounting_pkts") { echo(""); } +echo(" | Traffic: "); +if ($_GET['optb'] == "macaccounting_bits") { echo(""); } +echo("Bits"); +if ($_GET['optb'] == "macaccounting_bits") { echo(""); } +echo(" | "); +if ($_GET['optb'] == "macaccounting_pkts") { echo(""); } +echo("Packets"); +if ($_GET['optb'] == "macaccounting_pkts") { echo(""); } print_optionbar_end(); @@ -60,7 +59,6 @@ while ($peer = mysql_fetch_assoc($peer_query)) unset($bg_image); if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - unset ($alert, $bg_image); if (!is_integer($i/2)) { $bg_colour = $list_colour_b; } else { $bg_colour = $list_colour_a; } @@ -83,13 +81,9 @@ while ($peer = mysql_fetch_assoc($peer_query)) if ($ipv4_host) { $peerhost = $ipv4_host; - } - elseif ($ipv6_host) - { + } elseif ($ipv6_host) { $peerhost = $ipv6_host; - } - else - { + } else { unset($peerhost); } @@ -111,17 +105,15 @@ while ($peer = mysql_fetch_assoc($peer_query)) $af_query = mysql_query("SELECT * FROM `bgpPeers_cbgp` WHERE `device_id` = '".$device['device_id']."' AND bgpPeerIdentifier = '".$peer['bgpPeerIdentifier']."'"); unset($peer_af); unset($sep); + while ($afisafi = mysql_fetch_assoc($af_query)) { $afi = $afisafi['afi']; $safi = $afisafi['safi']; $this_afisafi = $afi.$safi; - #$peer['afi'] .= $sep . $config['afi'][$afi][$safi]; ##### CLEAN ME UP, I AM MESSY AND I SMELL OF CHEESE! FIXME! $peer['afi'] .= $sep . $afi .".".$safi; $sep = "
"; $peer['afisafi'][$this_afisafi] = 1; ## Build a list of valid AFI/SAFI for this peer - - } unset($sep); @@ -134,7 +126,6 @@ while ($peer = mysql_fetch_assoc($peer_query)) ($peer['disabled'] ? ' bordercolor="#cccccc"' : '') . "> "); - echo(" ".$i." " . $peeraddresslink . "
".generate_device_link($peer, shorthost($peer['hostname']), 'bgp/')." $peer_type @@ -147,49 +138,50 @@ while ($peer = mysql_fetch_assoc($peer_query)) "); + unset($invalid); - unset($invalid); - switch ($_GET['optb']) - { - case 'prefixes_ipv4unicast': - case 'prefixes_ipv4multicast': - case 'prefixes_ipv4vpn': - case 'prefixes_ipv6unicast': - case 'prefixes_ipv6multicast': - list(,$afisafi) = explode("_", $_GET['optb']); - if (isset($peer['afisafi'][$afisafi])) { $peer['graph'] = 1; } - case 'updates': - $graph_array['type'] = "bgp_" . $_GET['optb']; - $graph_array['id'] = $peer['bgpPeer_id']; - } + switch ($_GET['optb']) + { + case 'prefixes_ipv4unicast': + case 'prefixes_ipv4multicast': + case 'prefixes_ipv4vpn': + case 'prefixes_ipv6unicast': + case 'prefixes_ipv6multicast': + list(,$afisafi) = explode("_", $_GET['optb']); + if (isset($peer['afisafi'][$afisafi])) { $peer['graph'] = 1; } + # FIXME no break?? + case 'updates': + $graph_array['type'] = "bgp_" . $_GET['optb']; + $graph_array['id'] = $peer['bgpPeer_id']; + } - switch ($_GET['optb']) - { - case 'macaccounting_bits': - case 'macaccounting_pkts': - $acc = mysql_fetch_assoc(mysql_query("SELECT * FROM `ipv4_mac` AS I, `mac_accounting` AS M, `ports` AS P, `devices` AS D WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id AND D.device_id = P.device_id")); - $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"; - if (is_array($acc) && is_file($database)) - { - $peer['graph'] = 1; - $graph_array['id'] = $acc['ma_id']; - $graph_array['type'] = $_GET['optb']; - } - } + switch ($_GET['optb']) + { + case 'macaccounting_bits': + case 'macaccounting_pkts': + $acc = mysql_fetch_assoc(mysql_query("SELECT * FROM `ipv4_mac` AS I, `mac_accounting` AS M, `ports` AS P, `devices` AS D WHERE I.ipv4_address = '".$peer['bgpPeerIdentifier']."' AND M.mac = I.mac_address AND P.interface_id = M.interface_id AND D.device_id = P.device_id")); + $database = $config['rrd_dir'] . "/" . $device['hostname'] . "/cip-" . $acc['ifIndex'] . "-" . $acc['mac'] . ".rrd"; + if (is_array($acc) && is_file($database)) + { + $peer['graph'] = 1; + $graph_array['id'] = $acc['ma_id']; + $graph_array['type'] = $_GET['optb']; + } + } - if ($_GET['optb'] == 'updates') { $peer['graph'] = 1; } + if ($_GET['optb'] == 'updates') { $peer['graph'] = 1; } - if($peer['graph']) - { - $graph_array['height'] = "100"; - $graph_array['width'] = "216"; - $graph_array['to'] = $now; - echo(''); - include("includes/print-quadgraphs.inc.php"); - echo(""); - } + if($peer['graph']) + { + $graph_array['height'] = "100"; + $graph_array['width'] = "216"; + $graph_array['to'] = $now; + echo(''); + include("includes/print-quadgraphs.inc.php"); + echo(""); + } - $i++; + $i++; unset($valid_afi_safi); }