PSR2 Cleanup: /html edition

Travis tests for code conformance. Ignore warnings for now.
Fixed all errors, left most warnings.
This commit is contained in:
Tony Murray
2016-08-18 20:28:22 -05:00
parent f0c82498b5
commit 8c639aa5a4
468 changed files with 6605 additions and 7629 deletions

View File

@ -10,12 +10,10 @@ $port = ifLabel($port);
if ($int_colour) {
$row_colour = $int_colour;
}
else {
} else {
if (!is_integer($i / 2)) {
$row_colour = $list_colour_a;
}
else {
} else {
$row_colour = $list_colour_b;
}
}
@ -24,15 +22,13 @@ $port_adsl = dbFetchRow('SELECT * FROM `ports_adsl` WHERE `port_id` = ?', array(
if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) {
$error_img = generate_port_link($port, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", 'port_errors');
}
else {
} else {
$error_img = '';
}
if (dbFetchCell('SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?', array($port['port_id']))) {
$mac = "<a href='".generate_port_url($port, array('view' => 'macaccounting'))."'><img src='images/16/chart_curve.png' align='absmiddle'></a>";
}
else {
} else {
$mac = '';
}
@ -44,8 +40,7 @@ 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>';
}
else {
} 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>';
@ -104,8 +99,7 @@ echo '<br />';
if ($port[ifDuplex] != 'unknown') {
echo '<span class=box-desc>'.$port['ifDuplex'].'</span>';
}
else {
} else {
echo '-';
}
@ -116,11 +110,9 @@ if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
foreach ($vlans as $vlan) {
if ($vlan['state'] == 'blocking') {
$class = 'red';
}
else if ($vlan['state'] == 'forwarding') {
} elseif ($vlan['state'] == 'forwarding') {
$class = 'green';
}
else {
} else {
$class = 'none';
}
@ -128,11 +120,9 @@ if ($device['os'] == 'ios' || $device['os'] == 'iosxe') {
}
echo '">'.$port['ifTrunk'].'</a></span></p>';
}
else if ($port['ifVlan']) {
} elseif ($port['ifVlan']) {
echo '<p class=box-desc><span class=blue>VLAN '.$port['ifVlan'].'</span></p>';
}
else if ($port['ifVrf']) {
} elseif ($port['ifVrf']) {
$vrf = dbFetchRow('SELECT * FROM vrfs WHERE vrf_id = ?', array($port['ifVrf']));
echo "<p style='color: green;'>".$vrf['vrf_name'].'</p>';
}//end if
@ -149,37 +139,32 @@ if ($port_adsl['adslLineCoding']) {
echo 'Atten:'.$port_adsl['adslAtucCurrAtn'].'dB/'.$port_adsl['adslAturCurrAtn'].'dB';
echo '<br />';
echo 'SNR:'.$port_adsl['adslAtucCurrSnrMgn'].'dB/'.$port_adsl['adslAturCurrSnrMgn'].'dB';
}
else {
} else {
echo "</td><td width=150 onclick=\"location.href='".generate_port_url($port)."'\" >";
if ($port['ifType'] && $port['ifType'] != '') {
echo '<span class=box-desc>'.fixiftype($port['ifType']).'</span>';
}
else {
} else {
echo '-';
}
echo '<br />';
if ($ifHardType && $ifHardType != '') {
echo '<span class=box-desc>'.$ifHardType.'</span>';
}
else {
} else {
echo '-';
}
echo "</td><td width=150 onclick=\"location.href='".generate_port_url($port)."'\" >";
if ($port['ifPhysAddress'] && $port['ifPhysAddress'] != '') {
echo '<span class=box-desc>'.formatMac($port['ifPhysAddress']).'</span>';
}
else {
} else {
echo '-';
}
echo '<br />';
if ($port['ifMtu'] && $port['ifMtu'] != '') {
echo '<span class=box-desc>MTU '.$port['ifMtu'].'</span>';
}
else {
} else {
echo '-';
}
}//end if
@ -195,7 +180,7 @@ if (strpos($port['label'], 'oopback') === false && !$graph_type) {
// $br = "<br />";
$int_links[$link['port_id']] = $link['port_id'];
$int_links_phys[$link['port_id']] = 1;
$nbLinks++;
$nbLinks++;
}
unset($br);
@ -246,29 +231,26 @@ if (strpos($port['label'], 'oopback') === false && !$graph_type) {
}//end foreach
}//end if
if(count($int_links) > 3)
{
echo '<div class="collapse-neighbors"><span class="neighbors-button glyphicon glyphicon-plus" aria-hidden="true"></span>
if (count($int_links) > 3) {
echo '<div class="collapse-neighbors"><span class="neighbors-button glyphicon glyphicon-plus" aria-hidden="true"></span>
<span class="neighbors-interface-list-firsts" style="display: inline;">';
}
if ($port_details && $config['enable_port_relationship'] === true && port_permitted($int_link,$device['device_id'])) {
if ($port_details && $config['enable_port_relationship'] === true && port_permitted($int_link, $device['device_id'])) {
foreach ($int_links as $int_link) {
$neighborsCount++;
if($neighborsCount == 4)
{
echo '<span class="neighbors-list-continued" style="display: inline;"></br>[...]</span>';
echo '</span>';
echo '<span class="neighbors-interface-list" style="display: none;">';
if ($neighborsCount == 4) {
echo '<span class="neighbors-list-continued" style="display: inline;"></br>[...]</span>';
echo '</span>';
echo '<span class="neighbors-interface-list" style="display: none;">';
}
$link_if = dbFetchRow('SELECT * from ports AS I, devices AS D WHERE I.device_id = D.device_id and I.port_id = ?', array($int_link));
echo "$br";
if ($int_links_phys[$int_link]) {
echo "<img align=absmiddle src='images/16/connect.png'> ";
}
else {
} else {
echo "<img align=absmiddle src='images/16/bullet_go.png'> ";
}
@ -330,18 +312,16 @@ if ($port_details && $config['enable_port_relationship'] === true && port_permit
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
if($nbLinks > 3)
{
echo '</span></div>';
if ($nbLinks > 3) {
echo '</span></div>';
}
echo '</td></tr>';
// If we're showing graphs, generate the graph and print the img tags
if ($graph_type == 'etherlike') {
$graph_file = get_port_rrdfile_path ($device['hostname'], $if_id, 'dot3');
}
else {
$graph_file = get_port_rrdfile_path ($device['hostname'], $if_id);
$graph_file = get_port_rrdfile_path($device['hostname'], $if_id, 'dot3');
} else {
$graph_file = get_port_rrdfile_path($device['hostname'], $if_id);
}
if ($graph_type && is_file($graph_file)) {