本文整理汇总了PHP中generate_port_link函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_port_link函数的具体用法?PHP generate_port_link怎么用?PHP generate_port_link使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_port_link函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_port_list
function print_port_list()
{
global $ports;
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Billed Ports</h3>
</div>
<div class="list-group">
<?php
// Collected Earlier
foreach ($ports as $port) {
$portalias = empty($port['ifAlias']) ? '' : ' - ' . $port['ifAlias'] . '';
?>
<div class="list-group-item">
<?php
echo generate_port_link($port, $port['ifName'] . $portalias);
?>
on <?php
echo generate_device_link($port);
?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
示例2: print_neighbours
/**
* Display neighbours.
*
* Display pages with device neighbours in some formats.
* Examples:
* print_neighbours() - display all neighbours from all devices
* print_neighbours(array('pagesize' => 99)) - display 99 neighbours from all device
* print_neighbours(array('pagesize' => 10, 'pageno' => 3, 'pagination' => TRUE)) - display 10 neighbours from page 3 with pagination header
* print_neighbours(array('pagesize' => 10, 'device' = 4)) - display 10 neighbours for device_id 4
*
* @param array $vars
* @return none
*
*/
function print_neighbours($vars)
{
// Get neighbours array
$neighbours = get_neighbours_array($vars);
if (!$neighbours['count']) {
// There have been no entries returned. Print the warning.
print_warning('<h4>No neighbours found!</h4>');
} else {
// Entries have been returned. Print the table.
$list = array('device' => FALSE);
if ($vars['page'] != 'device') {
$list['device'] = TRUE;
}
if (in_array($vars['graph'], array('bits', 'upkts', 'nupkts', 'pktsize', 'percent', 'errors', 'etherlike', 'fdb_count'))) {
$graph_types = array($vars['graph']);
} else {
$graph_types = array('bits', 'upkts', 'errors');
}
$string = generate_box_open($vars['header']);
$string .= '<table class="table table-striped table-hover table-condensed">' . PHP_EOL;
$cols = array(array(NULL, 'class="state-marker"'), 'device_a' => 'Local Device', 'port_a' => 'Local Port', 'NONE' => NULL, 'device_b' => 'Remote Device', 'port_b' => 'Remote Port', 'protocol' => 'Protocol');
if (!$list['device']) {
unset($cols[0], $cols['device_a']);
}
$string .= get_table_header($cols, $vars);
$string .= ' <tbody>' . PHP_EOL;
foreach ($neighbours['entries'] as $entry) {
$string .= ' <tr class="' . $entry['row_class'] . '">' . PHP_EOL;
if ($list['device']) {
$string .= ' <td class="state-marker"></td>';
$string .= ' <td class="entity">' . generate_device_link($entry, NULL, array('tab' => 'ports', 'view' => 'neighbours')) . '</td>' . PHP_EOL;
}
$string .= ' <td><span class="entity">' . generate_port_link($entry) . '</span><br />' . $entry['ifAlias'] . '</td>' . PHP_EOL;
$string .= ' <td><i class="icon-resize-horizontal text-success"></i></td>' . PHP_EOL;
if (is_numeric($entry['remote_port_id']) && $entry['remote_port_id']) {
$remote_port = get_port_by_id_cache($entry['remote_port_id']);
$remote_device = device_by_id_cache($remote_port['device_id']);
$string .= ' <td><span class="entity">' . generate_device_link($remote_device) . '</span><br />' . $remote_device['hardware'] . '</td>' . PHP_EOL;
$string .= ' <td><span class="entity">' . generate_port_link($remote_port) . '</span><br />' . $remote_port['ifAlias'] . '</td>' . PHP_EOL;
} else {
$string .= ' <td><span class="entity">' . $entry['remote_hostname'] . '</span><br />' . $entry['remote_platform'] . '</td>' . PHP_EOL;
$string .= ' <td><span class="entity">' . $entry['remote_port'] . '</span></td>' . PHP_EOL;
}
$string .= ' <td>' . strtoupper($entry['protocol']) . '</td>' . PHP_EOL;
$string .= ' </tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
$string .= generate_box_close();
// Print pagination header
if ($neighbours['pagination_html']) {
$string = $neighbours['pagination_html'] . $string . $neighbours['pagination_html'];
}
// Print
echo $string;
}
}
示例3: generate_port_link
if (!$ignore) {
if ($entry['ifInErrors'] > 0 || $entry['ifOutErrors'] > 0) {
$error_img = generate_port_link($entry, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", port_errors);
} else {
$error_img = '';
}
$arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($entry['ipv4_address']));
if ($arp_host) {
$arp_name = generate_device_link($arp_host);
} else {
unset($arp_name);
}
if ($arp_host) {
$arp_if = generate_port_link($arp_host);
} else {
unset($arp_if);
}
if ($arp_host['device_id'] == $entry['device_id']) {
$arp_name = 'Localhost';
}
if ($arp_host['port_id'] == $entry['port_id']) {
$arp_if = 'Local port';
}
$response[] = array('mac_address' => formatMac($entry['mac_address']), 'ipv4_address' => $entry['ipv4_address'], 'hostname' => generate_device_link($entry), 'interface' => generate_port_link($entry, makeshortif(fixifname(ifLabel($entry['label'])))) . ' ' . $error_img, 'remote_device' => $arp_name, 'remote_interface' => $arp_if);
}
//end if
unset($ignore);
}
//end foreach
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
示例4: foreach
}
if (!$already) {
$nodes[] = $device['device_id'];
}
}
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'";
foreach (dbFetchRows($sql) as $device) {
if (device_permitted($device['device_id'])) {
echo "<div style='text-align: center; margin: 2px; border: solid 2px #d0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffbbbb;'>\n <strong>" . generate_device_link($device, shorthost($device['hostname'])) . "</strong><br />\n <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span><br />\n <span class=body-date-1>" . truncate($device['location'], 35) . "</span>\n </div>";
}
}
if ($config['warn']['ifdown']) {
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
foreach (dbFetchRows($sql) as $interface) {
if (port_permitted($interface['port_id'])) {
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>\n <strong>" . generate_device_link($interface, shorthost($interface['hostname'])) . "</strong><br />\n <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />\n <strong>" . generate_port_link($interface, makeshortif($interface['ifDescr'])) . "</strong><br />\n <span class=body-date-1>" . truncate($interface['ifAlias'], 15) . "</span>\n </div>";
}
}
}
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'";
foreach (dbFetchRows($sql) as $service) {
if (device_permitted($service['device_id'])) {
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>\n <strong>" . generate_device_link($service, shorthost($service['hostname'])) . "</strong><br />\n <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span><br />\n <strong>" . $service['service_type'] . "</strong><br />\n <span class=body-date-1>" . truncate($interface['ifAlias'], 15) . "</span>\n </center></div>";
}
}
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id";
foreach (dbFetchRows($sql) as $peer) {
if (device_permitted($peer['device_id'])) {
echo "<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>\n <strong>" . generate_device_link($peer, shorthost($peer['hostname'])) . "</strong><br />\n <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span><br />\n <strong>" . $peer['bgpPeerIdentifier'] . "</strong><br />\n <span class=body-date-1>AS" . $peer['bgpPeerRemoteAs'] . " " . truncate($peer['astext'], 10) . "</span>\n </div>";
}
}
示例5: alert_details
function alert_details($details)
{
if (!is_array($details)) {
$details = json_decode(gzuncompress($details), true);
}
$fault_detail = '';
foreach ($details['rule'] as $o => $tmp_alerts) {
$fallback = true;
$fault_detail .= '#' . ($o + 1) . ': ';
if ($tmp_alerts['bill_id']) {
$fault_detail .= '<a href="' . generate_bill_url($tmp_alerts) . '">' . $tmp_alerts['bill_name'] . '</a>; ';
$fallback = false;
}
if ($tmp_alerts['port_id']) {
$fault_detail .= generate_port_link($tmp_alerts) . '; ';
$fallback = false;
}
if ($fallback === true) {
foreach ($tmp_alerts as $k => $v) {
if (!empty($v) && $k != 'device_id' && (stristr($k, 'id') || stristr($k, 'desc') || stristr($k, 'msg')) && substr_count($k, '_') <= 1) {
$fault_detail .= "{$k} => '{$v}', ";
}
}
$fault_detail = rtrim($fault_detail, ', ');
}
$fault_detail .= '<br>';
}
//end foreach
return $fault_detail;
}
示例6: get_status_array
function get_status_array($status)
{
// Mike: I know that there are duplicated variables, but later will remove global
global $config, $cache;
$max_interval = filter_var($status['max']['interval'], FILTER_VALIDATE_INT, array('options' => array('default' => 24, 'min_range' => 1)));
$max_count = filter_var($status['max']['count'], FILTER_VALIDATE_INT, array('options' => array('default' => 200, 'min_range' => 1)));
$query_device_permitted = generate_query_permitted(array('device'), array('device_table' => 'D'));
$query_port_permitted = generate_query_permitted(array('port'), array('port_table' => 'I'));
// Show Device Status
if ($status['devices']) {
$query = 'SELECT * FROM `devices` AS D ';
$query .= 'WHERE D.`status` = 0' . $query_device_permitted;
$query .= 'ORDER BY D.`hostname` ASC';
$entries = dbFetchRows($query);
foreach ($entries as $device) {
$boxes[] = array('sev' => 100, 'class' => 'Device', 'event' => 'Down', 'device_link' => generate_device_link($device, short_hostname($device['hostname'])), 'time' => deviceUptime($device, 'short-3'));
}
}
// Uptime
if ($status['uptime']) {
if (filter_var($config['uptime_warning'], FILTER_VALIDATE_FLOAT) !== FALSE && $config['uptime_warning'] > 0) {
$query = 'SELECT * FROM `devices` AS D ';
$query .= 'WHERE D.`status` = 1 AND D.`uptime` > 0 AND D.`uptime` < ' . $config['uptime_warning'];
$query .= $query_device_permitted;
$query .= 'ORDER BY D.`hostname` ASC';
$entries = dbFetchRows($query);
foreach ($entries as $device) {
$boxes[] = array('sev' => 10, 'class' => 'Device', 'event' => 'Rebooted', 'device_link' => generate_device_link($device, short_hostname($device['hostname'])), 'time' => deviceUptime($device, 'short-3'), 'location' => $device['location']);
}
}
}
// Ports Down
if ($status['ports'] || $status['links']) {
// warning about deprecated option: $config['warn']['ifdown']
if (isset($config['warn']['ifdown']) && !$config['warn']['ifdown']) {
print_warning("<strong>Config option obsolete</strong>\n Please note that config option <strong>\$config['warn']['ifdown']</strong> is now obsolete.\n Use options: <strong>\$config['frontpage']['device_status']['ports']</strong> and <strong>\$config['frontpage']['device_status']['errors']</strong>\n To remove this message, delete <strong>\$config['warn']['ifdown']</strong> from configuration file.");
}
$query = 'SELECT * FROM `ports` AS I ';
if ($status['links'] && !$status['ports']) {
$query .= 'INNER JOIN `links` as L ON I.`port_id` = L.`local_port_id` ';
}
$query .= 'LEFT JOIN `devices` AS D ON I.`device_id` = D.`device_id` ';
$query .= "WHERE I.`ifOperStatus` = 'down' AND I.`ifAdminStatus` = 'up' ";
if ($status['links'] && !$status['ports']) {
$query .= ' AND L.`active` = 1 ';
}
$query .= $query_port_permitted;
$query .= ' AND I.`ifLastChange` >= DATE_SUB(NOW(), INTERVAL ' . $max_interval . ' HOUR) ';
$query .= 'ORDER BY I.`ifLastChange` DESC, D.`hostname` ASC, I.`ifDescr` * 1 ASC ';
$entries = dbFetchRows($query);
$i = 1;
foreach ($entries as $port) {
if ($i > $max_count) {
// Limit to 200 ports on overview page
break;
}
humanize_port($port);
$boxes[] = array('sev' => 50, 'class' => 'Port', 'event' => 'Down', 'device_link' => generate_device_link($port, short_hostname($port['hostname'])), 'entity_link' => generate_port_link($port, short_ifname($port['label'], 13)), 'time' => formatUptime($config['time']['now'] - strtotime($port['ifLastChange'])), 'location' => $device['location']);
}
}
// Ports Errors (only deltas)
if ($status['errors']) {
foreach ($cache['ports']['errored'] as $port_id) {
$port = get_port_by_id($port_id);
$device = device_by_id_cache($port['device_id']);
humanize_port($port);
if ($port['ifInErrors_delta']) {
$port['string'] .= 'Rx: ' . format_number($port['ifInErrors_delta']);
}
if ($port['ifInErrors_delta'] && $port['ifOutErrors_delta']) {
$port['string'] .= ', ';
}
if ($port['ifOutErrors_delta']) {
$port['string'] .= 'Tx: ' . format_number($port['ifOutErrors_delta']);
}
$boxes[] = array('sev' => 75, 'class' => 'Port', 'event' => 'Errors', 'device_link' => generate_device_link($device, short_hostname($device['hostname'])), 'entity_link' => generate_port_link($port, short_ifname($port['label'], 13)), 'time' => $port['string'], 'location' => $device['location']);
}
}
// Services
if ($status['services']) {
$query = 'SELECT * FROM `services` AS S ';
$query .= 'LEFT JOIN `devices` AS D ON S.device_id = D.device_id ';
$query .= "WHERE S.`service_status` = 'down' AND S.`service_ignore` = 0";
$query .= $query_device_permitted;
$query .= 'ORDER BY D.`hostname` ASC';
$entries = dbFetchRows($query);
foreach ($entries as $service) {
$boxes[] = array('sev' => 50, 'class' => 'Service', 'event' => 'Down', 'device_link' => generate_device_link($service, short_hostname($service['hostname'])), 'entity_link' => $service['service_type'], 'time' => formatUptime($config['time']['now'] - strtotime($service['service_changed']), 'short'), 'location' => $device['location']);
}
}
// BGP
if ($status['bgp']) {
if (isset($config['enable_bgp']) && $config['enable_bgp']) {
$query = 'SELECT * FROM `devices` AS D ';
$query .= 'LEFT JOIN `bgpPeers` AS B ON B.`device_id` = D.`device_id` ';
$query .= 'LEFT JOIN `bgpPeers-state` AS BS ON B.`bgpPeer_id` = BS.`bgpPeer_id` ';
$query .= "WHERE (`bgpPeerAdminStatus` = 'start' OR `bgpPeerAdminStatus` = 'running') AND `bgpPeerState` != 'established' ";
$query .= $query_device_permitted;
$query .= 'ORDER BY D.`hostname` ASC';
$entries = dbFetchRows($query);
//.........这里部分代码省略.........
示例7: get_port_by_id
*
*/
include_once "../includes/defaults.inc.php";
include_once "../config.php";
include_once "../includes/definitions.inc.php";
include_once "../includes/common.inc.php";
include_once "../includes/dbFacile.php";
include_once "../includes/rewrites.inc.php";
include_once "includes/functions.inc.php";
include_once "includes/authenticate.inc.php";
include_once "../includes/snmp.inc.php";
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || port_permitted($_GET['id']))) {
$port = get_port_by_id($_GET['id']);
$device = device_by_id_cache($port['device_id']);
$title = generate_device_link($device);
$title .= " :: Port " . generate_port_link($port);
$auth = TRUE;
} else {
echo "Unauthenticad";
die;
}
header("Content-type: image/svg+xml");
/********** HTTP GET Based Conf ***********/
$ifnum = @$port['ifIndex'];
// BSD / SNMP interface name / number
$ifname = htmlentities(@$port['ifDescr']);
//Interface name that will be showed on top right of graph
$hostname = short_hostname($device['hostname']);
if ($_GET['title']) {
$ifname = $_GET['title'];
}
示例8: makeshortif
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>';
$i++;
}
//end foreach
echo '</table></div>';
示例9: str_ireplace
$port['ifAlias'] = str_ireplace($type . ": ", "", $port['ifAlias']);
$port['ifAlias'] = str_ireplace("[PNI]", "Private", $port['ifAlias']);
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
if ($bg == "#ffffff") {
$bg = "#e5e5e5";
} else {
$bg = "#ffffff";
}
echo "<tr class='iftype'>\n <td><span class=entity-title>" . generate_port_link($port, $port['port_descr_descr']) . "</span>";
# <span class=small style='float: left;'>".generate_device_link($port)." ".generate_port_link($port)." </span>");
if (dbFetchCell("SELECT count(*) FROM mac_accounting WHERE port_id = ?", array($port['port_id']))) {
echo "<span style='float: right;'><a href='device/device=" . $port['device_id'] . "/tab=port/port=" . $port['port_id'] . "/view=macaccounting/'><img src='images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>";
}
echo "</td>";
echo ' <td style="width: 150px;" class="strong">' . generate_device_link($port) . '</td>
<td style="width: 150px;" class="strong">' . generate_port_link($port, short_ifname($port['ifDescr'])) . '</td>
<td style="width: 75px;">' . $port['port_descr_speed'] . '</td>
<td style="width: 150px;">' . $port['port_descr_circuit'] . '</td>
<td>' . $port['port_descr_notes'] . '</td>';
echo '</tr><tr><td colspan="6">';
$rrdfile = get_port_rrdfilename($port, NULL, TRUE);
if (file_exists($rrdfile)) {
$graph_type = "port_bits";
include "includes/print-interface-graphs.inc.php";
}
echo "</td></tr>";
}
} else {
echo "None found.</td></tr>";
}
?>
示例10: unix_timestamp
<?php
/*
* LibreNMS front page top ports graph
* - Find most utilised ports that have been polled in the last N minutes
*
* Author: Paul Gear
* Copyright (c) 2013 Gear Consulting Pty Ltd <http://libertysys.com.au/>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
$minutes = 15;
$seconds = $minutes * 60;
$top = $config['front_page_settings']['top']['ports'];
if (is_admin() === true || is_read() === true) {
$query = "\n SELECT *, p.ifInOctets_rate + p.ifOutOctets_rate as total\n FROM ports as p, devices as d\n WHERE d.device_id = p.device_id\n AND unix_timestamp() - p.poll_time < {$seconds}\n AND ( p.ifInOctets_rate > 0\n OR p.ifOutOctets_rate > 0 )\n ORDER BY total desc\n LIMIT {$top}\n ";
} else {
$query = "\n SELECT *, I.ifInOctets_rate + I.ifOutOctets_rate as total\n FROM ports as I, devices as d,\n `devices_perms` AS `P`, `ports_perms` AS `PP`\n WHERE ((`P`.`user_id` = ? AND `P`.`device_id` = `d`.`device_id`) OR (`PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` AND `I`.`device_id` = `d`.`device_id`)) AND\n d.device_id = I.device_id\n AND unix_timestamp() - I.poll_time < {$seconds}\n AND ( I.ifInOctets_rate > 0\n OR I.ifOutOctets_rate > 0 )\n ORDER BY total desc\n LIMIT {$top}\n ";
$param[] = array($_SESSION['user_id'], $_SESSION['user_id']);
}
//end if
echo "<strong>Top {$top} ports (last {$minutes} minutes)</strong>\n";
echo "<table class='simple'>\n";
foreach (dbFetchRows($query, $param) as $result) {
echo '<tr class=top10>' . '<td class=top10>' . generate_device_link($result, shorthost($result['hostname'])) . '</td>' . '<td class=top10>' . generate_port_link($result) . '</td>' . '<td class=top10>' . generate_port_link($result, generate_port_thumbnail($result)) . '</td>' . "</tr>\n";
}
echo "</table>\n";
示例11: foreach
LIMIT :count
';
}
$common_output[] = '
<h4>Top ' . $interface_count . ' interfaces polled within ' . $interval . ' minutes</h4>
<div class="table-responsive">
<table class="table table-hover table-condensed table-striped bootgrid-table">
<thead>
<tr>
<th class="text-left">Device</th>
<th class="text-left">Interface</th>
<th class="text-left">Total traffic</a></th>
</tr>
</thead>
<tbody>
';
foreach (dbFetchRows($query, $params) as $result) {
$common_output[] = '
<tr>
<td class="text-left">' . generate_device_link($result, shorthost($result['hostname'])) . '</td>
<td class="text-left">' . generate_port_link($result, shorten_interface_type($result['ifName'])) . '</td>
<td class="text-left">' . generate_port_link($result, generate_port_thumbnail($result)) . '</td>
</tr>
';
}
$common_output[] = '
</tbody>
</table>
</div>
';
}
示例12: foreach
$bg_colour = $list_colour_a;
} else {
$bg_colour = $list_colour_b;
}
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = ?", array($customer['port_descr_descr'])) as $port) {
$device = device_by_id_cache($port['device_id']);
unset($class);
$ifname = fixifname($device['ifDescr']);
$ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
if ($device['os'] == "ios") {
if ($port['ifTrunk']) {
$vlan = "<span class=box-desc><span class=red>" . $port['ifTrunk'] . "</span></span>";
} elseif ($port['ifVlan']) {
$vlan = "<span class=box-desc><span class=blue>VLAN " . $port['ifVlan'] . "</span></span>";
} else {
$vlan = "";
}
}
echo "\n <tr bgcolor='{$bg_colour}'>\n <td width='7'></td>\n <td width='250'><span style='font-weight: bold;' class=interface>" . $customer_name . "</span></td>\n <td width='150'>" . generate_device_link($device) . "</td>\n <td width='100'>" . generate_port_link($port, makeshortif($port['ifDescr'])) . "</td>\n <td width='100'>" . $port['port_descr_speed'] . "</td>\n <td width='100'>" . $port['port_descr_circuit'] . "</td>\n <td>" . $port['port_descr_notes'] . "</td>\n </tr>\n ";
unset($customer_name);
}
echo "<tr bgcolor='{$bg_colour}'><td></td><td colspan=6>";
$graph_array['type'] = "customer_bits";
$graph_array['height'] = "100";
$graph_array['width'] = "220";
$graph_array['to'] = $config['time']['now'];
$graph_array['id'] = $customer['port_descr_descr'];
include "includes/print-graphrow.inc.php";
echo "</tr>";
}
echo "</table>";
示例13: foreach
<?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>";
示例14: dbFetchRow
$pw_b = dbFetchRow("SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = ? AND D.device_id = I.device_id\n AND P.cpwVcID = ? AND P.port_id = I.port_id", array($pw_a['peer_device_id'], $pw_a['cpwVcID']));
if (!port_permitted($pw_a['port_id'])) {
$skip = "yes";
}
if (!port_permitted($pw_b['port_id'])) {
$skip = "yes";
}
if ($skip) {
unset($skip);
} else {
if ($bg == "ffffff") {
$bg = "e5e5e5";
} else {
$bg = "ffffff";
}
echo "<tr style=\"background-color: #{$bg};\"><td rowspan=2 style='font-size:18px; padding:4px;'>" . $pw_a['cpwVcID'] . "</td><td>" . generate_port_link($pw_a) . "</td>\n <td rowspan=2> <img src='images/16/arrow_right.png'> </td>\n <td>" . generate_device_link($peer_device) . "</td><td>" . generate_port_link($pw_b) . "</td></tr>";
echo "<tr style=\"background-color: #{$bg};\"><td colspan=2>" . $pw_a['ifAlias'] . "</td><td>" . $pw_b['ifAlias'] . "</td></tr>";
if ($vars['view'] == "minigraphs") {
echo "<tr style=\"background-color: #{$bg};\"><td></td><td colspan=2>";
if ($pw_a) {
$pw_a['width'] = "150";
$pw_a['height'] = "30";
$pw_a['from'] = $config['time']['day'];
$pw_a['to'] = $config['time']['now'];
$pw_a['bg'] = $bg;
$types = array('bits', 'upkts', 'errors');
foreach ($types as $graph_type) {
$pw_a['graph_type'] = "port_" . $graph_type;
generate_port_thumbnail($pw_a);
}
}
示例15: dbFetchRow
if ($port['pagpGroupIfIndex'] && $port['pagpGroupIfIndex'] != $port['ifIndex']) {
$parent = dbFetchRow("SELECT * FROM `ports` WHERE `ifIndex` = ? and `device_id` = ?", array($port['pagpGroupIfIndex'], $device['device_id']));
echo "{$br}<img src='images/16/bricks.png' align=absmiddle> <strong>" . generate_port_link($parent) . " (PAgP)</strong>";
$br = "<br />";
}
foreach (dbFetchRows("SELECT * FROM `ports_stack` WHERE `port_id_low` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $higher_if) {
if ($higher_if['port_id_high']) {
$this_port = get_port_by_index_cache($device['device_id'], $higher_if['port_id_high']);
echo "{$br}<img src='images/16/arrow_divide.png' align=absmiddle> <strong>" . generate_port_link($this_port) . "</strong>";
$br = "<br />";
}
}
foreach (dbFetchRows("SELECT * FROM `ports_stack` WHERE `port_id_high` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $lower_if) {
if ($lower_if['port_id_low']) {
$this_port = get_port_by_index_cache($device['device_id'], $lower_if['port_id_low']);
echo "{$br}<img src='images/16/arrow_join.png' align=absmiddle> <strong>" . generate_port_link($this_port) . "</strong>";
$br = "<br />";
}
}
}
unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
echo "</td></tr>";
// If we're showing graphs, generate the graph and print the img tags
if ($graph_type == "etherlike") {
$graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex']) . "-dot3.rrd";
} else {
$graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex']) . ".rrd";
}
if ($graph_type && is_file($graph_file)) {
$type = $graph_type;
echo "<tr style='background-color: {$row_colour}; padding: 0px;'><td colspan=7>";