本文整理汇总了PHP中get_staticroutes函数的典型用法代码示例。如果您正苦于以下问题:PHP get_staticroutes函数的具体用法?PHP get_staticroutes怎么用?PHP get_staticroutes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_staticroutes函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gettext
$input_errors[] = gettext("You specified an IPv6 prefix ID that is out of range.") . " ({$_POST['track6-interface']}) - (0) - (" . sprintf('%x', $_POST['ipv6-num-prefix-ids-' . $_POST['track6-interface']]) . ")";
} else {
foreach ($ifdescrs as $ifent => $ifdescr) {
if ($if == $ifent) {
continue;
}
if ($config['interfaces'][$ifent]['ipaddrv6'] == 'track6' && $config['interfaces'][$ifent]['track6-interface'] == $_POST['track6-interface'] && $config['interfaces'][$ifent]['track6-prefix-id'] == $track6_prefix_id) {
$input_errors[] = sprintf(gettext("This track6 prefix ID is already being used in %s."), $ifdescr);
}
}
}
}
break;
}
/* normalize MAC addresses - lowercase and convert Windows-ized hyphenated MACs to colon delimited */
$staticroutes = get_staticroutes(true);
$_POST['spoofmac'] = strtolower(str_replace("-", ":", $_POST['spoofmac']));
if ($_POST['ipaddr']) {
if (!is_ipaddrv4($_POST['ipaddr'])) {
$input_errors[] = gettext("A valid IPv4 address must be specified.");
} else {
$where_ipaddr_configured = where_is_ipaddr_configured($_POST['ipaddr'], $if, true, true, $_POST['subnet']);
if (count($where_ipaddr_configured)) {
$subnet_conflict_text = sprintf(gettext("IPv4 address %s is being used by or overlaps with:"), $_POST['ipaddr'] . "/" . $_POST['subnet']);
foreach ($where_ipaddr_configured as $subnet_conflict) {
$subnet_conflict_text .= " " . convert_friendly_interface_to_friendly_descr($subnet_conflict['if']) . " (" . $subnet_conflict['ip_or_subnet'] . ")";
}
$input_errors[] = $subnet_conflict_text;
}
/* Do not accept network or broadcast address, except if subnet is 31 or 32 */
if ($_POST['subnet'] < 31) {
示例2: gettext
if ($_POST['network'] && !is_ipaddr($_POST['network']) && !is_alias($_POST['network'])) {
$input_errors[] = gettext("A valid IPv4 or IPv6 destination network must be specified.");
}
if ($_POST['network_subnet'] && !is_numeric($_POST['network_subnet'])) {
$input_errors[] = gettext("A valid destination network bit count must be specified.");
}
if ($_POST['gateway'] && is_ipaddr($_POST['network'])) {
if (!isset($a_gateways[$_POST['gateway']])) {
$input_errors[] = gettext("A valid gateway must be specified.");
}
if (!validate_address_family($_POST['network'], lookup_gateway_ip_by_name($_POST['gateway']))) {
$input_errors[] = gettext("The gateway '{$a_gateways[$_POST['gateway']]['gateway']}' is a different Address Family as network '{$_POST['network']}'.");
}
}
/* check for overlaps */
$current_targets = get_staticroutes(true);
$new_targets = array();
if (is_ipaddrv6($_POST['network'])) {
$osn = Net_IPv6::compress(gen_subnetv6($_POST['network'], $_POST['network_subnet'])) . "/" . $_POST['network_subnet'];
$new_targets[] = $osn;
}
if (is_ipaddr($_POST['network'])) {
if ($_POST['network_subnet'] > 32) {
$input_errors[] = gettext("A IPv4 subnet can not be over 32 bits.");
} else {
$osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
$new_targets[] = $osn;
}
} elseif (is_alias($_POST['network'])) {
$osn = $_POST['network'];
foreach (filter_expand_alias_array($_POST['network']) as $tgt) {