本文整理汇总了PHP中transform2long函数的典型用法代码示例。如果您正苦于以下问题:PHP transform2long函数的具体用法?PHP transform2long怎么用?PHP transform2long使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了transform2long函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_ip
/**
* Format IP address
*/
public function format_ip($result)
{
if (sizeof($result) > 0) {
foreach ($result as $r) {
# ip?
if (isset($r['ip_addr'])) {
$r['ip_addr'] = transform2long($r['ip_addr']);
} elseif (isset($r['subnet'])) {
$r['subnet'] = transform2long($r['subnet']);
}
$out[] = $r;
}
} else {
$out = $result;
}
# formatted
return $out;
}
示例2: updateLogTable
updateLogTable('Range ' . $ip['start'] . ' - ' . $ip['stop'] . ' ' . $ip['action'] . ' successfull!', 'Range ' . $ip['start'] . ' - ' . $ip['stop'] . ' ' . $ip['action'] . ' ' . _('successfull') . '!', 0);
}
} else {
/* unique */
if (isset($_POST['unique'])) {
if ($_POST['unique'] == "1" && strlen($_POST['dns_name']) > 0) {
# check if unique
if (!isHostUnique($_POST['dns_name'])) {
die('<div class="alert alert-danger">' . _('Hostname is not unique') . '!</div>');
}
}
}
/* verify ip address */
if ($ip['action'] == "move") {
$subnet = getSubnetDetailsById($_REQUEST['newSubnet']);
$subnet = transform2long($subnet['subnet']) . "/" . $subnet['mask'];
$verify = VerifyIpAddress($ip['ip_addr'], $subnet, $nostrict);
$ip['newSubnet'] = $_REQUEST['newSubnet'];
} else {
$verify = VerifyIpAddress($ip['ip_addr'], $ip['subnet'], $nostrict);
}
/* if errors are present print them, else execute query! */
if ($verify) {
die('<div class="alert alert-danger">' . _('Error') . ': ' . $verify . ' (' . $ip['ip_addr'] . ')</div>');
} else {
/* set update for update */
$ip['type'] = "single";
/* check for duplicate entry! needed only in case new IP address is added, otherwise the code is locked! */
if ($ip['action'] == "add") {
if (checkDuplicate($ip['ip_addr'], $ip['subnetId'])) {
die('<div class="alert alert-danger">' . _('IP address') . ' ' . $ip['ip_addr'] . ' ' . _('already existing in database') . '!</div>');
示例3: printSubnets
//.........这里部分代码省略.........
}
# request disabled
# hosts check
if ($option['value']['pingSubnet'] == 1) {
$pCheck = "<i class='fa fa-gray fa-check'></i>";
} else {
$pCheck = "";
}
# ping check disabled
#vrf
if ($vrf == "1") {
# get VRF details
if ($option['value']['vrfId'] != "0" && $option['value']['vrfId'] != "NULL") {
$vrfTmp = getVRFDetailsById($option['value']['vrfId']);
$vrfText = $vrfTmp['name'];
} else {
$vrfText = "";
}
}
# print table line
if (strlen($option['value']['subnet']) > 0) {
// verify permission
$permission = checkSubnetPermission($option['value']['id']);
// print item
if ($permission != 0) {
$html[] = "<tr>";
# which level?
if ($count == 1) {
# is folder?
if ($option['value']['isFolder'] == 1) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-pad-right-3 fa-folder-open'></i> <a href='folder/" . $option['value']['sectionId'] . "/" . $option['value']['id'] . "/'> {$description}</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-pad-right-3 fa-folder-open'></i> {$description}</td>";
} else {
# last?
if (!empty($children[$option['value']['id']])) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-folder-open-o'></i><a href='subnets/" . $option['value']['sectionId'] . "/" . $option['value']['id'] . "/'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-folder-open-o'></i> {$description}</td>";
} else {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-angle-right'></i><a href='subnets/" . $option['value']['sectionId'] . "/" . $option['value']['id'] . "/'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-angle-right'></i> {$description}</td>";
}
}
} else {
# is folder?
if ($option['value']['isFolder'] == 1) {
# last?
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-folder-open'></i> <a href='folder/" . $option['value']['sectionId'] . "/" . $option['value']['id'] . "/'> {$description}</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-folder-open'></i> {$description}</td>";
} else {
# last?
if (!empty($children[$option['value']['id']])) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-folder-open-o'></i> <a href='subnets/" . $option['value']['sectionId'] . "/" . $option['value']['id'] . "/'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-folder-open-o'></i> {$description}</td>";
} else {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-angle-right'></i> <a href='subnets/" . $option['value']['sectionId'] . "/" . $option['value']['id'] . "/'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-pad-right-3 fa-angle-right'></i> {$description}</td>";
}
}
}
$html[] = "\t<td>{$vlan}</td>";
#vrf
if ($vrf == "1") {
$html[] = "\t<td class='hidden-xs hidden-sm'>{$vrfText}</td>";
}
$html[] = "\t<td class='hidden-xs hidden-sm'>{$requests}</td>";
$html[] = "\t<td class='hidden-xs hidden-sm'>{$pCheck}</td>";
# custom
if (sizeof($custom) > 0) {
foreach ($custom as $field) {
$html[] = "\t<td class='hidden-xs hidden-sm'>" . $option['value'][$field['name']] . "</td>";
}
}
if ($actions) {
$html[] = "\t<td class='actions' style='padding:0px;'>";
$html[] = "\t<div class='btn-group'>";
if ($option['value']['isFolder'] == 1) {
$html[] = "\t\t<button class='btn btn-xs btn-default add_folder' data-action='edit' data-subnetid='" . $option['value']['id'] . "' data-sectionid='" . $option['value']['sectionId'] . "'><i class='fa fa-gray fa-pencil'></i></button>";
$html[] = "\t\t<button class='btn btn-xs btn-default showSubnetPerm' data-action='show' data-subnetid='" . $option['value']['id'] . "' data-sectionid='" . $option['value']['sectionId'] . "'><i class='fa fa-gray fa-tasks'></i></button>";
$html[] = "\t\t<button class='btn btn-xs btn-default add_folder' data-action='delete' data-subnetid='" . $option['value']['id'] . "' data-sectionid='" . $option['value']['sectionId'] . "'><i class='fa fa-gray fa-times'></i></button>";
} else {
$html[] = "\t\t<button class='btn btn-xs btn-default editSubnet' data-action='edit' data-subnetid='" . $option['value']['id'] . "' data-sectionid='" . $option['value']['sectionId'] . "'><i class='fa fa-gray fa-pencil'></i></button>";
$html[] = "\t\t<button class='btn btn-xs btn-default showSubnetPerm' data-action='show' data-subnetid='" . $option['value']['id'] . "' data-sectionid='" . $option['value']['sectionId'] . "'><i class='fa fa-gray fa-tasks'></i></button>";
$html[] = "\t\t<button class='btn btn-xs btn-default editSubnet' data-action='delete' data-subnetid='" . $option['value']['id'] . "' data-sectionid='" . $option['value']['sectionId'] . "'><i class='fa fa-gray fa-times'></i></button>";
}
$html[] = "\t</div>";
$html[] = "\t</td>";
}
$html[] = "</tr>";
}
}
if ($option === false) {
$parent = array_pop($parent_stack);
} elseif (!empty($children[$option['value']['id']])) {
array_push($parent_stack, $option['value']['masterSubnetId']);
$parent = $option['value']['id'];
} else {
}
}
return implode("\n", $html);
}
示例4: getSubnetDetailsById
if (!($overlap = verifySubnetNesting($subnetOld['masterSubnetId'], transform2long($subnetOld['subnet']) . "/" . $_POST['newMask'])) && $subnetOld['masterSubnetId'] != 0) {
# get master details
$master = getSubnetDetailsById($subnetOld['masterSubnetId']);
$master = Transform2long($master['subnet']) . "/" . $master['mask'] . " - " . $master['description'];
$errors[] = _("New subnet not in master subnet") . "!<br>({$master})";
}
}
/*
* If subnet has slaves make sure all slaves are still inside!
*/
if ($section['strictMode'] == 1) {
$slaves = getAllSlaveSubnetsBySubnetId($_POST['subnetId']);
if (sizeof($slaves) > 0) {
foreach ($slaves as $slave) {
if (!isSubnetInsideSubnet(transform2long($slave['subnet']) . "/" . $slave['mask'], transform2long($subnetOld['subnet']) . "/" . $_POST['newMask'])) {
$errors[] = _("Nested subnet out of new subnet") . "!<br>(" . transform2long($slave['subnet']) . "/{$slave['mask']} - {$slave['description']})";
}
}
}
}
/* if no errors edit! */
if (sizeof($errors) > 0) {
print "<div class='alert alert-danger'><ul>";
foreach ($errors as $error) {
print "<li>{$error}</li>";
}
print "</ul></div>";
} else {
# failed
if (!modifySubnetMask($_POST['subnetId'], $_POST['newMask'])) {
print '<div class="alert alert-danger">' . _('Error resizing subnet') . '!</div>';
示例5: _
<!-- content -->
<div class="pContent">
<form id="subnetSplit">
<table class="table table-noborder table-condensed">
<!-- subnet -->
<tr>
<td class="middle"><?php
print _('Subnet');
?>
</td>
<td><?php
print transform2long($subnet['subnet']) . "/{$subnet['mask']} ({$subnet['description']})";
?>
</td>
</tr>
<!-- number of new subnets -->
<tr>
<td class="middle"><?php
print _('Number of subnets');
?>
</td>
<td style="vertical-align:middle">
<select name="number" class="form-control input-sm input-w-auto">
<?php
foreach ($opts as $line) {
print "<option value='{$line['number']}'>{$line['number']}x /{$line['mask']} subnet ({$line['number']}x {$line['max']} hosts)</option>";
示例6: _
<form class="editipaddress" role="form" name="editipaddress">
<!-- edit IP address table -->
<table id="editipaddress" class="table table-noborder table-condensed">
<!-- IP address -->
<tr>
<td><?php
print _('IP address');
?>
*</td>
<td>
<div class="input-group">
<input type="text" name="ip_addr" class="ip_addr form-control input-sm" value="<?php
print $details['ip_addr'];
if (is_numeric($_POST['stopIP']) > 0) {
print "-" . transform2long($_POST['stopIP']);
}
?>
" placeholder="<?php
print _('IP address');
?>
">
<span class="input-group-addon">
<i class="fa fa-gray fa-info" rel="tooltip" data-html='true' data-placement="left" title="<?php
print _('You can add,edit or delete multiple IP addresses<br>by specifying IP range (e.g. 10.10.0.0-10.10.0.25)');
?>
"></i>
</span>
</div>
<input type="hidden" name="action" value="<?php
示例7: transform2long
$class = $ipVisual[$m]['state'];
$id = (int) $ipVisual[$m]['id'];
$action = 'all-edit';
# tooltip
$title = transform2long($ipVisual[$m]['ip_addr']);
if (strlen($ipVisual[$m]['dns_name']) > 0) {
$title .= "<br>" . $ipVisual[$m]['dns_name'];
}
if (strlen($ipVisual[$m]['desc']) > 0) {
$title .= "<br>" . $ipVisual[$m]['desc'];
}
} else {
# print add
$class = 9;
$id = $m;
$action = 'all-add';
$title = "";
}
# permissions
$permission = checkSubnetPermission($subnetId);
# print box
if ($permission > 1) {
print "<span class='ip-{$class} modIPaddr' data-action='{$action}' rel='tooltip' title='{$title}' data-position='top' data-html='true' data-subnetId='" . $subnetId . "' data-id='{$id}'>." . substr(strrchr(transform2long($m), "."), 1) . "</span>";
} else {
print "<span class='ip-{$class} ' data-action='{$action}' data-subnetId='" . $subnetId . "' data-id='{$id}'>." . substr(strrchr(transform2long($m), "."), 1) . "</span>";
}
}
print "</div>";
print "<div style='clear:both;padding-bottom:20px;'></div>";
# clear float
}
示例8: foreach
# only print if some hosts exist
if (sizeof($subnetHost) > 0) {
?>
<script type="text/javascript">
$(function () {
var data = [
<?php
if (sizeof($subnetHost) > 0) {
$m = 0;
foreach ($subnetHost as $subnet) {
if ($m < $slimit) {
# verify user access
$sp = checkSubnetPermission($subnet['id']);
if ($sp != "0") {
$subnet['subnet'] = transform2long($subnet['subnet']);
$subnet['descriptionLong'] = $subnet['description'];
# odd/even if more than 5 items
if (sizeof($subnetHost) > 5) {
if ($m & 1) {
print "['|<br>" . addslashes($subnet[description]) . "', {$subnet['usage']}, '" . addslashes($subnet[descriptionLong]) . " ({$subnet['subnet']}/{$subnet['mask']})'],";
} else {
print "['" . addslashes($subnet[description]) . "', {$subnet['usage']}, '" . addslashes($subnet[descriptionLong]) . " ({$subnet['subnet']}/{$subnet['mask']})'],";
}
} else {
print "['" . addslashes($subnet[description]) . "', {$subnet['usage']}, '" . addslashes($subnet[descriptionLong]) . " ({$subnet['subnet']}/{$subnet['mask']})'],";
}
# next
$m++;
}
}
示例9: foreach
}
}
// first add to IP table
foreach ($addresses as $k => $ip) {
// try to resolve
$ip['dns_name'] = ResolveDnsName($ip['ip_addr']);
if ($ip['dns_name']['class'] == "resolved") {
$ip['dns_name'] = $ip['dns_name']['name'];
$addresses[$k]['dns_name'] = $ip['dns_name'];
} else {
$ip['dns_name'] = "";
$addresses[$k]['dns_name'] = _("unresolved");
}
// insert
if (!insert_discovered_ip($ip)) {
print "Cannot add discovered IP " . transform2long($ip['ip_addr']) . "\n";
}
}
// all done, mail discovered?
if (sizeof($addresses) > 0 && $email) {
//send text array, cron will do that by default if you don't redirect output > /dev/null 2>&1
if ($emailText) {
print_r($stateDiff);
} else {
$mail['from'] = "{$settings['siteTitle']} <ipam@{$settings['siteDomain']}>";
$mail['headers'] = 'From: ' . $mail['from'] . "\r\n";
$mail['headers'] .= "Content-type: text/html; charset=utf8" . "\r\n";
$mail['headers'] .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
//subject
$mail['subject'] = "phpIPAM new addresses detected " . date("Y-m-d H:i:s");
//header
示例10: _
print "\t<th class='small hidden-xs hidden-sm'>" . _('Requests') . "</th>";
print " <th class='actions'></th>";
print "</tr>";
/* print each slave */
$usedSum = 0;
$allSum = 0;
# for free space check
$slaveSize = sizeof($slaves);
$m = 0;
foreach ($slaves as $slave) {
# check permission
$permission = checkSubnetPermission($slave['id']);
if ($permission > 0) {
print "<tr>";
print "\t<td class='small description'><a href='subnets/{$_REQUEST['section']}/{$slave['id']}/'>{$slave['description']}</a></td>";
print "\t<td><a href='subnets/{$_REQUEST['section']}/{$slave['id']}/'>" . transform2long($slave['subnet']) . "/{$slave['mask']}</a></td>";
# host check
if ($slave['pingSubnet'] == 1) {
print '<td class="allowRequests small hidden-xs hidden-sm">' . _('enabled') . '</td>';
} else {
print '<td class="allowRequests small hidden-xs hidden-sm"></td>';
}
# count IP addresses
$hasSlaves = getAllSlaveSubnetsBySubnetId($slave['id']);
# slaves details are provided with ipaddressprintslaves script
if (sizeof($hasSlaves) > 0) {
$ipCount = sizeof(getIpAddressesBySubnetIdSlavesSort($slave['id']));
} else {
$ipCount = countIpAddressesBySubnetId($slave['id']);
}
//ip count - direct subnet
示例11: transform2long
$change = 'style="border-top:1px dashed white"';
$vlanOld = $vlanNew;
}
print '<tr class="link vlanSearch" ' . $change . ' sectionId="' . $section['id'] . '" subnetId="' . $subnet['id'] . '" link="' . $section['name'] . '|' . $subnet['id'] . '">' . "\n";
/* print first 3 only if change happened! */
if (strlen($change) > 0) {
print ' <td><dd>' . $vlan['name'] . '</dd></td>' . "\n";
print ' <td><dd>' . $vlan['number'] . '</dd></td>' . "\n";
print ' <td><dd>' . $vlan['description'] . '</dd></td>' . "\n";
} else {
print '<td></td>';
print '<td></td>';
print '<td></td>';
}
if ($subnet['id'] != null) {
# subnet
print ' <td>' . transform2long($subnet['subnet']) . '/' . $subnet['mask'] . '</td>' . "\n";
# section
print ' <td>' . $section['name'] . '</td>' . "\n";
} else {
print '<td>---</td>' . "\n";
print '<td>---</td>' . "\n";
}
print '</tr>' . "\n";
}
}
}
}
?>
</table>
示例12: transform2long
}
//admin lock
if ($line['adminLock'] == 1) {
$line['adminLock'] = 'yes';
} else {
$line['adminLock'] = '';
}
//allowRequests
if ($line['allowRequest'] == 1) {
$line['allowRequest'] = 'yes';
} else {
$line['allowRequest'] = '';
}
//print subnet
$worksheet->write($lineCount, 0, $section['name'], $format_left);
$worksheet->write($lineCount, 1, transform2long($line['subnet']));
$worksheet->write($lineCount, 2, $line['mask']);
$worksheet->write($lineCount, 3, $line['description']);
$worksheet->write($lineCount, 4, $line['masterSubnetId']);
$worksheet->write($lineCount, 5, $line['VLAN']);
$worksheet->write($lineCount, 6, $line['allowRequests']);
//new line
$lineCount++;
}
//top border line at bottom of IP addresses
$worksheet->write($lineCount, 0, "", $format_top);
$worksheet->write($lineCount, 1, "", $format_top);
$worksheet->write($lineCount, 2, "", $format_top);
$worksheet->write($lineCount, 3, "", $format_top);
$worksheet->write($lineCount, 4, "", $format_top);
$worksheet->write($lineCount, 5, "", $format_top);
示例13: create_link
case "subnet":
if ($l['isFolder'] == 1) {
$l['ctype'] = "Folder";
} else {
$l['ctype'] = "Subnet";
}
break;
case "section":
$l['ctype'] = "Section";
break;
}
print "<tr>";
print "\t<td>{$l['real_name']}</td>";
print "\t<td>{$l['ctype']}</td>";
# subnet, section or ip address
if ($l['ctype'] == "IP address") {
print "\t<td><a href='" . create_link("subnets", $l['sectionId'], $l['subnetId'], "ipdetails", $l['tid']) . "'>" . transform2long($l['ip_addr']) . "</a></td>";
} elseif ($l['ctype'] == "Subnet") {
print "\t<td><a href='" . create_link("subnets", $l['sectionId'], $l['tid']) . "'>" . transform2long($l['ip_addr']) . "/{$l['mask']}</a></td>";
} elseif ($l['ctype'] == "Folder") {
print "\t<td><a href='" . create_link("folder", $l['sectionId'], $l['tid']) . "'>{$l['sDescription']}</a></td>";
}
print "\t<td>" . _("{$l['caction']}") . "</td>";
print "\t<td>" . _("{$l['cresult']}") . "</td>";
print "\t<td>{$l['cdate']}</td>";
print "\t<td>{$l['cdiff']}</td>";
print "</tr>";
}
}
print "</table>";
}
示例14: writeChangelog
/**
* Write new changelog
*/
function writeChangelog($ctype, $action, $result, $old, $new)
{
/* set query, open db connection and fetch results */
global $database;
# get settings
$settings = getAllSettings();
if ($settings['enableChangelog'] == 1) {
# get user details
$cuser = getActiveUserDetails();
# unset unneeded values and format
if ($ctype == "ip_addr") {
unset($new['action'], $new['subnet'], $new['type']);
} elseif ($ctype == "subnet") {
$new['id'] = $new['subnetId'];
unset($new['action'], $new['subnetId'], $new['location'], $new['vrfIdOld'], $new['permissions']);
# if section does not change
if ($new['sectionId'] == $new['sectionIdNew']) {
unset($new['sectionIdNew']);
unset($new['sectionId']);
unset($old['sectionId']);
} else {
$old['sectionIdNew'] = $old['sectionId'];
}
//transform subnet
if (strlen($new['subnet']) > 0) {
$new['subnet'] = Transform2decimal(substr($new['subnet'], 0, strpos($new['subnet'], "/")));
}
} elseif ($ctype == "section") {
unset($new['action']);
}
# calculate diff
if ($action == "edit") {
//old - checkboxes
foreach ($old as $k => $v) {
if (!isset($new[$k]) && $v == 1) {
$new[$k] = 0;
}
}
foreach ($new as $k => $v) {
//change
if ($old[$k] != $v && $old[$k] != str_replace("\\'", "'", $v)) {
//empty
if (strlen(@$old[$k]) == 0) {
$old[$k] = "NULL";
}
if (strlen(@$v) == 0) {
$v = "NULL";
}
//state
if ($k == 'state') {
$old[$k] = reformatIPStateText($old[$k]);
$v = reformatIPStateText($v);
} elseif ($k == 'sectionIdNew') {
//get old and new device
if ($old[$k] != "NULL") {
$dev = getSectionDetailsById($old[$k]);
$old[$k] = $dev['name'];
}
if ($v != "NULL") {
$dev = getSectionDetailsById($v);
$v = $dev['name'];
}
} elseif ($k == "masterSubnetId") {
if ($old[$k] == 0) {
$old[$k] = "Root";
} else {
$dev = getSubnetDetailsById($old[$k]);
$old[$k] = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
}
if ($v == 0) {
$v = "Root";
} else {
$dev = getSubnetDetailsById($v);
$v = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
}
} elseif ($k == 'switch') {
if ($old[$k] == 0) {
$old[$k] = "None";
} elseif ($old[$k] != "NULL") {
$dev = getDeviceDetailsById($old[$k]);
$old[$k] = $dev['hostname'];
}
if ($v == 0) {
$v = "None";
}
if ($v != "NULL") {
$dev = getDeviceDetailsById($v);
$v = $dev['hostname'];
}
} elseif ($k == 'vlanId') {
//get old and new device
if ($old[$k] == 0) {
$old[$k] = "None";
} elseif ($old[$k] != "NULL") {
$dev = getVLANById($old[$k]);
$old[$k] = $dev['name'] . " [{$dev['number']}]";
}
//.........这里部分代码省略.........
示例15: _
print "\t<th class='hidden-xs hidden-sm'>" . _('Used') . "</th>";
print "\t<th style='width:5px;'></th>";
print "</tr>";
# logs
foreach ($favs as $f) {
# if subnet already removed (doesnt exist) dont print it!
if (sizeof($f) > 0) {
print "<tr class='favSubnet-{$f['subnetId']}'>";
if ($f['isFolder'] == 1) {
print "\t<td><a href='" . create_link("folder", $f['sectionId'], $f['subnetId']) . "'><i class='fa fa-folder fa-sfolder'></i> {$f['description']}</a></td>";
} else {
//master?
if (sizeof(getAllSlaveSubnetsBySubnetId($f['subnetId'])) > 0) {
print "\t<td><a href='" . create_link("subnets", $f['sectionId'], $f['subnetId']) . "'><i class='fa fa-sfolder fa-folder-o'></i>" . transform2long($f['subnet']) . "/{$f['mask']}</a></td>";
} else {
print "\t<td><a href='" . create_link("subnets", $f['sectionId'], $f['subnetId']) . "'><i class='fa fa-sfolder fa-sitemap' ></i> " . transform2long($f['subnet']) . "/{$f['mask']}</a></td>";
}
}
print "\t<td>{$f['description']}</td>";
print "\t<td><a href='" . create_link("folder", $f['sectionId']) . "'>{$f['section']}</a></td>";
if (strlen($f['vlanId']) > 0) {
# get vlan info
$vlan = getVlanById($f['vlanId']);
print "\t<td class='hidden-xs hidden-sm'>{$vlan['number']}</td>";
} else {
print "\t<td class='hidden-xs hidden-sm'>/</td>";
}
# used
# masterSubnet
if ($f['masterSubnetId'] == 0 || empty($f['masterSubnetId'])) {
$masterSubnet = true;