本文整理汇总了PHP中get_device_id_by_port_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_device_id_by_port_id函数的具体用法?PHP get_device_id_by_port_id怎么用?PHP get_device_id_by_port_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_device_id_by_port_id函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: port_permitted
function port_permitted($port_id, $device_id = null)
{
global $permissions;
if (!is_numeric($device_id)) {
$device_id = get_device_id_by_port_id($port_id);
}
if ($_SESSION['userlevel'] >= '5') {
$allowed = true;
} else {
if (device_permitted($device_id)) {
$allowed = true;
} else {
if ($permissions['port'][$port_id]) {
$allowed = true;
} else {
$allowed = false;
}
}
}
return $allowed;
}
示例2: port_permitted
function port_permitted($port_id, $device_id = NULL)
{
global $permissions;
if (!is_numeric($device_id)) {
$device_id = get_device_id_by_port_id($port_id);
}
if ($_SESSION['userlevel'] >= "5") {
$allowed = TRUE;
} elseif (device_permitted($device_id)) {
$allowed = TRUE;
} elseif ($permissions['port'][$port_id]) {
$allowed = TRUE;
} else {
$allowed = FALSE;
}
return $allowed;
}
示例3: get_device_id_by_port_id
<?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">';
示例4: 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;
}