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

PHP generate_port_url函数代码示例

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

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



在下文中一共展示了generate_port_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: print_navbar

}
$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 . "&amp;id=" . $port['port_id'] . "&amp;from=" . $from . "&amp;to=" . $config['time']['now'] . "&amp;width=450&amp;height=150\\'>\\\n    ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\"  >" . "<img src='graph.php?type=" . $graph_type . "&amp;id=" . $port['port_id'] . "&amp;from=" . $from . "&amp;to=" . $config['time']['now'] . "&amp;width=180&amp;height=45&amp;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;">';
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:ports.inc.php


示例2: str_replace

        if ($hrdevice['hrDeviceType'] == 'hrDeviceNetwork') {
            $int = str_replace('network interface ', '', $hrdevice['hrDeviceDescr']);
            $interface = dbFetchRow('SELECT * FROM ports WHERE device_id = ? AND ifDescr = ?', array($device['device_id'], $int));
            if ($interface['ifIndex']) {
                echo '<td>' . generate_port_link($interface) . '</td>';
                $graph_array['height'] = '20';
                $graph_array['width'] = '100';
                $graph_array['to'] = $config['time']['now'];
                $graph_array['id'] = $interface['port_id'];
                $graph_array['type'] = 'port_bits';
                $graph_array['from'] = $config['time']['day'];
                $graph_array_zoom = $graph_array;
                $graph_array_zoom['height'] = '150';
                $graph_array_zoom['width'] = '400';
                // FIXME click on graph should also link to port, but can't use generate_port_link here...
                $mini_graph = overlib_link(generate_port_url($interface), generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
                echo "<td>{$mini_graph}</td>";
            } else {
                echo '<td>' . stripslashes($hrdevice['hrDeviceDescr']) . '</td>';
                echo '<td></td>';
            }
        } else {
            echo '<td>' . stripslashes($hrdevice['hrDeviceDescr']) . '</td>';
            echo '<td></td>';
        }
    }
    //end if
    echo '<td>' . $hrdevice['hrDeviceType'] . '</td><td>' . $hrdevice['hrDeviceStatus'] . '</td>';
    echo '<td>' . $hrdevice['hrDeviceErrors'] . '</td><td>' . $hrdevice['hrProcessorLoad'] . '</td>';
    echo '</tr>';
}
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:hrdevice.inc.php


示例3: foreach

$ports_disabled = 0;
$ports_down = 0;
$ports_up = 0;
$ports_total = 0;
foreach ($ports as $port) {
    if (port_permitted($port['port_id'], $port['device_id'])) {
        if ($port['ifAdminStatus'] == "down") {
            $ports_disabled++;
        } elseif ($port['ifAdminStatus'] == "up" && $port['ifOperStatus'] == "down") {
            $ports_down++;
        } elseif ($port['ifAdminStatus'] == "up" && $port['ifOperStatus'] == "up") {
            $ports_up++;
        }
        $ports_total++;
        $speed = humanspeed($port['ifSpeed']);
        $type = humanmedia($port['ifType']);
        $ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
        if (isset($port['in_errors']) && $port['in_errors'] > 0 || isset($ports['out_errors']) && $port['out_errors'] > 0) {
            $error_img = generate_port_link($port, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", errors);
        } else {
            $error_img = "";
        }
        $port['in_rate'] = formatRates($port['ifInOctets_rate'] * 8);
        $port['out_rate'] = formatRates($port['ifOutOctets_rate'] * 8);
        $port = ifLabel($port, $device);
        echo "<tr class='ports'>\n          <td width=200 class=list-bold>" . generate_device_link($port, shorthost($port['hostname'], "20")) . "</td>\n          <td width=150 class=list-bold><a class='" . $ifclass . "'href='" . generate_port_url($port) . "'>" . fixIfName($port['label']) . " {$error_img}</td>\n          <td width=110 >{$speed}</td>\n          <td width=100 class=green>" . $port['in_rate'] . "</td>\n          <td width=100 class=blue>" . $port['out_rate'] . "</td>\n          <td width=150>{$type}</td>\n          <td>" . $port['ifAlias'] . "</td>\n        </tr>\n";
    }
}
echo '<tr><td colspan="7">';
echo "<strong>Matched Ports: {$ports_total} ( <span class=green>Up {$ports_up}</span> | <span class=red>Down {$ports_down}</span> | Disabled {$ports_disabled} )</strong>";
echo '</td></tr></table>';
开发者ID:REAP720801,项目名称:librenms,代码行数:31,代码来源:list.inc.php


示例4: generate_port_link

function generate_port_link($port, $text = NULL, $type = NULL, $escape = FALSE)
{
    global $config;
    humanize_port($port);
    //if (!isset($port['html_class'])) { $port['html_class'] = ifclass($port['ifOperStatus'], $port['ifAdminStatus']); }
    //if (!isset($text)) { $text = rewrite_ifname($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)) {
        $text = $port['label'];
    }
    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:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:20,代码来源:port.inc.php


示例5: generate_port_link

function generate_port_link($port, $text = NULL, $type = NULL)
{
    global $config;
    if (isset($port['humanized']) == FALSE) {
        humanize_port($port);
    }
    if (!$text) {
        $text = fixIfName($port['label']);
    }
    if ($type) {
        $port['graph_type'] = $type;
    }
    if (!isset($port['graph_type'])) {
        $port['graph_type'] = 'port_bits';
    }
    $class = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
    if (!isset($port['os'])) {
        $port = array_merge($port, device_by_id_cache($port['device_id']));
    }
    $content = generate_device_link_header($port);
    $content .= generate_port_link_header($port);
    $content .= '<div style="width: 700px">';
    $graph_array['type'] = $port['graph_type'];
    $graph_array['legend'] = "yes";
    $graph_array['height'] = "100";
    $graph_array['width'] = "275";
    $graph_array['to'] = $config['time']['now'];
    $graph_array['from'] = $config['time']['day'];
    $graph_array['id'] = $port['port_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_port_url($port);
    if (port_permitted($port['port_id'], $port['device_id'])) {
        return overlib_link($url, $text, $content, $class);
    } else {
        return fixifName($text);
    }
}
开发者ID:RomanBogachev,项目名称:observium,代码行数:44,代码来源:functions.inc.php


示例6: print_optionbar_end

        echo '</span>';
    }
    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=\\'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 . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . $config['time']['now'] . "&amp;width=450&amp;height=150\\'>\\\n            ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\"  >" . "<img src='graph.php?type=" . $graph_type . '&amp;id=' . $port['port_id'] . '&amp;from=' . $from . '&amp;to=' . $config['time']['now'] . "&amp;width=180&amp;height=45&amp;legend=no'>\n            </a>\n            <div style='font-size: 9px;'>" . truncate(short_port_descr($port['ifAlias']), 32, '') . '</div>
            </div>';
    }
    echo '</div>';
} else {
    if ($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">Port</th>
开发者ID:nokoya,项目名称:librenms,代码行数:31,代码来源:ports.inc.php


示例7: generate_port_url

    }
} else {
    if (dbFetchCell("SELECT COUNT(*) FROM `ports_cbqos` WHERE `port_id` = ?", array($port['port_id']))) {
        $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
    }
}
if (isset($ports_has_ext['mac_accounting'])) {
    if (in_array($port['port_id'], $ports_has_ext['mac_accounting'])) {
        $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
    }
} else {
    if (dbFetchCell("SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?", array($port['port_id']))) {
        $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
    }
}
echo '<tr class="' . $port['row_class'] . '" onclick="location.href=\'' . generate_port_url($port) . '\'" style="cursor: pointer;">
         <td style="width: 1px; background-color: ' . $port['table_tab_colour'] . '; margin: 0px; padding: 0px; width: 10px;"></td>
         <td style="width: 1px;"></td>
         <td style="width: 350px;">';
echo "        <span class='entity-title'>\n              " . generate_port_link($port) . " " . $port['tags'] . "\n           </span><br /><span class=small>" . htmlentities($port['ifAlias']) . "</span>";
if ($port['ifAlias']) {
    echo "<br />";
}
unset($break);
if ($port_details) {
    if (!isset($ports_has_ext['ipv4_addresses']) || in_array($port['port_id'], $ports_has_ext['ipv4_addresses'])) {
        foreach (dbFetchRows("SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip) {
            echo $break . "<a class=small href=\"javascript:popUp('/netcmd.php?cmd=whois&amp;query=" . $ip['ipv4_address'] . "')\">" . $ip['ipv4_address'] . "/" . $ip['ipv4_prefixlen'] . "</a>";
            $break = "<br />";
        }
    }
开发者ID:skive,项目名称:observium,代码行数:31,代码来源:print-interface.inc.php


示例8: highlight_search

         <dt style="padding-left: 10px; text-align: center;">' . $result['icon'] . '</dt>
           <dd><h5>' . highlight_search($name) . '</h5>
             <small>' . $result['hardware'] . ' | ' . $config['os'][$result['os']]['text'] . ' ' . $result['version'] . '
             <br /> ' . highlight_search($result['location']) . ' | ' . $num_ports . 'ports</small></dd>
         </dl>';
     }
     echo "</a></li>";
 }
 /// SEARCH PORTS
 $results = dbFetchRows("SELECT * FROM `ports` " . "LEFT JOIN `devices` ON  `ports`.`device_id` =  `devices`.`device_id` " . "WHERE `ifAlias` LIKE '%" . $queryString . "%' OR `ifDescr` LIKE '%" . $queryString . "%' ORDER BY ifDescr LIMIT 8");
 if (count($results)) {
     echo '<li class="nav-header">Ports found: ' . count($results) . '</li>';
     foreach ($results as $result) {
         echo '<li class="divider" style="margin: 0px;"></li>';
         echo '<li>';
         echo '<a href="' . generate_port_url($result) . '">';
         $name = $result['ifDescr'];
         if (strlen($name) > 35) {
             $name = substr($name, 0, 35) . "...";
         }
         $description = $result['ifAlias'];
         if (strlen($description) > 80) {
             $description = substr($description, 0, 80) . "...";
         }
         /// FIXME : THIS SUCKS
         if ($result['ifAdminStatus'] == "down") {
             $icon = "search-port-disabled";
             $tab_colour = '#009900';
             // FIXME: Why green for ignore? Also see humanize_device()
         } elseif ($result['ifAdminStatus'] == "up" && $result['ifOperStatus'] == "down") {
             $icon = "search-port-down";
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:ajax_search.php


示例9: humanize_port

$port['device_id'] = $device['device_id'];
$port['hostname'] = $device['hostname'];
// Process port properties and generate printable values
humanize_port($port);
$port_adsl = dbFetchRow("SELECT * FROM `ports_adsl` WHERE `port_id` = ?", array($port['port_id']));
if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) {
    $port['tags'] .= generate_port_link($port, '<span class="label label-important">Errors</span>', 'port_errors');
}
if ($port['deleted'] == '1') {
    $port['tags'] .= '<a href="' . generate_url(array('page' => 'deleted-ports')) . '"><span class="label label-important">Deleted</span></a>';
}
if (dbFetchCell("SELECT COUNT(*) FROM `ports_cbqos` WHERE `port_id` = ?", array($port['port_id']))) {
    $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
}
if (dbFetchCell("SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?", array($port['port_id']))) {
    $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
}
echo '<tr class="' . $port['row_class'] . '" valign=top onclick="location.href=\'" . generate_port_url($port) . "/\'" style="cursor: pointer;">
         <td style="width: 1px; background-color: ' . $port['table_tab_colour'] . '; margin: 0px; padding: 0px; width: 10px;"></td>
         <td style="width: 1px;"></td>
         <td valign="top" width="350">';
echo "        <span class=entity-title>\n              " . generate_port_link($port, $port['ifIndex_FIXME'] . "" . $port['label']) . " " . $port['tags'] . "\n           </span><br /><span class=interface-desc>" . $port['ifAlias'] . "</span>";
if ($port['ifAlias']) {
    echo "<br />";
}
unset($break);
if ($port_details) {
    foreach (dbFetchRows("SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip) {
        echo $break . "<a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&amp;query=" . $ip['ipv4_address'] . "')\">" . $ip['ipv4_address'] . "/" . $ip['ipv4_prefixlen'] . "</a>";
        $break = "<br />";
    }
开发者ID:RomanBogachev,项目名称:observium,代码行数:31,代码来源:print-interface.inc.php


示例10: generate_port_link

function generate_port_link($port, $text = NULL, $type = NULL)
{
    global $config;
    humanize_port($port);
    if (!isset($port['html_class'])) {
        $port['html_class'] = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
    }
    if (!isset($text)) {
        $text = rewrite_ifname($port['label']);
    }
    #if (!isset($port['os'])) { $port = array_merge($port, device_by_id_cache($port['device_id'])); }
    $url = generate_port_url($port);
    if (port_permitted($port['port_id'], $port['device_id'])) {
        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:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:18,代码来源:functions.inc.php


示例11: min

                // Ya.. it's not simple
                $count_ipv4 = $query_limit - min(count($results_ipv6), intval($query_limit / 2));
                $results_ipv4 = array_slice($results_ipv4, 0, $count_ipv4);
                $results_ipv6 = array_slice($results_ipv6, 0, $query_limit - $count_ipv4);
            }
            $results = array_merge($results_ipv4, $results_ipv6);
        }
    }
} else {
    $results = array();
}
if (count($results)) {
    foreach ($results as $result) {
        $port = get_port_by_id_cache($result['port_id']);
        $device = device_by_id_cache($port['device_id']);
        $descr = $device['hostname'] . ' | ' . rewrite_ifname($port['port_label']);
        $name = $result['ip_address'] . '/' . $result['ip_prefixlen'];
        if (strlen($name) > 35) {
            $name = substr($name, 0, 35) . "...";
        }
        /// FIXME: once we have alerting, colour this to the sensor's status
        $tab_colour = '#194B7F';
        // FIXME: This colour pulled from functions.inc.php humanize_device, maybe set it centrally in definitions?
        $ip_search_results[] = array('url' => generate_port_url($port), 'name' => $name, 'colour' => $tab_colour, 'icon' => '<i class="oicon-magnifier-zoom-actual"></i>', 'data' => array('', escape_html($descr)));
    }
    // FIXME after array-ization, we're missing "on x ports"; is this important? need to amend the "framework" a little, then.
    // Counter data came from: foreach ($results as $result) {$addr_ports[$result['port_id']][] = $result; }
    // echo('<li class="nav-header">IPs found: '.count($results).' (on '.count($addr_ports).' ports)</li>');
    $search_results['ip-addresses'] = array('descr' => 'IPs found', 'results' => $ip_search_results);
}
// EOF
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ip-addresses.inc.php


示例12: foreach

    echo "</th>";
}
echo "      </tr></thead>";
$ports_disabled = 0;
$ports_down = 0;
$ports_up = 0;
$ports_total = 0;
foreach ($ports as $port) {
    $device = device_by_id_cache($port['device_id']);
    #&$GLOBALS['cache']['devices']['id'][$port['device_id']];
    $ports_total++;
    humanize_port($port);
    $error_img = '';
    if ($port['in_errors'] > 0 || $port['out_errors'] > 0) {
        $error_img = generate_port_link($port, "<img src='images/16/chart_curve_error.png' alt='接口错误' border=0>", 'errors');
    }
    if (in_array($port['port_id'], $cache['ports']['cbqos'])) {
        $error_img .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
    }
    if (in_array($port['port_id'], $cache['ports']['pseudowires'])) {
        $error_img .= '<a href="' . generate_device_url($port, array('tab' => 'pseudowires')) . '"><span class="label label-info">伪流量</span></a>';
    }
    $port['bps_in'] = formatRates($port['ifInOctets_rate'] * 8);
    $port['bps_out'] = formatRates($port['ifOutOctets_rate'] * 8);
    $port['pps_in'] = format_si($port['ifInUcastPkts_rate']) . "pps";
    $port['pps_out'] = format_si($port['ifOutUcastPkts_rate']) . "pps";
    echo "<tr class='ports " . $port['row_class'] . "'>\n          <td class='state-marker'></td>\n          <td></td>\n          <td><span class=entity>" . generate_device_link($device, short_hostname($device['hostname'], "20")) . "</span><br />\n              <span class=em>" . escape_html(truncate($port['location'], 32, "")) . "</span></td>\n\n          <td><span class=entity>" . generate_port_link($port, rewrite_ifname($port['label'])) . " " . $error_img . "</span><br />\n              <span class=em>" . escape_html(truncate($port['ifAlias'], 50, '')) . "</span></td>" . '<td> <i class="icon-circle-arrow-down" style="' . $port['bps_in_style'] . '"></i>  <span class="small" style="' . $port['bps_in_style'] . '">' . formatRates($port['in_rate']) . '</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['bps_out_style'] . '"></i> <span class="small" style="' . $port['bps_out_style'] . '">' . formatRates($port['out_rate']) . '</span><br /></td>' . '<td> <i class="icon-circle-arrow-down" style="' . $port['bps_in_style'] . '"></i>  <span class="small" style="' . $port['bps_in_style'] . '">' . $port['ifInOctets_perc'] . '%</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['bps_out_style'] . '"></i> <span class="small" style="' . $port['bps_out_style'] . '">' . $port['ifOutOctets_perc'] . '%</span><br /></td>' . '<td><i class="icon-circle-arrow-down" style="' . $port['pps_in_style'] . '"></i>  <span class="small" style="' . $port['pps_in_style'] . '">' . format_bi($port['ifInUcastPkts_rate']) . 'pps</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['pps_out_style'] . '"></i> <span class="small" style="' . $port['pps_out_style'] . '">' . format_bi($port['ifOutUcastPkts_rate']) . 'pps</span></td>' . "<td>" . $port['human_speed'] . "<br />" . $port['ifMtu'] . "</td>\n          <td >" . $port['human_type'] . "<br />" . $port['human_mac'] . "</td>\n        </tr>\n";
}
echo '</table>';
echo pagination($vars, $ports_count);
// EOF
开发者ID:rhizalpatrax64bit,项目名称:StacksNetwork,代码行数:31,代码来源:list.inc.php


示例13: generate_port_row

function generate_port_row($port, $vars = array())
{
    global $config, $cache;
    $device = device_by_id_cache($port['device_id']);
    humanize_port($port);
    if (!isset($vars['view'])) {
        $vars['view'] = "basic";
    }
    // Populate $port_adsl if the port has ADSL-MIB data
    if (!isset($cache['ports_option']['ports_adsl']) || in_array($port['port_id'], $cache['ports_option']['ports_adsl'])) {
        $port_adsl = dbFetchRow("SELECT * FROM `ports_adsl` WHERE `port_id` = ?", array($port['port_id']));
    }
    // Populate $port['tags'] with various tags to identify port statuses and features
    // Port Errors
    if ($port['ifInErrors_delta'] > 0 || $port['ifOutErrors_delta'] > 0) {
        $port['tags'] .= generate_port_link($port, '<span class="label label-important">Errors</span>', 'port_errors');
    }
    // Port Deleted
    if ($port['deleted'] == '1') {
        $port['tags'] .= '<a href="' . generate_url(array('page' => 'deleted-ports')) . '"><span class="label label-important">Deleted</span></a>';
    }
    // Port CBQoS
    if (isset($cache['ports_option']['ports_cbqos'])) {
        if (in_array($port['port_id'], $cache['ports_option']['ports_cbqos'])) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
        }
    } else {
        if (dbFetchCell("SELECT COUNT(*) FROM `ports_cbqos` WHERE `port_id` = ?", array($port['port_id']))) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'cbqos')) . '"><span class="label label-info">CBQoS</span></a>';
        }
    }
    // Port MAC Accounting
    if (isset($cache['ports_option']['mac_accounting'])) {
        if (in_array($port['port_id'], $cache['ports_option']['mac_accounting'])) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
        }
    } else {
        if (dbFetchCell("SELECT COUNT(*) FROM `mac_accounting` WHERE `port_id` = ?", array($port['port_id']))) {
            $port['tags'] .= '<a href="' . generate_port_url($port, array('view' => 'macaccounting')) . '"><span class="label label-info">MAC</span></a>';
        }
    }
    // Populated formatted versions of port rates.
    $port['bps_in'] = formatRates($port['ifInOctets_rate'] * 8);
    $port['bps_out'] = formatRates($port['ifOutOctets_rate'] * 8);
    $port['pps_in'] = format_si($port['ifInUcastPkts_rate']) . "pps";
    $port['pps_out'] = format_si($port['ifOutUcastPkts_rate']) . "pps";
    $string = '';
    if ($vars['view'] == "basic" || $vars['view'] == "graphs") {
        $table_cols = '8';
        $string .= '<tr class="' . $port['row_class'] . '">
            <td class="state-marker"></td>
            <td style="width: 1px;"></td>';
        if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
            $table_cols++;
            // Increment table columns by one to make sure graph line draws correctly
            $string .= '    <td style="width: 200px;"><span class="entity">' . generate_device_link($device, short_hostname($device['hostname'], "20")) . '</span><br />
                <span class="em">' . escape_html(truncate($port['location'], 32, "")) . '</span></td>';
        }
        $string .= '    <td><span class="entity">' . generate_port_link($port, rewrite_ifname($port['port_label'])) . ' ' . $port['tags'] . '</span><br />
                <span class="em">' . escape_html(truncate($port['ifAlias'], 50, '')) . '</span></td>' . '<td style="width: 110px;"> <i class="icon-circle-arrow-down" style="' . $port['bps_in_style'] . '"></i>  <span class="small" style="' . $port['bps_in_style'] . '">' . formatRates($port['in_rate']) . '</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['bps_out_style'] . '"></i> <span class="small" style="' . $port['bps_out_style'] . '">' . formatRates($port['out_rate']) . '</span><br /></td>' . '<td style="width: 90px;"> <i class="icon-circle-arrow-down" style="' . $port['bps_in_style'] . '"></i>  <span class="small" style="' . $port['bps_in_style'] . '">' . $port['ifInOctets_perc'] . '%</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['bps_out_style'] . '"></i> <span class="small" style="' . $port['bps_out_style'] . '">' . $port['ifOutOctets_perc'] . '%</span><br /></td>' . '<td style="width: 110px;"><i class="icon-circle-arrow-down" style="' . $port['pps_in_style'] . '"></i>  <span class="small" style="' . $port['pps_in_style'] . '">' . format_bi($port['ifInUcastPkts_rate']) . 'pps</span><br />' . '<i class="icon-circle-arrow-up" style="' . $port['pps_out_style'] . '"></i> <span class="small" style="' . $port['pps_out_style'] . '">' . format_bi($port['ifOutUcastPkts_rate']) . 'pps</span></td>' . '<td style="width: 110px;"><small>' . $port['human_speed'] . '<br />' . $port['ifMtu'] . '</small></td>
            <td ><small>' . $port['human_type'] . '<br />' . $port['human_mac'] . '</small></td>
          </tr>';
    } else {
        if ($vars['view'] == "details" || $vars['view'] == "detail") {
            $table_cols = '9';
            $string .= '<tr class="' . $port['row_class'] . '"';
            if ($vars['tab'] != "port") {
                $string .= ' onclick="openLink(\'' . generate_port_url($port) . '\')" style="cursor: pointer;"';
            }
            $string .= '>';
            $string .= '         <td class="state-marker"></td>
         <td style="width: 1px;"></td>';
            if ($vars['page'] != "device" && $vars['popup'] != TRUE) {
                $table_cols++;
                // Increment table columns by one to make sure graph line draws correctly
                $string .= '    <td width="200"><span class="entity">' . generate_device_link($device, short_hostname($device['hostname'], "20")) . '</span><br />
                <span class="em">' . escape_html(truncate($port['location'], 32, "")) . '</span></td>';
            }
            $string .= '
         <td style="min-width: 250px;">';
            $string .= '        <span class="entity-title">
              ' . generate_port_link($port) . ' ' . $port['tags'] . '
           </span><br /><span class="small">' . escape_html($port['ifAlias']) . '</span>';
            if ($port['ifAlias']) {
                $string .= '<br />';
            }
            unset($break);
            if (!isset($cache['ports_option']['ipv4_addresses']) || in_array($port['port_id'], $cache['ports_option']['ipv4_addresses'])) {
                foreach (dbFetchRows("SELECT * FROM `ipv4_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip) {
                    $string .= $break . generate_popup_link('ip', $ip['ipv4_address'] . '/' . $ip['ipv4_prefixlen'], NULL, 'small');
                    $break = "<br />";
                }
            }
            if (!isset($cache['ports_option']['ipv6_addresses']) || in_array($port['port_id'], $cache['ports_option']['ipv6_addresses'])) {
                foreach (dbFetchRows("SELECT * FROM `ipv6_addresses` WHERE `port_id` = ?", array($port['port_id'])) as $ip6) {
                    $string .= $break . generate_popup_link('ip', $ip6['ipv6_address'] . '/' . $ip6['ipv6_prefixlen'], NULL, 'small');
                    $break = "<br />";
                }
            }
            //$string .= '</span>';
//.........这里部分代码省略.........
开发者ID:Natolumin,项目名称:observium,代码行数:101,代码来源:port.inc.php


示例14: foreach

 *
 * @package    observium
 * @subpackage webui
 * @copyright  (C) 2006-2013 Adam Armstrong, (C) 2013-2016 Observium Limited
 *
 */
// Ports
// Print table of EIGRP interfaces from eigrp_ports.
echo '<table class="table table-hover table-striped-two  table-condensed ">';
echo '<thead>';
echo '<tr><th class="state-marker"></th><th></th><th>Port</th><th>AS</th><th>Peers</th><th>Mean SRTT</th><th>Auth</th></tr>';
echo '</thead>';
echo '<tbody>';
foreach (dbFetchRows("SELECT * FROM `eigrp_ports` WHERE `device_id` = ?", array($device['device_id'])) as $eigrp_port) {
    $port = get_port_by_id($eigrp_port['port_id']);
    echo '<tr class="' . $port['row_class'] . '" onclick="openLink(\'' . generate_port_url($port) . '/\')" style="cursor: pointer;">

          <td class="state-marker"></td>
          <td style="width: 1px;"></td>
          <td><span class="entity-title">' . generate_port_link($port) . '</span><br />
                                 ' . $port['ifAlias'] . '</td>
          <td>' . $eigrp_port['eigrp_as'] . '</td>
          <td>' . $eigrp_port['eigrp_peer_count'] . '</td>
          <td>' . $eigrp_port['eigrp_MeanSrtt'] . '</td>
          <td>' . $eigrp_port['eigrp_authmode'] . '</td>
        </tr>
        <tr>
          <td colspan=7>';
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $eigrp_port['eigrp_port_id'];
    $graph_array['type'] = 'eigrpport_packets';
开发者ID:Natolumin,项目名称:observium,代码行数:31,代码来源:ports.inc.php


示例15: array

                         $port_colour = '#808080';
                     } else {
                         if ($result['deleted'] == 0 && $result['ifOperStatus'] == 'down' && $result['ifAdminStatus'] == 'up' && $result['ignore'] == 0 && $result['ignore'] == 0) {
                             // Down ports
                             $port_colour = '#ff0000';
                         } else {
                             if ($result['deleted'] == 0 && $result['ifOperStatus'] == 'up' && $result['ignore'] == 0 && $result['ignore'] == 0) {
                                 // Up ports
                                 $port_colour = '#008000';
                             }
                         }
                     }
                 }
             }
             //end if
             $ports[] = array('count' => count($results), 'url' => generate_port_url($result), 'name' => $name, 'description' => $description, 'colours' => $highlight_colour, 'hostname' => $result['hostname'], 'port_id' => $result['port_id']);
         }
         //end foreach
     }
     //end if
     $json = json_encode($ports);
     die($json);
 } else {
     if ($_REQUEST['type'] == 'bgp') {
         // Search bgp peers
         if (is_admin() === true || is_read() === true) {
             $results = dbFetchRows("SELECT `bgpPeers`.*,`devices`.* FROM `bgpPeers` LEFT JOIN `devices` ON  `bgpPeers`.`device_id` =  `devices`.`device_id` WHERE `astext` LIKE '%" . $search . "%' OR `bgpPeerIdentifier` LIKE '%" . $search . "%' OR `bgpPeerRemoteAs` LIKE '%" . $search . "%' ORDER BY `astext` LIMIT " . $limit);
         } else {
             $results = dbFetchRows("SELECT `bgpPeers`.*,`D`.* FROM `bgpPeers`, `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` AND  `bgpPeers`.`device_id`=`D`.`device_id` AND  (`astext` LIKE '%" . $search . "%' OR `bgpPeerIdentifier` LIKE '%" . $search . "%' OR `bgpPeerRemoteAs` LIKE '%" . $search . "%') ORDER BY `astext` LIMIT " . $limit, array($_SESSION['user_id']));
         }
         if (count($results)) {
开发者ID:pblasquez,项目名称:librenms,代码行数:31,代码来源:ajax_search.php


示例16: generate_port_link

function generate_port_link($port, $text = NULL, $type = NULL)
{
    global $config;
    $port = ifNameDescr($port);
    if (!$text) {
        $text = fixIfName($port['label']);
    }
    if ($type) {
        $port['graph_type'] = $type;
    }
    if (!isset($port['graph_type'])) {
        $port['graph_type'] = 'port_bits';
    }
    $class = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
    if (!isset($port['hostname'])) {
        $port = array_merge($port, device_by_id_cache($port['device_id']));
    }
    $content = "<div class=list-large>" . $port['hostname'] . " - " . fixifName($port['label']) . "</div>";
    if ($port['ifAlias']) {
        $content .= $port['ifAlias'] . "<br />";
    }
    $content .= "<div style=\\'width: 850px\\'>";
    $graph_array['type'] = $port['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'] = $port['port_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_port_url($port);
    if (port_permitted($port['port_id'], $port['device_id'])) {
        return overlib_link($url, $text, $content, $class);
    } else {
        return fixifName($text);
    }
}
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:44,代码来源:functions.inc.php


示例17: dbFetchRows

 #  $debug=1;
 // Query addresses
 $results = dbFetchRows($query, $param);
 if (count($results)) {
     $found = 1;
     foreach ($results a 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP generate_query_permitted函数代码示例发布时间:2022-05-15
下一篇:
PHP generate_port_link函数代码示例发布时间: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