$traverse_ifvlan = true; $otherports = dbFetchRows('SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id', array($device['device_id'], $vlan['vlan_vlan'])); foreach ($otherports as $otherport) { if ($otherport['untagged']) { $traverse_ifvlan = false; } $vlan_ports[$otherport[ifIndex]] = $otherport; } if ($traverse_ifvlan) { $otherports = dbFetchRows('SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?', array($device['device_id'], $vlan['vlan_vlan'])); foreach ($otherports as $otherport) { $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1')); } } ksort($vlan_ports); foreach ($vlan_ports as $port) { $port = ifLabel($port, $device); if ($vars['view'] == 'graphs') { echo "<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: " . $list_colour_b_b . ";'>\n <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . "</div>\n <a href='device/device=" . $device['device_id'] . '/tab=port/port=' . $port['port_id'] . "/' onmouseover=\"return overlib('\\\n <div style=\\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\\'>" . $device['hostname'] . ' - ' . $port['ifDescr'] . '</div>\\ ' . $port['ifAlias'] . " \\\n <img src=\\'graph.php?type={$graph_type}&id=" . $port['port_id'] . '&from=' . $config['time']['twoday'] . '&to=' . $config['time']['now'] . "&width=450&height=150\\'>\\\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type={$graph_type}&id=" . $port['port_id'] . '&from=' . $config['time']['twoday'] . '&to=' . $config['time']['now'] . "&width=132&height=40&legend=no'>\n </a>\n <div style='font-size: 9px;'>" . truncate(short_port_descr($port['ifAlias']), 22, '') . '</div> </div>'; } else { echo $vlan['port_sep'] . generate_port_link($port, makeshortif($port['label'])); $vlan['port_sep'] = ', '; if ($port['untagged']) { echo '(U)'; } } } //end foreach echo '</td></tr>';
foreach ($ports[$device['vrf_id']][$device['device_id']] as $port) { $port = array_merge($device, $port); switch ($_GET['optc']) { case 'bits': case 'upkts': case 'nupkts': case 'errors': $port['width'] = '130'; $port['height'] = '30'; $port['from'] = $config['time']['day']; $port['to'] = $config['time']['now']; $port['bg'] = '#' . $bg; $port['graph_type'] = 'port_' . $_GET['optc']; echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;\n text-align: center; float: left; background-color: " . $list_colour_b_b . ";'>\n <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . '</div>'; print_port_thumbnail($port); echo "<div style='font-size: 9px;'>" . truncate(short_port_descr($port['ifAlias']), 22, '') . '</div> </div>'; break; default: echo $seperator . generate_port_link($port, makeshortif($port['ifDescr'])); $seperator = ', '; break; } //end switch } //end foreach echo '</td></tr>'; $x++; } //end foreach echo '</table></td>';
} $navbar['class'] = "navbar-narrow"; $navbar['brand'] = "Ports"; print_navbar($navbar); unset($navbar); if (is_array($navbar_b)) { print_navbar($navbar_b); } if ($vars['view'] == 'minigraphs') { $timeperiods = array('-1day', '-1week', '-1month', '-1year'); $from = '-1day'; echo "<div style='display: block; clear: both; margin: auto; min-height: 500px;'>"; unset($seperator); // FIXME - FIX THIS. UGLY. foreach (dbFetchRows("select * from ports WHERE device_id = ? ORDER BY ifIndex", array($device['device_id'])) as $port) { echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>\n <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . "</div>\n <a href=\"" . generate_port_url($port) . "\" onmouseover=\"return overlib('\\\n <div style=\\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\\'>" . $device['hostname'] . " - " . $port['ifDescr'] . "</div>\\\n " . $port['ifAlias'] . " \\\n <img src=\\'graph.php?type=" . $graph_type . "&id=" . $port['port_id'] . "&from=" . $from . "&to=" . $config['time']['now'] . "&width=450&height=150\\'>\\\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type=" . $graph_type . "&id=" . $port['port_id'] . "&from=" . $from . "&to=" . $config['time']['now'] . "&width=180&height=45&legend=no'>\n </a>\n <div style='font-size: 9px;'>" . truncate(short_port_descr($port['ifAlias']), 32, '') . "</div>\n </div>"; } echo "</div>"; } elseif ($vars['view'] == "arp" || $vars['view'] == "adsl" || $vars['view'] == "neighbours" || $vars['view'] == "fdb" || $vars['view'] == "map") { include "ports/" . $vars['view'] . ".inc.php"; } else { if ($vars['view'] == "details") { $port_details = 1; } if ($vars['view'] == "graphs") { $table_class = "table-striped-two"; } else { $table_class = "table-striped"; } echo '<table class="table table-hover table-bordered table-condensed table-rounded ' . $table_class . '" style="vertical-align: middle; margin-top: 5px; margin-bottom: 10px;">';
<?php // FIXME new url format if (is_integer($i / 2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } echo "<tr bgcolor='{$bg_colour}'>"; echo "<td width=200 class=entity-title><a href='routing/vrf/" . $vrf['mplsVpnVrfRouteDistinguisher'] . "/'>" . $vrf['vrf_name'] . "</a></td>"; echo "<td width=150 class=small>" . $vrf['mplsVpnVrfDescription'] . "</td>"; echo "<td width=100 class=small>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "</td>"; echo '<td class="entity">'; foreach (dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVrf` = ?", array($device['device_id'], $vrf['vrf_id'])) as $port) { if ($vars['view'] == "graphs") { $graph_type = "port_" . $vars['graph']; echo "<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: #e9e9e9;'>\n <div style='font-weight: bold;'>" . short_ifname($port['ifDescr']) . "</div>\n <a href='device/" . $device['device_id'] . "/port/" . $port['port_id'] . "/' onmouseover=\"return overlib('\\\n <div style=\\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\\'>" . $device['hostname'] . " - " . $port['ifDescr'] . "</div>\\\n " . $port['ifAlias'] . " \\\n <img src=\\'graph.php?type={$graph_type}&id=" . $port['port_id'] . "&from=" . $config['time']['twoday'] . "&to=" . $config['time']['now'] . "&width=450&height=150\\'>\\\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type={$graph_type}&id=" . $port['port_id'] . "&from=" . $config['time']['twoday'] . "&to=" . $config['time']['now'] . "&width=132&height=40&legend=no'>\n </a>\n <div style='font-size: 9px;'>" . short_port_descr($port['ifAlias']) . "</div>\n </div>"; } else { echo $vrf['port_sep'] . generate_port_link($port, short_ifname($port['ifDescr'])); $vrf['port_sep'] = ", "; } } echo "</td>"; echo "</tr>";
echo "<a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/ports/'>Basic</a> | \r\n<a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/ports/details/'>Details</a> | \r\n<a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/ports/arp/'>ARP Table</a> | Graphs: "; $graph_types = array("bits" => "Bits", "upkts" => "Unicast Packets", "nupkts" => "Non-Unicast Packets", "errors" => "Errors", "etherlike" => "Etherlike"); foreach ($graph_types as $type => $descr) { echo "{$type_sep} \r\n <a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/ports/graphs/{$type}/'>{$descr}</a> \r\n (<a href='" . $config['base_url'] . "/device/" . $device['device_id'] . "/ports/graphs/{$type}/thumbs/'>Mini</a>) "; $type_sep = " | "; } print_optionbar_end(); if ($_GET['optc'] == thumbs) { $timeperiods = array('-1day', '-1week', '-1month', '-1year'); $from = '-1day'; echo "<div style='display: block; clear: both; margin: auto;'>"; $sql = "select * from ports WHERE device_id = '" . $device['device_id'] . "' ORDER BY ifIndex"; $query = mysql_query($sql); unset($seperator); while ($interface = mysql_fetch_array($query)) { echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>\r\n <div style='font-weight: bold;'>" . makeshortif($interface['ifDescr']) . "</div>\r\n <a href='device/" . $device['device_id'] . "/interface/" . $interface['interface_id'] . "/' onmouseover=\"return overlib('\\\r\n <div style=\\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\\'>" . $device['hostname'] . " - " . $interface['ifDescr'] . "</div>\\\r\n " . $interface['ifAlias'] . " \\\r\n <img src=\\'graph.php?type={$graph_type}&if=" . $interface['interface_id'] . "&from=" . $from . "&to=" . $now . "&width=450&height=150\\'>\\\r\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type={$graph_type}&if=" . $interface['interface_id'] . "&from=" . $from . "&to=" . $now . "&width=180&height=45&legend=no'>\r\n </a>\r\n <div style='font-size: 9px;'>" . truncate(short_port_descr($interface['ifAlias']), 32, '') . "</div>\r\n </div>"; } echo "</div>"; } else { if ($_GET['opta'] == "arp") { include "arp.inc.php"; } else { if ($_GET['opta'] == "details") { $port_details = 1; } echo "<div style='margin: 5px;'><table border=0 cellspacing=0 cellpadding=5 width=100%>"; $i = "1"; $interface_query = mysql_query("select * from ports WHERE device_id = '" . $device['device_id'] . "' AND deleted = '0' ORDER BY `ifIndex` ASC"); while ($interface = mysql_fetch_array($interface_query)) { include "includes/print-interface.inc.php"; $i++;
} echo ')'; $type_sep = ' | '; } //end foreach print_optionbar_end(); if ($vars['view'] == 'minigraphs') { $timeperiods = array('-1day', '-1week', '-1month', '-1year'); $from = '-1day'; echo "<div style='display: block; clear: both; margin: auto; min-height: 500px;'>"; unset($seperator); // FIXME - FIX THIS. UGLY. foreach (dbFetchRows('select * from ports WHERE device_id = ? ORDER BY ifIndex', array($device['device_id'])) as $port) { echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 183px; max-width:183px; min-height:90px; max-height:90px; text-align: center; float: left; background-color: #e9e9e9;'>\n <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . '</div> <a href="' . generate_port_url($port) . "\" onmouseover=\"return overlib('\\\n <div style=\\'background-color: #ffffff;\\'>\\\n <div style=\\'font-size: 16px; padding:5px; font-weight: bold; color: #555;\\'>" . $device['hostname'] . ' - ' . $port['ifDescr'] . '</div>\\ ' . display($port['ifAlias']) . " \\\n <img src=\\'graph.php?type=" . $graph_type . '&id=' . $port['port_id'] . '&from=' . $from . '&to=' . $config['time']['now'] . "&width=450&height=150\\'>\\\n </div>\\\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type=" . $graph_type . '&id=' . $port['port_id'] . '&from=' . $from . '&to=' . $config['time']['now'] . "&width=180&height=45&legend=no'>\n </a>\n <div style='font-size: 9px;'>" . substr(short_port_descr(display($port['ifAlias'])), 0, 32) . '</div> </div>'; } echo '</div>'; } elseif ($vars['view'] == 'arp' || $vars['view'] == 'adsl' || $vars['view'] == 'neighbours') { include 'ports/' . $vars['view'] . '.inc.php'; } else { if ($vars['view'] == 'details') { $port_details = 1; } ?> <div style='margin: 0px;'><table class='table'> <tr> <th width="350"><A href="<?php echo generate_url($vars, array('sort' => "port")); ?>
foreach ($ports[$device['vrf_id']][$device['device_id']] as $port) { $port = array_merge($device, $port); switch ($_GET['optc']) { case 'bits': case 'upkts': case 'nupkts': case 'errors': $port['width'] = '130'; $port['height'] = '30'; $port['from'] = $config['time']['day']; $port['to'] = $config['time']['now']; $port['bg'] = '#' . $bg; $port['graph_type'] = 'port_' . $_GET['optc']; echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;\n text-align: center; float: left; background-color: " . $list_colour_b_b . ";'>\n <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . '</div>'; print_port_thumbnail($port); echo "<div style='font-size: 9px;'>" . substr(short_port_descr(display($port['ifAlias'])), 0, 22) . '</div> </div>'; break; default: echo $seperator . generate_port_link($port, makeshortif($port['ifDescr'])); $seperator = ', '; break; } //end switch } //end foreach echo '</td></tr>'; $x++; } //end foreach echo '</table></td>';
foreach ($ports[$device['vrf_id']][$device['device_id']] as $port) { $port = array_merge($device, $port); switch ($_GET['optc']) { case 'bits': case 'upkts': case 'nupkts': case 'errors': $port['width'] = "130"; $port['height'] = "30"; $port['from'] = $config['time']['day']; $port['to'] = $config['time']['now']; $port['bg'] = "#" . $bg; $port['graph_type'] = "port_" . $_GET['optc']; echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;\n text-align: center; float: left; background-color: " . $list_colour_b_b . ";'>\n <div style='font-weight: bold;'>" . short_ifname($port['ifDescr']) . "</div>"; generate_port_thumbnail($port); echo "<div style='font-size: 9px;'>" . short_port_descr($port['ifAlias']) . "</div>\n </div>"; break; default: echo $seperator . generate_port_link($port, short_ifname($port['ifDescr'])); $seperator = ", "; break; } } echo "</td></tr>"; $x++; } // End While echo "</table></td>"; $i++; } echo "</table></div>";
* */ echo '<tr>'; echo '<td style="width: 100px;" class="entity-title"> Vlan ' . $vlan['vlan_vlan'] . '</td>'; echo '<td style="width: 200px;" class="small">' . $vlan['vlan_name'] . '</td>'; echo '<td class="strong">'; $vlan_ports = array(); $otherports = dbFetchRows("SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id", array($device['device_id'], $vlan['vlan_vlan'])); foreach ($otherports as $otherport) { $vlan_ports[$otherport['ifIndex']] = $otherport; } $otherports = dbFetchRows("SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?", array($device['device_id'], $vlan['vlan_vlan'])); foreach ($otherports as $otherport) { $vlan_ports[$otherport['ifIndex']] = array_merge($otherport, array('untagged' => '1')); } ksort($vlan_ports); foreach ($vlan_ports as $port) { humanize_port($port); if ($vars['view'] == "graphs") { echo '<div class="box box-solid" style="display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; height:85px; height:85px; text-align: center; float: left;"> <div style="font-weight: bold;"><h4>' . short_ifname($port['ifDescr']) . "</h4></div>\n <a href='" . generate_url(array('page' => 'device', 'device' => $device['device_id'], 'tab' => 'port', 'port' => $port['port_id'])) . "' onmouseover=\"return overlib('\\\n <div style=\\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\\'>" . $device['hostname'] . " - " . $port['ifDescr'] . "</div>\\\n " . $port['ifAlias'] . " \\\n <img src=\\'graph.php?type={$graph_type}&id=" . $port['port_id'] . "&from=" . $config['time']['twoday'] . "&to=" . $config['time']['now'] . "&width=450&height=150\\'>\\\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type={$graph_type}&id=" . $port['port_id'] . "&from=" . $config['time']['twoday'] . "&to=" . $config['time']['now'] . "&width=132&height=40&legend=no'>\n </a>\n <div style='font-size: 9px;'>" . short_port_descr($port['ifAlias']) . "</div>\n </div>"; } else { echo $vlan['port_sep'] . generate_port_link($port, short_ifname($port['port_label'])); $vlan['port_sep'] = ", "; if ($port['untagged']) { echo "(U)"; } } } echo '</td></tr>'; // EOF