• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP port_permitted函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中port_permitted函数的典型用法代码示例。如果您正苦于以下问题:PHP port_permitted函数的具体用法?PHP port_permitted怎么用?PHP port_permitted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了port_permitted函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
开发者ID:skive,项目名称:observium,代码行数:23,代码来源:auth.inc.php


示例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) {
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:pseudowires.inc.php


示例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);
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:44,代码来源:functions.inc.php


示例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
开发者ID:Natolumin,项目名称:observium,代码行数:23,代码来源:auth.inc.php


示例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">';
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:device.inc.php


示例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>
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:print-menubar.php


示例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']);
    }
}
开发者ID:sfromm,项目名称:librenms,代码行数:31,代码来源:ports.csv.inc.php


示例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) {
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:fdb.inc.php


示例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>';
开发者ID:Tatermen,项目名称:librenms,代码行数:31,代码来源:print-interface.inc.php


示例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` ';
//.........这里部分代码省略.........
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:addresses.inc.php


示例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']) {
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:cache-data.inc.php


示例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;
}
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:device.inc.php


示例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);
    }
}
开发者ID:Natolumin,项目名称:observium,代码行数:30,代码来源:port.inc.php


示例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]);
            }
        }
    }
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:11,代码来源:ports.inc.php


示例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']));
}
开发者ID:awlx,项目名称:librenms,代码行数:15,代码来源:auth.inc.php


示例16: print_error

 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
$config['install_dir'] = "../..";
require_once $config['install_dir'] . "/includes/sql-config.inc.php";
include $config['html_dir'] . "/includes/functions.inc.php";
include $config['html_dir'] . "/includes/authenticate.inc.php";
if (!$_SESSION['authenticated']) {
    print_error('Session expired, please log in again!');
    exit;
}
$vars = get_vars();
$vars['page'] = "popup";
switch ($vars['entity_type']) {
    case "port":
        if (is_numeric($vars['entity_id']) && port_permitted($vars['entity_id'])) {
            $port = get_port_by_id($vars['entity_id']);
            echo generate_port_popup($port);
        } else {
            print_warning("You are not permitted to view this port.");
        }
        exit;
        break;
    case "device":
        if (is_numeric($vars['entity_id']) && device_permitted($vars['entity_id'])) {
            $device = device_by_id_cache($vars['entity_id']);
            echo generate_device_popup($device, $vars, $start, $end);
        } else {
            print_warning("You are not permitted to view this device.");
        }
        exit;
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:entity_popup.php


示例17: htmlentities

 * @subpackage graphing
 * @author     T. Lechat <[email protected]>, Manuel Kasper <[email protected]>, Jonathan Watt <[email protected]>
 * @copyright  2004-2006 T. Lechat <[email protected]>, Manuel Kasper <[email protected]>, Jonathan Watt <[email protected]>
 * @license    BSD
 *
 */
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
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:graph-realtime.php


示例18: shorthost

<?php

if (is_numeric($vars['id']) && ($auth || port_permitted($vars['id']))) {
    $port = get_port_by_id($vars['id']);
    $device = device_by_id_cache($port['device_id']);
    $title = generate_device_link($device);
    $title .= " :: Port  " . generate_port_link($port);
    $graph_title = shorthost($device['hostname']) . "::" . strtolower(makeshortif($port['ifDescr']));
    $auth = TRUE;
    $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd");
}
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:11,代码来源:auth.inc.php


示例19: generate_ap_link

function generate_ap_link($args, $text = null, $type = null)
{
    global $config;
    $args = ifNameDescr($args);
    if (!$text) {
        $text = fixIfName($args['label']);
    }
    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=list-large>' . $args['text'] . ' - ' . fixifName($args['label']) . '</div>';
    if ($args['ifAlias']) {
        $content .= $args['ifAlias'] . '<br />';
    }
    $content .= "<div style=\\'width: 850px\\'>";
    $graph_array = array();
    $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, null);
    } else {
        return fixifName($text);
    }
}
开发者ID:RobsanInc,项目名称:librenms,代码行数:44,代码来源:functions.inc.php


示例20: print_mac_addresses

/**
 * Display Interface MACs addresses.
 *
 * Display pages with MAC addresses from device Interfaces.
 *
 * @param array $vars
 * @return none
 *
 */
function print_mac_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;
    $param = array();
    $where = ' WHERE 1 ';
    foreach ($vars as $var => $value) {
        if ($value != '') {
            switch ($var) {
                case 'device':
                case 'device_id':
                    $where .= generate_query_values($value, 'device_id');
                    break;
                case 'interface':
                    $where .= ' AND `ifDescr` LIKE ?';
                    $param[] = $value;
                    break;
                case 'address':
                    $where .= ' AND `ifPhysAddress` LIKE ?';
                    # FIXME hm? mres in a dbFacile parameter?
                    $param[] = '%' . str_replace(array(':', ' ', '-', '.', '0x'), '', mres($value)) . '%';
                    break;
            }
        }
    }
    $where .= ' AND `ifPhysAddress` IS NOT NULL';
    //Exclude empty MACs
    // Show MACs only for permitted ports
    $query_permitted = generate_query_permitted(array('port'));
    $query = 'FROM `ports` ';
    $query .= $where . $query_permitted;
    $query_count = 'SELECT COUNT(*) ' . $query;
    $query = 'SELECT * ' . $query;
    $query .= ' ORDER BY `ifPhysAddress`';
    $query .= " LIMIT {$start},{$pagesize}";
    // Query addresses
    $entries = dbFetchRows($query, $param);
    // Query address count
    if ($pagination) {
        $count = dbFetchCell($query_count, $param);
    }
    $list = array('device' => FALSE);
    if (!isset($vars['device']) || empty($vars['device']) || $vars['page'] == 'search') {
        $list['device'] = TRUE;
    }
    $string = '<table class="table table-bordered table-striped table-hover table-condensed">' . PHP_EOL;
    if (!$short) {
        $string .= '  <thead>' . PHP_EOL;
        $string .= '    <tr>' . PHP_EOL;
        if ($list['device']) {
            $string .= '      <th>Device</th>' . PHP_EOL;
        }
        $string .= '      <th>Interface</th>' . PHP_EOL;
        $string .= '      <th>MAC Address</th>' . PHP_EOL;
        $string .= '      <th>Description</th>' . PHP_EOL;
        $string .= '    </tr>' . PHP_EOL;
        $string .= '  </thead>' . PHP_EOL;
    }
    $string .= '  <tbody>' . PHP_EOL;
    foreach ($entries as $entry) {
        if (port_permitted($entry['port_id'])) {
            humanize_port($entry);
            $string .= '  <tr>' . PHP_EOL;
            if ($list['device']) {
                $dev = device_by_id_cache($entry['device_id']);
                $string .= '    <td class="entity" style="white-space: nowrap;">' . generate_device_link($dev) . '</td>' . PHP_EOL;
            }
            if ($entry['ifInErrors_delta'] > 0 || $entry['ifOutErrors_delta'] > 0) {
                $port_error = generate_port_link($entry, '<span class="label label-important">Errors</span>', 'port_errors');
            }
            $string .= '    <td class="entity">' . generate_port_link($entry, short_ifname($entry['label'])) . ' ' . $port_error . '</td>' . PHP_EOL;
            $string .= '    <td style="width: 160px;">' . $entry['human_mac'] . '</td>' . PHP_EOL;
            $string .= '    <td>' . $entry['ifAlias'] . '</td>' . PHP_EOL;
            $string .= '  </tr>' . PHP_EOL;
        }
    }
    $string .= '  </tbody>' . PHP_EOL;
    $string .= '</table>';
    // Print pagination header
    if ($pagination) {
        $string = pagination($vars, $count) . $string . pagination($vars, $count);
    }
    // Print MAC addresses
    echo $string;
}
开发者ID:skive,项目名称:observium,代码行数:99,代码来源:mac_addresses.inc.php



注:本文中的port_permitted函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP portfolio_expected_time_db函数代码示例发布时间:2022-05-15
下一篇:
PHP popup_tree_menu函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap