From d96e2216a7137a21f4231ee456b4219458035903 Mon Sep 17 00:00:00 2001 From: Aaron Daniels Date: Thu, 28 Jan 2016 07:04:12 +1000 Subject: [PATCH] - Changed upper case variables to lower case. --- .../graphs/device/cisco-otv-mac.inc.php | 38 ++-- .../graphs/device/cisco-otv-vlan.inc.php | 38 ++-- html/includes/print-menubar.php | 6 +- html/pages/device.inc.php | 6 +- html/pages/device/routing/cisco-otv.inc.php | 40 ++-- includes/discovery/cisco-otv.inc.php | 205 +++++++++--------- includes/polling/cisco-otv.inc.php | 163 +++++++------- includes/snmp.inc.php | 4 +- 8 files changed, 253 insertions(+), 247 deletions(-) diff --git a/html/includes/graphs/device/cisco-otv-mac.inc.php b/html/includes/graphs/device/cisco-otv-mac.inc.php index 5c616869ee..691bfd10d8 100644 --- a/html/includes/graphs/device/cisco-otv-mac.inc.php +++ b/html/includes/graphs/device/cisco-otv-mac.inc.php @@ -12,44 +12,44 @@ */ require_once "../includes/component.php"; -$COMPONENT = new component(); +$component = new component(); $options['filter']['type'] = array('=','Cisco-OTV'); -$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options); +$components = $component->getComponents($device['device_id'],$options); // We only care about our device id. -$COMPONENTS = $COMPONENTS[$device['device_id']]; +$components = $components[$device['device_id']]; include "includes/graphs/common.inc.php"; $rrd_options .= " -l 0 -E "; $rrd_options .= " COMMENT:'MAC Addresses Now Min Max\\n'"; $rrd_additions = ""; -$COUNT = 0; -foreach ($COMPONENTS as $ID => $ARRAY) { - if ($ARRAY['otvtype'] == 'endpoint') { - $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$ARRAY['endpoint']."-mac.rrd"); +$count = 0; +foreach ($components as $id => $array) { + if ($array['otvtype'] == 'endpoint') { + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$array['endpoint']."-mac.rrd"); if (file_exists($rrd_filename)) { // Stack the area on the second and subsequent DS's - $STACK = ""; - if ($COUNT != 0) { - $STACK = ":STACK "; + $stack = ""; + if ($count != 0) { + $stack = ":STACK "; } // Grab a color from the array. - if ( isset($config['graph_colours']['mixed'][$COUNT]) ) { - $COLOR = $config['graph_colours']['mixed'][$COUNT]; + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; } else { - $COLOR = $config['graph_colours']['oranges'][$COUNT-7]; + $color = $config['graph_colours']['oranges'][$count-7]; } - $rrd_additions .= " DEF:DS" . $COUNT . "=" . $rrd_filename . ":count:AVERAGE "; - $rrd_additions .= " AREA:DS" . $COUNT . "#" . $COLOR . ":'" . str_pad(substr($COMPONENTS[$ID]['endpoint'],0,15),15) . "'" . $STACK; - $rrd_additions .= " GPRINT:DS" . $COUNT . ":LAST:%4.0lf%s "; - $rrd_additions .= " GPRINT:DS" . $COUNT . ":MIN:%4.0lf%s "; - $rrd_additions .= " GPRINT:DS" . $COUNT . ":MAX:%4.0lf%s\\\l "; - $COUNT++; + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":count:AVERAGE "; + $rrd_additions .= " AREA:DS" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['endpoint'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%4.0lf%s\\\l "; + $count++; } } } diff --git a/html/includes/graphs/device/cisco-otv-vlan.inc.php b/html/includes/graphs/device/cisco-otv-vlan.inc.php index 8ee50acf40..1116e056c6 100644 --- a/html/includes/graphs/device/cisco-otv-vlan.inc.php +++ b/html/includes/graphs/device/cisco-otv-vlan.inc.php @@ -12,44 +12,44 @@ */ require_once "../includes/component.php"; -$COMPONENT = new component(); +$component = new component(); $options['filter']['type'] = array('=','Cisco-OTV'); -$COMPONENTS = $COMPONENT->getComponents($device['device_id'],$options); +$components = $component->getComponents($device['device_id'],$options); // We only care about our device id. -$COMPONENTS = $COMPONENTS[$device['device_id']]; +$components = $components[$device['device_id']]; include "includes/graphs/common.inc.php"; $rrd_options .= " -l 0 -E "; $rrd_options .= " COMMENT:'VLANs Now Min Max\\n'"; $rrd_additions = ""; -$COUNT = 0; -foreach ($COMPONENTS as $ID => $ARRAY) { - if ($ARRAY['otvtype'] == 'overlay') { - $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$ARRAY['label']."-vlan.rrd"); +$count = 0; +foreach ($components as $id => $array) { + if ($array['otvtype'] == 'overlay') { + $rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename("cisco-otv-".$array['label']."-vlan.rrd"); if (file_exists($rrd_filename)) { // Stack the area on the second and subsequent DS's - $STACK = ""; - if ($COUNT != 0) { - $STACK = ":STACK "; + $stack = ""; + if ($count != 0) { + $stack = ":STACK "; } // Grab a color from the array. - if ( isset($config['graph_colours']['mixed'][$COUNT]) ) { - $COLOR = $config['graph_colours']['mixed'][$COUNT]; + if ( isset($config['graph_colours']['mixed'][$count]) ) { + $color = $config['graph_colours']['mixed'][$count]; } else { - $COLOR = $config['graph_colours']['oranges'][$COUNT-7]; + $color = $config['graph_colours']['oranges'][$count-7]; } - $rrd_additions .= " DEF:DS" . $COUNT . "=" . $rrd_filename . ":count:AVERAGE "; - $rrd_additions .= " AREA:DS" . $COUNT . "#" . $COLOR . ":'" . str_pad(substr($COMPONENTS[$ID]['label'],0,15),15) . "'" . $STACK; - $rrd_additions .= " GPRINT:DS" . $COUNT . ":LAST:%4.0lf%s "; - $rrd_additions .= " GPRINT:DS" . $COUNT . ":MIN:%4.0lf%s "; - $rrd_additions .= " GPRINT:DS" . $COUNT . ":MAX:%4.0lf%s\\\l "; - $COUNT++; + $rrd_additions .= " DEF:DS" . $count . "=" . $rrd_filename . ":count:AVERAGE "; + $rrd_additions .= " AREA:DS" . $count . "#" . $color . ":'" . str_pad(substr($components[$id]['label'],0,15),15) . "'" . $stack; + $rrd_additions .= " GPRINT:DS" . $count . ":LAST:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MIN:%4.0lf%s "; + $rrd_additions .= " GPRINT:DS" . $count . ":MAX:%4.0lf%s\\\l "; + $count++; } } } diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 859af924f4..4c22ad08ba 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -421,10 +421,10 @@ $routing_count['cef'] = dbFetchCell("SELECT COUNT(cef_switching_id) from `cef_s $routing_count['vrf'] = dbFetchCell("SELECT COUNT(vrf_id) from `vrfs`"); require_once "../includes/component.php"; -$COMPONENT = new component(); +$component = new component(); $options['type'] = 'Cisco-OTV'; -$OTV = $COMPONENT->getComponents(null,$options); -$routing_count['cisco-otv'] = count($OTV); +$otv = $component->getComponents(null,$options); +$routing_count['cisco-otv'] = count($otv); if ($_SESSION['userlevel'] >= '5' && ($routing_count['bgp']+$routing_count['ospf']+$routing_count['cef']+$routing_count['vrf']+$routing_count['cisco-otv']) > "0") { diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 3de92da54d..fd59004017 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -211,11 +211,11 @@ if (device_permitted($vars['device']) || $check_device == $vars['device']) { } require_once "../includes/component.php"; - $COMPONENT = new component(); + $component = new component(); $options['type'] = 'Cisco-OTV'; $options['filter']['device_id'] = array('=',$device['device_id']); - $OTV = $COMPONENT->getComponents(null,$options); - $device_routing_count['cisco-otv'] = count($OTV); + $otv = $component->getComponents(null,$options); + $device_routing_count['cisco-otv'] = count($otv); if ($device_routing_count['cisco-otv'] > 0) { $routing_tabs[] = 'cisco-otv'; } diff --git a/html/pages/device/routing/cisco-otv.inc.php b/html/pages/device/routing/cisco-otv.inc.php index f29a9c9ae0..602f67abd8 100644 --- a/html/pages/device/routing/cisco-otv.inc.php +++ b/html/pages/device/routing/cisco-otv.inc.php @@ -1,12 +1,12 @@ getComponents($device['device_id'],$options); -$COMPONENTS = $COMPONENTS[$device['device_id']]; +$components = $component->getComponents($device['device_id'],$options); +$components = $components[$device['device_id']]; global $config; ?> @@ -17,32 +17,32 @@ global $config;
$OVERLAY) { - if ($OVERLAY['otvtype'] == 'overlay') { - if ($OVERLAY['status'] == 1) { - $OVERLAY_STATUS = "Normal"; - $GLI = ""; +foreach ($components as $oid => $overlay) { + if ($overlay['otvtype'] == 'overlay') { + if ($overlay['status'] == 1) { + $overlay_status = "Normal"; + $gli = ""; } else { - $OVERLAY_STATUS = "".$OVERLAY['error']." - Alert"; - $GLI = "list-group-item-danger"; + $overlay_status = "".$overlay['error']." - Alert"; + $gli = "list-group-item-danger"; } ?> - - -