本文整理匯總了PHP中Subnets::fetch_subnet_slaves方法的典型用法代碼示例。如果您正苦於以下問題:PHP Subnets::fetch_subnet_slaves方法的具體用法?PHP Subnets::fetch_subnet_slaves怎麽用?PHP Subnets::fetch_subnet_slaves使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Subnets
的用法示例。
在下文中一共展示了Subnets::fetch_subnet_slaves方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: DNS
if ($sort['direction'] == "asc") {
$sort['directionNext'] = "desc";
} else {
$sort['directionNext'] = "asc";
}
# subnet-related variables
$subnet = (array) $Subnets->fetch_subnet(null, $_POST['subnetId']);
//subnet details
$subnet_detailed = $Subnets->get_network_boundaries($subnet['subnet'], $subnet['mask']);
//set network boundaries
$slaves = $Subnets->has_slaves($subnet['id']) ? true : false;
//check if subnet has slaves and set slaves flag true/false
# fetch all addresses - sorted
if ($slaves) {
$addresses = $Addresses->fetch_subnet_addresses_recursive($subnet['id'], false, $sort['field'], $sort['direction']);
$slave_subnets = (array) $Subnets->fetch_subnet_slaves($subnet['id']);
} else {
$addresses = $Addresses->fetch_subnet_addresses($subnet['id'], $sort['field'], $sort['direction']);
}
# set permissions
$subnet_permission = $Subnets->check_permission($User->user, $subnet['id']);
}
# We need DNS object
$DNS = new DNS($Database, $User->settings);
/* verifications */
# checks
if (sizeof($subnet) == 0) {
$Result->show("danger", _('Subnet does not exist'), true);
}
//subnet doesnt exist
if ($subnet_permission == 0) {
示例2: elseif
} elseif (!isset($out)) {
print "<hr>";
print "<blockquote style='margin-top:20px;margin-left:20px;'>";
print "<p>" . _("No subnet selected for threshold check available") . "</p>";
print "<small>" . _("No subnet with threshold check available") . "</small>";
print "</blockquote>";
} else {
print "<div class='hContent' style='padding:10px;'>";
// count usage
foreach ($out as $k => $s) {
//check if subnet has slaves and set slaves flag true/false
$slaves = $Subnets->has_slaves($s->id) ? true : false;
# fetch all addresses and calculate usage
if ($slaves) {
$addresses = $Addresses->fetch_subnet_addresses_recursive($s->id, false);
$slave_subnets = (array) $Subnets->fetch_subnet_slaves($s->id);
// save count
$addresses_cnt = gmp_strval(sizeof($addresses));
# full ?
if (sizeof($slave_subnets) > 0) {
foreach ($slave_subnets as $ss) {
if ($ss->isFull == 1) {
# calculate max
$max_hosts = $Subnets->get_max_hosts($ss->mask, $Subnets->identify_address($ss->subnet), true);
# count
$count_hosts = $Addresses->count_subnet_addresses($ss->id);
# add
$addresses_cnt = gmp_strval(gmp_add($addresses_cnt, gmp_sub($max_hosts, $count_hosts)));
}
}
}