本文整理汇总了PHP中port_permitted函数的典型用法代码示例。如果您正苦于以下问题:PHP port_permitted函数的具体用法?PHP port_permitted怎么用?PHP port_permitted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了port_permitted函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2014 Adam Armstrong
*
*/
if (!is_array($vars['id'])) {
$vars['id'] = array($vars['id']);
}
$auth = TRUE;
foreach ($vars['id'] as $ifid) {
if (!$auth && !port_permitted($ifid)) {
$auth = FALSE;
}
}
$title = "Multi Port :: ";
// EOF
示例2: while
$i = 0;
while ($i < count($linkdone)) {
$thislink = $pw_a['device_id'] . $pw_a['port_id'];
if ($linkdone[$i] == $thislink) {
$skip = "yes";
}
$i++;
}
if ($peer_device_id) {
$peer_device = get_device_by_id_cache($peer_device_id);
}
$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) {
示例3: generate_ap_link
function generate_ap_link($args, $text = NULL, $type = NULL, $escape = FALSE)
{
global $config;
humanize_port($args);
if (!$text) {
$text = rewrite_ifname($args['port_label'], !$escape);
}
// Negative escape flag for exclude double escape
if ($type) {
$args['graph_type'] = $type;
}
if (!isset($args['graph_type'])) {
$args['graph_type'] = 'port_bits';
}
if (!isset($args['hostname'])) {
$args = array_merge($args, device_by_id_cache($args['device_id']));
}
$content = "<div class=entity-title>" . $args['text'] . " - " . rewrite_ifname($args['port_label'], !$escape) . "</div>";
if ($args['ifAlias']) {
$content .= $args['ifAlias'] . "<br />";
}
$content .= "<div style=\\'width: 850px\\'>";
$graph_array['type'] = $args['graph_type'];
$graph_array['legend'] = "yes";
$graph_array['height'] = "100";
$graph_array['width'] = "340";
$graph_array['to'] = $config['time']['now'];
$graph_array['from'] = $config['time']['day'];
$graph_array['id'] = $args['accesspoint_id'];
$content .= generate_graph_tag($graph_array);
$graph_array['from'] = $config['time']['week'];
$content .= generate_graph_tag($graph_array);
$graph_array['from'] = $config['time']['month'];
$content .= generate_graph_tag($graph_array);
$graph_array['from'] = $config['time']['year'];
$content .= generate_graph_tag($graph_array);
$content .= "</div>";
$url = generate_ap_url($args);
if (port_permitted($args['interface_id'], $args['device_id'])) {
return overlib_link($url, $text, $content, $class, $escape);
} else {
return rewrite_ifname($text);
}
}
示例4: array
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage graphs
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
*
*/
if (!is_array($vars['id'])) {
$vars['id'] = array($vars['id']);
}
$auth = TRUE;
foreach ($vars['id'] as $port_id) {
if (!$auth && !port_permitted($port_id)) {
$auth = FALSE;
}
}
$title = "Multi Port :: " . count($vars['id']) . " ports :: ";
// EOF
示例5: mres
<?php
if ($vars['tab'] == 'port' && is_numeric($vars['device']) && port_permitted($vars['port'])) {
$check_device = get_device_id_by_port_id($vars['port']);
$permit_ports = 1;
}
if (!is_numeric($vars['device'])) {
$vars['device'] = device_by_name($vars['device']);
}
if (device_permitted($vars['device']) || $check_device == $vars['device']) {
$selected['iface'] = 'selected';
$tab = str_replace('.', '', mres($vars['tab']));
if (!$tab) {
$tab = 'overview';
}
$select[$tab] = 'active';
$device = device_by_id_cache($vars['device']);
$attribs = get_dev_attribs($device['device_id']);
$entity_state = get_dev_entity_state($device['device_id']);
// print_r($entity_state);
$pagetitle[] = $device['hostname'];
if ($config['os'][$device['os']]['group']) {
$device['os_group'] = $config['os'][$device['os']]['group'];
}
echo '<div class="panel panel-default">';
echo '<table class="device-header-table" style="margin: 0px 7px 7px 7px;" cellspacing="0" class="devicetable" width="99%">';
require 'includes/device-header.inc.php';
echo '</table>';
echo '</div>';
if (device_permitted($device['device_id'])) {
echo '<ul class="nav nav-tabs">';
示例6: Alerts
$ifbreak = 1;
}
if ($config['int_core']) {
echo ' <li><a href="iftype/type=core/"><img src="images/16/brick_link.png" border="0" align="absmiddle" /> Core</a></li>';
$ifbreak = 1;
}
}
if ($ifbreak) {
echo ' <li role="presentation" class="divider"></li>';
}
if (isset($interface_alerts)) {
echo ' <li><a href="ports/alerted=yes/"><img src="images/16/link_error.png" border="0" align="absmiddle" /> Alerts (' . $interface_alerts . ')</a></li>';
}
$deleted_ports = 0;
foreach (dbFetchRows("SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id") as $interface) {
if (port_permitted($interface['port_id'], $interface['device_id'])) {
$deleted_ports++;
}
}
?>
<li><a href="ports/state=down/"><img src="images/16/if-disconnect.png" border="0" align="absmiddle" /> Down</a></li>
<li><a href="ports/state=admindown/"><img src="images/16/if-disable.png" border="0" align="absmiddle" /> Disabled</a></li>
<?php
if ($deleted_ports) {
echo ' <li><a href="deleted-ports/"><img src="images/16/cross.png" border="0" align="absmiddle" /> Deleted (' . $deleted_ports . ')</a></li>';
}
?>
</ul>
</li>
示例7: array_sort
case 'errors':
$ports = array_sort($ports, 'ifErrors_rate', SORT_DESC);
break;
case 'speed':
$ports = array_sort($ports, 'ifSpeed', SORT_DESC);
break;
case 'port':
$ports = array_sort($ports, 'ifDescr', SORT_ASC);
break;
case 'media':
$ports = array_sort($ports, 'ifType', SORT_ASC);
break;
case 'descr':
$ports = array_sort($ports, 'ifAlias', SORT_ASC);
break;
case 'device':
default:
$ports = array_sort($ports, 'hostname', SORT_ASC);
}
//end switch
$csv[] = array('Device', 'Port', 'Speed', 'Down', 'Up', 'Media', 'Description');
foreach ($ports as $port) {
if (port_permitted($port['port_id'], $port['device_id'])) {
$speed = humanspeed($port['ifSpeed']);
$type = humanmedia($port['ifType']);
$port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
$port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
$port = ifLabel($port, $device);
$csv[] = array($port['hostname'], fixIfName($port['label']), $speed, $port['in_rate'], $port['out_rate'], $type, $port['ifAlias']);
}
}
示例8: array
$query .= " AND F.`mac_address` LIKE ?";
$param = array("%" . str_replace(array(':', ' ', '-', '.', '0x'), '', mres($_POST['string'])) . "%");
if (is_numeric($_POST['device_id'])) {
$query .= " AND P.device_id = ?";
$param[] = $_POST['device_id'];
}
$query .= " ORDER BY F.mac_address";
echo '<thead><tr>
<th>MAC Address</th>
<th>Device</th>
<th>Interface</th>
<th>VLAN ID</th>
<th>VLAN Name</th>
</tr></thead>';
foreach (dbFetchRows($query, $param) as $entry) {
if (port_permitted($entry['port_id'])) {
//why are they here for?
//$speed = humanspeed($entry['ifSpeed']);
//$type = humanmedia($entry['ifType']);
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>", 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) {
示例9: generate_port_link
echo '<b>' . generate_port_link($link_if, makeshortif($link_if['label'])) . ' on ' . generate_device_link($link_if, shorthost($link_if['hostname']));
if ($int_links_v6[$int_link]) {
echo " <b style='color: #a10000;'>v6</b>";
}
if ($int_links_v4[$int_link]) {
echo " <b style='color: #00a100'>v4</b>";
}
$br = '<br />';
}
//end foreach
}
//end if
// unset($int_links, $int_links_v6, $int_links_v4, $int_links_phys, $br);
}
//end if
if ($port_details && $config['enable_port_relationship'] === true && port_permitted($port['port_id'], $device['device_id'])) {
foreach (dbFetchRows('SELECT * FROM `pseudowires` WHERE `port_id` = ?', array($port['port_id'])) as $pseudowire) {
// `port_id`,`peer_device_id`,`peer_ldp_id`,`cpwVcID`,`cpwOid`
$pw_peer_dev = dbFetchRow('SELECT * FROM `devices` WHERE `device_id` = ?', array($pseudowire['peer_device_id']));
$pw_peer_int = dbFetchRow('SELECT * FROM `ports` AS I, pseudowires AS P WHERE I.device_id = ? AND P.cpwVcID = ? AND P.port_id = I.port_id', array($pseudowire['peer_device_id'], $pseudowire['cpwVcID']));
$pw_peer_int = ifNameDescr($pw_peer_int);
echo "{$br}<img src='images/16/arrow_switch.png' align=absmiddle><b> " . generate_port_link($pw_peer_int, makeshortif($pw_peer_int['label'])) . ' on ' . generate_device_link($pw_peer_dev, shorthost($pw_peer_dev['hostname'])) . '</b>';
$br = '<br />';
}
foreach (dbFetchRows('SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = ? and `device_id` = ?', array($port['ifIndex'], $device['device_id'])) as $member) {
echo "{$br}<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . ' (PAgP)</strong>';
$br = '<br />';
}
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>';
示例10: print_addresses
/**
* Display IPv4/IPv6 addresses.
*
* Display pages with IP addresses from device Interfaces.
*
* @param array $vars
* @return none
*
*/
function print_addresses($vars)
{
// With pagination? (display page numbers in header)
$pagination = isset($vars['pagination']) && $vars['pagination'];
pagination($vars, 0, TRUE);
// Get default pagesize/pageno
$pageno = $vars['pageno'];
$pagesize = $vars['pagesize'];
$start = $pagesize * $pageno - $pagesize;
if (in_array($vars['search'], array('6', 'v6', 'ipv6')) || in_array($vars['view'], array('6', 'v6', 'ipv6'))) {
$address_type = 'ipv6';
} else {
$address_type = 'ipv4';
}
$ip_array = array();
$param = array();
$where = ' WHERE 1 ';
$param_netscaler = array();
$where_netscaler = " WHERE `vsvr_ip` != '0.0.0.0' AND `vsvr_ip` != '' ";
foreach ($vars as $var => $value) {
if ($value != '') {
switch ($var) {
case 'device':
case 'device_id':
$where .= generate_query_values($value, 'I.device_id');
$where_netscaler .= generate_query_values($value, 'N.device_id');
break;
case 'interface':
$where .= generate_query_values($value, 'I.ifDescr', 'LIKE%');
break;
case 'network':
list($net, $mask) = explode('/', $value);
if (is_numeric(stripos($net, ':abcdef'))) {
$address_type = 'ipv6';
}
$where .= generate_query_values($value, 'N.ip_network', 'LIKE%');
break;
case 'address':
list($addr, $mask) = explode('/', $value);
if (is_numeric(stripos($addr, ':abcdef'))) {
$address_type = 'ipv6';
}
switch ($address_type) {
case 'ipv6':
$ip_valid = Net_IPv6::checkIPv6($addr);
break;
case 'ipv4':
$ip_valid = Net_IPv4::validateIP($addr);
break;
}
if ($ip_valid) {
// If address valid -> seek occurrence in network
if (!$mask) {
$mask = $address_type === 'ipv4' ? '32' : '128';
}
$where_netscaler .= generate_query_values($addr, 'N.vsvr_ip');
} else {
// If address not valid -> seek LIKE
$where .= generate_query_values($addr, 'A.ip_address', '%LIKE%');
$where_netscaler .= generate_query_values($addr, 'N.vsvr_ip', '%LIKE%');
}
break;
}
}
}
$query_device_permitted = generate_query_permitted(array('device'), array('device_table' => 'D'));
$query_port_permitted = generate_query_permitted(array('port'), array('port_table' => 'I'));
// Also search netscaler Vserver IPs
$query_netscaler = 'FROM `netscaler_vservers` AS N ';
$query_netscaler .= 'LEFT JOIN `devices` AS D ON N.`device_id` = D.`device_id` ';
$query_netscaler .= $where_netscaler . $query_device_permitted;
//$query_netscaler_count = 'SELECT COUNT(`vsvr_id`) ' . $query_netscaler;
$query_netscaler = 'SELECT * ' . $query_netscaler;
$query_netscaler .= ' ORDER BY N.`vsvr_ip`';
// Override by address type
if ($address_type == 'ipv6') {
$query_netscaler = str_replace(array('vsvr_ip', '0.0.0.0'), array('vsvr_ipv6', '0:0:0:0:0:0:0:0'), $query_netscaler);
//$query_netscaler_count = str_replace(array('vsvr_ip', '0.0.0.0'), array('vsvr_ipv6', '0:0:0:0:0:0:0:0'), $query_netscaler_count);
}
$entries = dbFetchRows($query_netscaler, $param_netscaler);
// Rewrite netscaler addresses
foreach ($entries as $entry) {
$ip_address = $address_type == 'ipv4' ? $entry['vsvr_ip'] : $entry['vsvr_' . $address_type];
$ip_network = $address_type == 'ipv4' ? $entry['vsvr_ip'] . '/32' : $entry['vsvr_' . $address_type] . '/128';
$ip_array[] = array('type' => 'netscaler_vsvr', 'device_id' => $entry['device_id'], 'hostname' => $entry['hostname'], 'vsvr_id' => $entry['vsvr_id'], 'vsvr_label' => $entry['vsvr_label'], 'ifAlias' => 'Netscaler: ' . $entry['vsvr_type'] . '/' . $entry['vsvr_entitytype'], $address_type . '_address' => $ip_address, $address_type . '_network' => $ip_network);
}
//print_message($query_netscaler_count);
$query = 'FROM `ip_addresses` AS A ';
$query .= 'LEFT JOIN `ports` AS I ON I.`port_id` = A.`port_id` ';
$query .= 'LEFT JOIN `devices` AS D ON I.`device_id` = D.`device_id` ';
$query .= 'LEFT JOIN `ip_networks` AS N ON N.`ip_network_id` = A.`ip_network_id` ';
//.........这里部分代码省略.........
示例11: foreach
$cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['entries'][$device['location_city']]['level'] = 'location_city';
$cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['entries'][$device['location_city']]['entries'][$device['location']]['count']++;
$cache['locations']['entries'][$device['location_country']]['entries'][$device['location_state']]['entries'][$device['location_county']]['entries'][$device['location_city']]['entries'][$device['location']]['level'] = 'location';
}
}
#echo("<pre>");
#print_r($cache['locations']);
#echo("</pre>");
// Ports
foreach (dbFetchRows("SELECT device_id, ports.port_id, ifAdminStatus, ifOperStatus, `deleted`, `ignore`, `ifOutErrors_delta`, `ifInErrors_delta` FROM `ports` LEFT JOIN `ports-state` ON `ports`.`port_id` = `ports-state`.`port_id`") as $port) {
if (!$config['web_show_disabled']) {
if ($cache['devices']['id'][$port['device_id']]['disabled']) {
continue;
}
}
if (port_permitted($port)) {
$ports['count']++;
if ($port['ifAdminStatus'] == "down") {
$ports['disabled']++;
} else {
if ($port['ifOperStatus'] == "up") {
$ports['up']++;
}
if ($port['ifOperStatus'] == "down" || $port['ifOperStatus'] == "lowerLayerDown") {
$ports['down']++;
if (!$port['ignore']) {
$ports['alerts']++;
}
}
}
if ($port['ignore']) {
示例12: print_error
print_error('<h4>No device specified</h4>
A valid device was not specified in the URL. Please retype and try again.');
return;
}
// Allow people to see this page if they have permission to see one of the ports, but don't show them tabs.
$permit_tabs = array();
if ($vars['tab'] == "port" && is_numeric($vars['device']) && (isset($vars['port']) || isset($vars['ifdescr']))) {
// If we've been given a 'ifdescr' variable, try to work out the port_id from this
if (!is_numeric($vars['port']) && !empty($vars['ifdescr'])) {
$ifdescr = base64_decode($vars['ifdescr']);
if (!$ifdescr) {
$ifdescr = $vars['ifdescr'];
}
$vars['port'] = get_port_id_by_ifDescr($vars['device'], $ifdescr);
}
if (port_permitted($vars['port']) && $vars['device'] == get_device_id_by_port_id($vars['port'])) {
$permit_tabs['ports'] = TRUE;
}
}
if ($vars['tab'] == "health" && is_numeric($vars['id']) && isset($vars['id'])) {
if (is_entity_permitted($vars['id'], 'sensor')) {
$permit_tabs['health'] = TRUE;
}
}
// print_vars($permit_tabs);
// If there is no valid device specified in the URL, generate an error.
if (!isset($cache['devices']['id'][$vars['device']]) && !count($permit_tabs)) {
print_error('<h4>No valid device specified</h4>
A valid device was not specified in the URL. Please retype and try again.');
return;
}
示例13: generate_port_link
/**
* Returns an HTML port page link with mouse-over popup to permitted users or a text label to non-permitted users
*
* @param array $port array
* @param string $text text to be used as port label
* @param string $type graph type to be used in graphs (bits, nupkts, etc)
*
* @return string HTML link or text string
*/
function generate_port_link($port, $text = NULL, $type = NULL, $escape = FALSE, $short = FALSE)
{
humanize_port($port);
//if (!isset($port['html_class'])) { $port['html_class'] = ifclass($port['ifOperStatus'], $port['ifAdminStatus']); }
//if (!isset($text)) { $text = rewrite_ifname($port['port_label'], !$escape); } // Negative escape flag for exclude double escape
// Fixme -- does this function even need alternative $text? I think not. It's a hangover from before label.
if (!isset($text) && !$short) {
$text = $port['port_label'];
} elseif (!isset($text) && $short) {
$text = $port['port_label_short'];
}
if (port_permitted($port['port_id'], $port['device_id'])) {
$url = generate_port_url($port);
if ($escape) {
$text = escape_html($text);
}
return '<a href="' . $url . '" class="entity-popup ' . $port['html_class'] . '" data-eid="' . $port['port_id'] . '" data-etype="port">' . $text . '</a>';
} else {
return rewrite_ifname($text);
}
}
示例14: port_permitted_array
function port_permitted_array(&$ports)
{
// Strip out the ports the user isn't allowed to see, if they don't have global rights
if ($_SESSION['userlevel'] < '7') {
foreach ($ports as $key => $port) {
if (!port_permitted($port['port_id'], $port['device_id'])) {
unset($ports[$key]);
}
}
}
}
示例15: dbFetchRow
<?php
if ($_GET['id'] && is_numeric($_GET['id'])) {
$atm_vp_id = $_GET['id'];
}
$vp = dbFetchRow('SELECT * FROM `juniAtmVp` as J, `ports` AS I, `devices` AS D WHERE J.juniAtmVp_id = ? AND I.port_id = J.port_id AND I.device_id = D.device_id', array($atm_vp_id));
if ($auth || port_permitted($vp['port_id'])) {
$port = $vp;
$device = device_by_id_cache($port['device_id']);
$title = generate_device_link($device);
$title .= ' :: Port ' . generate_port_link($port);
$title .= ' :: VP ' . $vp['vp_id'];
$auth = true;
$rrd_filename = rrd_name($vp['hostname'], array('vp', $vp['ifIndex'], $vp['vp_id']));
}