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

PHP makeshortif函数代码示例

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

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



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

示例1: mysql_query

    $where .= " AND I.ifAlias LIKE '%" . $_POST['ifAlias'] . "%'";
}
if ($_POST['deleted'] || $_GET['type'] == "deleted") {
    $where .= " AND I.deleted = '1'";
}
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id {$where} ORDER BY D.hostname, I.ifIndex";
$query = mysql_query($sql);
echo "<tr class=tablehead><td></td><th>Device</a></th><th>Interface</th><th>Speed</th><th>Media</th><th>Description</th></tr>";
$row = 1;
while ($interface = mysql_fetch_array($query)) {
    if (is_integer($row / 2)) {
        $row_colour = $list_colour_a;
    } else {
        $row_colour = $list_colour_b;
    }
    $speed = humanspeed($interface['ifSpeed']);
    $type = humanmedia($interface['ifType']);
    if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
        $error_img = generateiflink($interface, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", errors);
    } else {
        $error_img = "";
    }
    if (interfacepermitted($interface['interface_id'])) {
        echo "<tr bgcolor={$row_colour}>\n          <td width=5></td>\n          <td width=200 class=list-bold>" . generatedevicelink($interface) . "</td>\n          <td width=150 class=list-bold>" . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . " {$error_img}</td>\n          <td width=110 >{$speed}</td>\n          <td width=200>{$type}</td>\n          <td>" . $interface['ifAlias'] . "</td>\n        </tr>\n";
        $row++;
    }
}
echo "</table>";
?>

开发者ID:kyrisu,项目名称:observernms,代码行数:29,代码来源:ports.php


示例2: makeshortif

                 case 'upkts':
                 case 'nupkts':
                 case 'errors':
                     $port['width'] = '130';
                     $port['height'] = '30';
                     $port['from'] = $config['time']['day'];
                     $port['to'] = $config['time']['now'];
                     $port['bg'] = '#' . $bg;
                     $port['graph_type'] = 'port_' . $_GET['optc'];
                     echo "<div style='display: block; padding: 3px; margin: 3px; min-width: 135px; max-width:135px; min-height:75px; max-height:75px;\n                            text-align: center; float: left; background-color: " . $list_colour_b_b . ";'>\n                                <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . '</div>';
                     print_port_thumbnail($port);
                     echo "<div style='font-size: 9px;'>" . truncate(short_port_descr($port['ifAlias']), 22, '') . '</div>
                         </div>';
                     break;
                 default:
                     echo $seperator . generate_port_link($port, makeshortif($port['ifDescr']));
                     $seperator = ', ';
                     break;
             }
             //end switch
         }
         //end foreach
         echo '</td></tr>';
         $x++;
     }
     //end foreach
     echo '</table></td>';
     $i++;
 }
 //end foreach
 echo '</table></div>';
开发者ID:samyscoub,项目名称:librenms,代码行数:31,代码来源:vrf.inc.php


示例3: truncate

    <span class=list-device-down>Device Down</span> <br />
    <span class=body-date-1>' . truncate($device['location'], 20) . '</span>');
    ++$count_boxes;
}
if (is_admin() === true || is_read() === true) {
    $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1' LIMIT " . $config['front_page_down_box_limit'];
} else {
    $sql = "SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND  I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0' AND `D`.`status` = '1'  LIMIT " . $config['front_page_down_box_limit'];
}
// These things need to become more generic, and more manageable across different frontpages... rewrite inc :>
// Port down boxes
if ($config['warn']['ifdown']) {
    foreach (dbFetchRows($sql) as $interface) {
        if (!$interface['deleted']) {
            $interface = ifNameDescr($interface);
            generate_front_box('alert alert-danger', generate_device_link($interface, shorthost($interface['hostname'])) . "<br />\n        <span class=\"interface-updown\">Port Down</span><br />\n<!--      <img src='graph.php?type=bits&amp;if=" . $interface['port_id'] . '&amp;from=' . $config['time']['day'] . '&amp;to=' . $config['time']['now'] . "&amp;width=100&amp;height=32' /> -->\n        " . generate_port_link($interface, truncate(makeshortif($interface['label']), 13, '')) . ' <br />
        ' . ($interface['ifAlias'] ? '<span class="body-date-1">' . truncate($interface['ifAlias'], 20, '') . '</span>' : ''));
            ++$count_boxes;
        }
    }
}
/*
    FIXME service permissions? seem nonexisting now.. */
// Service down boxes
if (is_admin() === true || is_read() === true) {
    $sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0' AND `D`.`status` = '2' LIMIT " . $config['front_page_down_box_limit'];
    $param[] = '';
} else {
    $sql = "SELECT * FROM services AS S, devices AS D, devices_perms AS P WHERE P.`user_id` = ? AND P.`device_id` = D.`device_id` AND S.`device_id` = D.`device_id` AND S.`service_ignore` = '0' AND S.`service_disabled` = '0' AND S.`service_status` = '0' AND `D`.`status` = '2' LIMIT " . $config['front_page_down_box_limit'];
    $param[] = $_SESSION['user_id'];
}
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:default.php


示例4: foreach

        $bg_colour = $list_colour_a;
    } else {
        $bg_colour = $list_colour_b;
    }
    foreach (dbFetchRows("SELECT * FROM `ports` WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = ?", array($customer['port_descr_descr'])) as $port) {
        $device = device_by_id_cache($port['device_id']);
        unset($class);
        $ifname = fixifname($device['ifDescr']);
        $ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
        if ($device['os'] == "ios") {
            if ($port['ifTrunk']) {
                $vlan = "<span class=box-desc><span class=red>" . $port['ifTrunk'] . "</span></span>";
            } elseif ($port['ifVlan']) {
                $vlan = "<span class=box-desc><span class=blue>VLAN " . $port['ifVlan'] . "</span></span>";
            } else {
                $vlan = "";
            }
        }
        echo "\n           <tr bgcolor='{$bg_colour}'>\n             <td width='7'></td>\n             <td width='250'><span style='font-weight: bold;' class=interface>" . $customer_name . "</span></td>\n             <td width='150'>" . generate_device_link($device) . "</td>\n             <td width='100'>" . generate_port_link($port, makeshortif($port['ifDescr'])) . "</td>\n             <td width='100'>" . $port['port_descr_speed'] . "</td>\n             <td width='100'>" . $port['port_descr_circuit'] . "</td>\n             <td>" . $port['port_descr_notes'] . "</td>\n           </tr>\n         ";
        unset($customer_name);
    }
    echo "<tr bgcolor='{$bg_colour}'><td></td><td colspan=6>";
    $graph_array['type'] = "customer_bits";
    $graph_array['height'] = "100";
    $graph_array['width'] = "220";
    $graph_array['to'] = $config['time']['now'];
    $graph_array['id'] = $customer['port_descr_descr'];
    include "includes/print-graphrow.inc.php";
    echo "</tr>";
}
echo "</table>";
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:customers.inc.php


示例5: dbFetchRows

$traverse_ifvlan = true;
$otherports = dbFetchRows('SELECT * FROM `ports_vlans` AS V, `ports` as P WHERE V.`device_id` = ? AND V.`vlan` = ? AND P.port_id = V.port_id', array($device['device_id'], $vlan['vlan_vlan']));
foreach ($otherports as $otherport) {
    if ($otherport['untagged']) {
        $traverse_ifvlan = false;
    }
    $vlan_ports[$otherport[ifIndex]] = $otherport;
}
if ($traverse_ifvlan) {
    $otherports = dbFetchRows('SELECT * FROM ports WHERE `device_id` = ? AND `ifVlan` = ?', array($device['device_id'], $vlan['vlan_vlan']));
    foreach ($otherports as $otherport) {
        $vlan_ports[$otherport[ifIndex]] = array_merge($otherport, array('untagged' => '1'));
    }
}
ksort($vlan_ports);
foreach ($vlan_ports as $port) {
    $port = ifLabel($port, $device);
    if ($vars['view'] == 'graphs') {
        echo "<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: " . $list_colour_b_b . ";'>\n    <div style='font-weight: bold;'>" . makeshortif($port['ifDescr']) . "</div>\n    <a href='device/device=" . $device['device_id'] . '/tab=port/port=' . $port['port_id'] . "/' onmouseover=\"return overlib('\\\n    <div style=\\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\\'>" . $device['hostname'] . ' - ' . $port['ifDescr'] . '</div>\\
    ' . $port['ifAlias'] . " \\\n    <img src=\\'graph.php?type={$graph_type}&amp;id=" . $port['port_id'] . '&amp;from=' . $config['time']['twoday'] . '&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=' . $config['time']['twoday'] . '&amp;to=' . $config['time']['now'] . "&amp;width=132&amp;height=40&amp;legend=no'>\n    </a>\n    <div style='font-size: 9px;'>" . truncate(short_port_descr($port['ifAlias']), 22, '') . '</div>
   </div>';
    } else {
        echo $vlan['port_sep'] . generate_port_link($port, makeshortif($port['label']));
        $vlan['port_sep'] = ', ';
        if ($port['untagged']) {
            echo '(U)';
        }
    }
}
//end foreach
echo '</td></tr>';
开发者ID:arrmo,项目名称:librenms,代码行数:31,代码来源:print-vlan.inc.php


示例6: print_optionbar_end

    if ($vars['graph'] == $type && $vars['view'] == 'minigraphs') {
        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>
开发者ID:nokoya,项目名称:librenms,代码行数:31,代码来源:ports.inc.php


示例7: generate_port_link

    if (!$ignore) {
        if ($entry['ifInErrors'] > 0 || $entry['ifOutErrors'] > 0) {
            $error_img = generate_port_link($entry, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", port_errors);
        } else {
            $error_img = '';
        }
        $arp_host = dbFetchRow('SELECT * FROM ipv4_addresses AS A, ports AS I, devices AS D WHERE A.ipv4_address = ? AND I.port_id = A.port_id AND D.device_id = I.device_id', array($entry['ipv4_address']));
        if ($arp_host) {
            $arp_name = generate_device_link($arp_host);
        } else {
            unset($arp_name);
        }
        if ($arp_host) {
            $arp_if = generate_port_link($arp_host);
        } else {
            unset($arp_if);
        }
        if ($arp_host['device_id'] == $entry['device_id']) {
            $arp_name = 'Localhost';
        }
        if ($arp_host['port_id'] == $entry['port_id']) {
            $arp_if = 'Local port';
        }
        $response[] = array('mac_address' => formatMac($entry['mac_address']), 'ipv4_address' => $entry['ipv4_address'], 'hostname' => generate_device_link($entry), 'interface' => generate_port_link($entry, makeshortif(fixifname(ifLabel($entry['label'])))) . ' ' . $error_img, 'remote_device' => $arp_name, 'remote_interface' => $arp_if);
    }
    //end if
    unset($ignore);
}
//end foreach
$output = array('current' => $current, 'rowCount' => $rowCount, 'rows' => $response, 'total' => $total);
echo _json_encode($output);
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:arp-search.inc.php


示例8: foreach

    $sql = "SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.status = '0' AND D.ignore = '0'";
}
foreach (dbFetchRows($sql) as $device) {
    generate_front_box("#ffaaaa", "<center><strong>" . generate_device_link($device, shorthost($device['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span> <br />\n      <span class=body-date-1>" . truncate($device['location'], 20) . "</span>\n      </center>");
}
if ($_SESSION['userlevel'] == '10') {
    $sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
} else {
    $sql = "SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND  I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
}
// These things need to become more generic, and more manageable across different frontpages... rewrite inc :>
if ($config['warn']['ifdown']) {
    foreach (dbFetchRows($sql) as $interface) {
        if (!$interface['deleted']) {
            $interface = ifNameDescr($interface);
            generate_front_box("#ffdd99", "<center><strong>" . generate_device_link($interface, shorthost($interface['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />\n<!--      <img src='graph.php?type=bits&amp;if=" . $interface['port_id'] . "&amp;from=" . $config['time']['day'] . "&amp;to=" . $config['time']['now'] . "&amp;width=100&amp;height=32' /> -->\n        <strong>" . generate_port_link($interface, truncate(makeshortif($interface['label']), 13, '')) . "</strong> <br />\n        " . ($interface['ifAlias'] ? '<span class="body-date-1">' . truncate($interface['ifAlias'], 20, '') . '</span>' : '') . "\n        </center>");
        }
    }
}
/* FIXME service permissions? seem nonexisting now.. */
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'";
foreach (dbFetchRows($sql) as $service) {
    generate_front_box("#ffaaaa", "<center><strong>" . generate_device_link($service, shorthost($service['hostname'])) . "</strong><br />\n    <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span>\n    <strong>" . $service['service_type'] . "</strong><br />\n    <span class=body-date-1>" . truncate($interface['ifAlias'], 20) . "</span>\n    </center>");
}
if (isset($config['enable_bgp']) && $config['enable_bgp']) {
    if ($_SESSION['userlevel'] == '10') {
        $sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0";
    } else {
        $sql = "SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND  bgpPeerAdminStatus != 'start' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0";
    }
    foreach (dbFetchRows($sql) as $peer) {
开发者ID:CumulusNetworks,项目名称:cldemo-archive,代码行数:31,代码来源:globe.php


示例9: humanspeed

        }
        if (!match_network($addy . "/" . $mask, $interface['ipv4_address'])) {
            $ignore = 1;
        }
    }
    if (!$ignore) {
        if (is_integer($row / 2)) {
            $row_colour = $list_colour_a;
        } else {
            $row_colour = $list_colour_b;
        }
        $speed = humanspeed($interface['ifSpeed']);
        $type = humanmedia($interface['ifType']);
        list($prefix, $length) = explode("/", $interface['ipv4_network']);
        if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
            $error_img = generateiflink($interface, "<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>", errors);
        } else {
            $error_img = "";
        }
        if (interfacepermitted($interface['interface_id'])) {
            echo '<tr bgcolor="' . $row_colour . '">
          <td class="list-bold">' . generatedevicelink($interface) . '</td>
          <td class="list-bold">' . generateiflink($interface, makeshortif(fixifname($interface['ifDescr']))) . ' ' . $error_img . '</td>
          <td>' . $interface['ipv4_address'] . '/' . $length . '</td>
          <td>' . $interface['ifAlias'] . "</td>\n        </tr>\n";
            $row++;
        }
    }
    unset($ignore);
}
echo "</table>";
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:ipv4.php


示例10: unset

 unset($sub);
 $hostname = $ip['hostname'];
 $real_hostname = $hostname;
 $hostname = str_replace(".vostron.net", "", $hostname);
 list($loc, $host) = explode("-", $hostname);
 if ($host) {
     $hostname = "{$host}.{$loc}.v4.vostron.net";
 } else {
     $host = $loc;
     unset($loc);
     $hostname = "{$host}.v4.vostron.net";
 }
 $interface = $ip['ifDescr'];
 $address = $ip['addr'];
 $cidr = $ip['cidr'];
 $interface = strtolower(makeshortif(fixifname($interface)));
 $interface = str_replace("/", "-", $interface);
 list($interface, $sub) = explode(".", $interface);
 if ($sub) {
     $sub = str_replace(" ", "", $sub);
     $sub = str_replace("aal5", "", $sub);
     $interface = "{$sub}.{$interface}";
 }
 $hostip = trim(gethostbyname($real_hostname));
 if (strstr($hostname, ".vostron.net")) {
     list($first, $second, $third, $fourth) = explode(".", $address);
     $revzone = "{$third}.{$second}.{$first}.in-addr.arpa";
     $reverse = "{$fourth}.{$revzone}";
     $dnsname = "{$interface}.{$hostname}";
     $rev_sql = "SELECT `domain_id` FROM `domains` WHERE domain = '" . $revzone . "'";
     $rev_domain_id = @mysql_result(mysql_query($rev_sql, $dnsdblink), 0);
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:generate-vegadns.php


示例11: foreach

    $port['port_id'] = $if_list;
    include 'includes/print-interface-graphs.inc.php';
    echo '</td></tr>';
    foreach ($ports as $port) {
        $done = 'yes';
        unset($class);
        $port['ifAlias'] = str_ireplace($type . ': ', '', $port['ifAlias']);
        $port['ifAlias'] = str_ireplace('[PNI]', 'Private', $port['ifAlias']);
        $ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']);
        if ($bg == '#ffffff') {
            $bg = '#e5e5e5';
        } else {
            $bg = '#ffffff';
        }
        echo "<tr class='iftype'>\n            <td><span class=list-large>" . generate_port_link($port, $port['port_descr_descr']) . "</span><br />\n            <span class=interface-desc style='float: left;'>" . generate_device_link($port) . ' ' . generate_port_link($port) . ' </span></td>
            <td>' . generate_port_link($port, makeshortif($port['ifDescr'])) . '</td>
            <td>' . $port['port_descr_speed'] . '</td>
            <td>' . $port['port_descr_circuit'] . '</td>
            <td>' . $port['port_descr_notes'] . "</td>\n            </tr>\n            <tr class='iftype'>\n            <td colspan='5'";
        if (dbFetchCell('SELECT count(*) FROM mac_accounting WHERE port_id = ?', array($port['port_id']))) {
            echo "<span style='float: right;'><a href='" . generate_url(array('page' => 'device', 'device' => $port['device_id'], 'tab' => 'port', 'port' => $port['port_id'], 'view' => 'macaccounting')) . "'><img src='images/16/chart_curve.png' align='absmiddle'> MAC Accounting</a></span>";
        }
        echo '<br />';
        if (file_exists(get_port_rrdfile_path($port['hostname'], $port['port_id']))) {
            $graph_type = 'port_bits';
            include 'includes/print-interface-graphs.inc.php';
        }
        echo '</td></tr>';
    }
} else {
    echo 'None found.</td></tr>';
开发者ID:greggcz,项目名称:librenms,代码行数:31,代码来源:iftype.inc.php


示例12: array

<?php

// Generate a list of ports and then call the multi_bits grapher to generate from the list
$i = 0;
if (!is_array($config['customers_descr'])) {
    $config['customers_descr'] = array($config['customers_descr']);
}
$descr_type = "'" . implode("', '", $config['customers_descr']) . "'";
foreach (dbFetchRows('SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` IN (?) AND `port_descr_descr` = ? AND D.device_id = I.device_id', array(array($descr_type), $vars['id'])) as $port) {
    if (is_file($config['rrd_dir'] . '/' . $port['hostname'] . '/port-' . safename($port['ifIndex'] . '.rrd'))) {
        $rrd_filename = $config['rrd_dir'] . '/' . $port['hostname'] . '/port-' . safename($port['ifIndex'] . '.rrd');
        $rrd_list[$i]['filename'] = $rrd_filename;
        $rrd_list[$i]['descr'] = $port['hostname'] . '-' . $port['ifDescr'];
        $rrd_list[$i]['descr_in'] = shorthost($port['hostname']);
        $rrd_list[$i]['descr_out'] = makeshortif($port['ifDescr']);
        $i++;
    }
}
// echo($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd"));
$units = 'bps';
$total_units = 'B';
$colours_in = 'greens';
$multiplier = '8';
$colours_out = 'blues';
$nototal = 1;
$ds_in = 'INOCTETS';
$ds_out = 'OUTOCTETS';
require 'includes/graphs/generic_multi_bits_separated.inc.php';
开发者ID:samyscoub,项目名称:librenms,代码行数:28,代码来源:bits.inc.php


示例13: overlib_link

    echo '<tr>
          <td colspan="4">';
    echo overlib_link($link, $graph, $overlib_content, null);
    echo '  </td>
        </tr>';
    echo '
    <tr>
      <td><img src="images/16/connect.png" align="absmiddle"> ' . $ports['total'] . '</td>
      <td><img src="images/16/if-connect.png" align="absmiddle"> ' . $ports['up'] . '</td>
      <td><img src="images/16/if-disconnect.png" align="absmiddle"> ' . $ports['down'] . '</td>
      <td><img src="images/16/if-disable.png" align="absmiddle"> ' . $ports['disabled'] . '</td>
    </tr>';
    echo '<tr>
          <td colspan="4">';
    $ifsep = '';
    foreach (dbFetchRows("SELECT * FROM `ports` WHERE device_id = ? AND `deleted` != '1'", array($device['device_id'])) as $data) {
        $data = ifNameDescr($data);
        $data = array_merge($data, $device);
        echo "{$ifsep}" . generate_port_link($data, makeshortif(strtolower($data['label'])));
        $ifsep = ', ';
    }
    unset($ifsep);
    echo '  </td>';
    echo '</tr>';
    echo '</table>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
    echo '</div>';
}
//end if
开发者ID:awlx,项目名称:librenms,代码行数:31,代码来源:ports.inc.php


示例14: foreach

            $already = 'yes';
        }
        $i++;
    }
    if (!$already) {
        $nodes[] = $device['device_id'];
    }
}
$sql = "SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'";
foreach (dbFetchRows($sql) as $device) {
    echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffbbbb; margin: 4px;'>\n        <center><strong>" . generate_device_link($device, shorthost($device['hostname'])) . "</strong><br />\n        <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span>\n        <span class=body-date-1>" . truncate($device['location'], 20) . '</span>
        </center></div>';
}
$sql = "SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'";
foreach (dbFetchRows($sql) as $interface) {
    echo "<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>\n        <center><strong>" . generate_device_link($interface, shorthost($interface['hostname'])) . "</strong><br />\n        <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span>\n        <strong>" . generate_port_link($interface, makeshortif($interface['ifDescr'])) . '</strong> <br />
        <span class=body-date-1>' . truncate($interface['ifAlias'], 20) . '</span>
        </center></div>';
}
$sql = "SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'";
foreach (dbFetchRows($sql) as $service) {
    echo "<div style='border: solid 2px #D0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>\n        <center><strong>" . generate_device_link($service, shorthost($service['hostname'])) . "</strong><br />\n        <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span>\n        <strong>" . $service['service_type'] . '</strong><br />
        <span class=body-date-1>' . truncate($interface['ifAlias'], 20) . '</span>
        </center></div>';
}
$sql = "SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id";
foreach (dbFetchRows($sql) as $peer) {
    echo "<div style='border: solid 2px #d0D0D0; float: left; padding: 5px; width: 120px; height: 90px; background: #ffddaa; margin: 4px;'>\n        <center><strong>" . generate_device_link($peer, shorthost($peer['hostname'])) . "</strong><br />\n        <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span>\n        <strong>" . $peer['bgpPeerIdentifier'] . '</strong> <br />
        <span class=body-date-1>AS' . $peer['bgpPeerRemoteAs'] . ' ' . truncate($peer['astext'], 10) . '</span>
        </center></div>';
}
开发者ID:rasssta,项目名称:librenms,代码行数:31,代码来源:example2.php


示例15: mysql_query

if ($_SESSION['userlevel'] == '10') {
    $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
} else {
    $sql = mysql_query("SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.status = '0' AND D.ignore = '0'");
}
while ($device = mysql_fetch_array($sql)) {
    generate_front_box("alert", "<center><strong>" . generatedevicelink($device, shorthost($device['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Device Down</span> <br />\n      <span class=body-date-1>" . truncate($device['location'], 20) . "</span>\n      </center>");
}
if ($_SESSION['userlevel'] == '10') {
    $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
} else {
    $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND  I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
}
while ($interface = mysql_fetch_array($sql)) {
    $interface = ifNameDescr($interface);
    generate_front_box("warn", "<center><strong>" . generatedevicelink($interface, shorthost($interface['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Port Down</span><br />\n<!--      <img src='graph.php?type=bits&if=" . $interface['interface_id'] . "&from={$day}&to={$now}&width=100&height=32' /> -->\n      <strong>" . generateiflink($interface, truncate(makeshortif($interface['label']), 13, '')) . "</strong> <br />\n      " . ($interface['ifAlias'] ? '<span class="body-date-1">' . truncate($interface['ifAlias'], 20, '') . '</span>' : '') . "\n      </center>");
}
/* FIXME service permissions? seem nonexisting now.. */
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
while ($service = mysql_fetch_array($sql)) {
    generate_front_box("alert", "<center><strong>" . generatedevicelink($service, shorthost($service['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>Service Down</span> \n      <strong>" . $service['service_type'] . "</strong><br />\n      <span class=body-date-1>" . truncate($interface['ifAlias'], 20) . "</span>\n      </center>");
}
if ($_SESSION['userlevel'] == '10') {
    $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0");
} else {
    $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0");
}
while ($peer = mysql_fetch_array($sql)) {
    generate_front_box("alert", "<center><strong>" . generatedevicelink($peer, shorthost($peer['hostname'])) . "</strong><br />\n      <span style='font-size: 14px; font-weight: bold; margin: 5px; color: #c00;'>BGP Down</span> \n      <span style='" . (strstr($peer['bgpPeerIdentifier'], ':') ? 'font-size: 10px' : '') . "'><strong>" . $peer['bgpPeerIdentifier'] . "</strong></span><br />\n      <span title='" . $peer['astext'] . "' class=body-date-1>AS" . $peer['bgpPeerRemoteAs'] . " " . truncate($peer['astext'], 10) . "</span>\n      </center>");
}
if ($_SESSION['userlevel'] == '10') {
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:default.php


示例16: get_port_by_id

<?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


示例17: mysql_query

        } else {
            $insert_query = "INSERT INTO `vrfs` (`vrf_oid`,`vrf_name`,`mplsVpnVrfRouteDistinguisher`,`mplsVpnVrfDescription`,`device_id`) ";
            $insert_query .= "VALUES ('" . $vrf['oid'] . "','" . $vrf['name'] . "','" . $vrf['mplsVpnVrfRouteDistinguisher'] . "','" . $vrf['mplsVpnVrfDescription'] . "','" . $device['device_id'] . "')";
            mysql_query($insert_query);
        }
        $vrf_id = @mysql_result(mysql_query("SELECT vrf_id FROM vrfs WHERE `device_id` = '" . $device['device_id'] . "' AND `vrf_oid`='" . $vrf['oid'] . "'"), 0);
        $valid_vrf[$vrf_id] = 1;
        echo "\nRD:" . $vrf['mplsVpnVrfRouteDistinguisher'] . " " . $vrf['name'] . " " . $vrf['mplsVpnVrfDescription'] . " ";
        $ports_oid = ".1.3.6.1.3.118.1.2.1.1.2." . $vrf['oid'];
        $ports = shell_exec($config['snmpwalk'] . " -m MPLS-VPN-MIB -CI -Ln -Osqn -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'] . ":" . $device['port'] . " {$ports_oid}");
        $ports = trim(str_replace($ports_oid . ".", "", $ports));
        #    list($ports) = explode(" ", $ports);
        echo " ( ";
        foreach (explode("\n", $ports) as $if_id) {
            $interface = mysql_fetch_array(mysql_query("SELECT * FROM ports WHERE ifIndex = '{$if_id}' AND device_id = '" . $device['device_id'] . "'"));
            echo makeshortif($interface['ifDescr']) . " ";
            mysql_query("UPDATE ports SET ifVrf = '" . $vrf_id . "' WHERE interface_id = '" . $interface['interface_id'] . "'");
            $if = $interface['interface_id'];
            $valid_vrf_if[$vrf_id][$if] = 1;
        }
        echo ") ";
    }
}
echo "\n";
$sql = "SELECT * FROM ports WHERE device_id = '" . $device['device_id'] . "'";
$data = mysql_query($sql);
while ($row = mysql_fetch_array($data)) {
    $if = $row['interface_id'];
    $vrf_id = $row['ifVrf'];
    if ($row['ifVrf']) {
        if (!$valid_vrf_if[$vrf_id][$if]) {
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:cisco-vrf.inc.php


示例18: str_replace

    $src = str_replace("." . $config['mydomain'], "", $src);
    $dst = str_replace("." . $config['mydomain'], "", $dst);
    $info = "";
    if ($src_speed >= "10000000000") {
        $info .= "color=lightred weight=10 style=\"setlinewidth(8)\"";
    } elseif ($src_speed >= "1000000000") {
        $info .= "color=lightblue weight=5 style=\"setlinewidth(4)\"";
    } elseif ($src_speed >= "100000000") {
        $info .= "color=lightgrey weight=1 style=\"setlinewidth(2)\"";
    } elseif ($src_speed >= "10000000") {
        $info .= "style=\"setlinewidth(1)\" weight=1";
    }
    unset($die);
    $i = 0;
    while ($i < count($linkdone)) {
        $thislink = "{$dst} " . $link_data['dif'] . " {$src} " . $link_data['sif'];
        if ($linkdone[$i] == $thislink) {
            $die = "yes";
        }
        $i++;
    }
    $sif = makeshortif($link_data['sif']);
    $dif = makeshortif($link_data['dif']);
    if (!$die) {
        echo "\"{$src}\" -> \"{$dst}\" [taillabel=\"{$dif}\"  headlabel=\"{$sif}\" arrowhead=dot arrowtail=dot {$info}];\n";
        #       echo("\"$src\" -> \"$dst\" [ arrowhead=none arrowtail=none $info];\n");
        $linkdone[] = "{$src} " . $link_data['sif'] . " {$dst} " . $link_data['dif'];
        $x++;
    }
}
echo "}";
开发者ID:kyrisu,项目名称:observernms,代码行数:31,代码来源:map.php


示例19: foreach


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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