本文整理汇总了PHP中makeshortif函数的典型用法代码示例。如果您正苦于以下问题:PHP makeshortif函数的具体用法?PHP makeshortif怎么用?PHP makeshortif使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeshortif函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>";
?>
示例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>';
示例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&if=" . $interface['port_id'] . '&from=' . $config['time']['day'] . '&to=' . $config['time']['now'] . "&width=100&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'];
}
示例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>";
示例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}&id=" . $port['port_id'] . '&from=' . $config['time']['twoday'] . '&to=' . $config['time']['now'] . "&width=450&height=150\\'>\\\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type={$graph_type}&id=" . $port['port_id'] . '&from=' . $config['time']['twoday'] . '&to=' . $config['time']['now'] . "&width=132&height=40&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>';
示例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 . '&id=' . $port['port_id'] . '&from=' . $from . '&to=' . $config['time']['now'] . "&width=450&height=150\\'>\\\n ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >" . "<img src='graph.php?type=" . $graph_type . '&id=' . $port['port_id'] . '&from=' . $from . '&to=' . $config['time']['now'] . "&width=180&height=45&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>
示例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);
示例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&if=" . $interface['port_id'] . "&from=" . $config['time']['day'] . "&to=" . $config['time']['now'] . "&width=100&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) {
示例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>";
示例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);
示例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>';
示例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';
示例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
示例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>';
}
示例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') {