本文整理汇总了PHP中interface_has_gateway函数的典型用法代码示例。如果您正苦于以下问题:PHP interface_has_gateway函数的具体用法?PHP interface_has_gateway怎么用?PHP interface_has_gateway使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了interface_has_gateway函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gettext
} else {
// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
$ignore_posted_dnsgw[$dnsgwname] = true;
}
}
}
}
if (count(array_filter($dnslist)) != count(array_unique(array_filter($dnslist)))) {
$input_errors[] = gettext('Each configured DNS server must have a unique IP address. Remove the duplicated IP.');
}
$direct_networks_list = explode(" ", filter_get_direct_networks_list());
for ($dnscounter = 1; $dnscounter < 5; $dnscounter++) {
$dnsitem = "dns{$dnscounter}";
$dnsgwitem = "dns{$dnscounter}gw";
if ($_POST[$dnsgwitem]) {
if (interface_has_gateway($_POST[$dnsgwitem])) {
foreach ($direct_networks_list as $direct_network) {
if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
$input_errors[] = sprintf(gettext("A gateway can not be assigned to DNS '%s' server which is on a directly connected network."), $_POST[$dnsitem]);
}
}
}
}
}
# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
$_POST['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $_POST['timeservers']);
$_POST['timeservers'] = trim($_POST['timeservers']);
foreach (explode(' ', $_POST['timeservers']) as $ts) {
if (!is_domain($ts)) {
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
}
示例2: foreach
foreach ($ui_databases as $curdatabase) {
if (!stristr($curdatabase, $curcat)) {
continue;
}
$optionc = explode("-", $curdatabase);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
switch ($curoption) {
case "outbound":
/* make sure we do not show the placeholder databases in the outbound view */
if (stristr($curdatabase, "outbound") || stristr($curdatabase, "allgraphs")) {
continue 2;
}
/* only show interfaces with a gateway */
$optionc = "{$optionc['0']}";
if (!interface_has_gateway($optionc)) {
if (!isset($gateways_arr)) {
if (preg_match("/quality/i", $curdatabase)) {
$gateways_arr = return_gateways_array();
} else {
$gateways_arr = array();
}
}
$found_gateway = false;
foreach ($gateways_arr as $gw) {
if ($gw['name'] == $optionc) {
$found_gateway = true;
break;
}
}
if (!$found_gateway) {
示例3: ucwords
?>
<select name='<?php
echo $fldname;
?>
'>
<?php
$interface = "none";
$dnsgw = "dns{$dnscounter}gwint";
if ($pconfig[$dnsgw] == $interface) {
$selected = "selected";
} else {
$selected = "";
}
echo "<option value='{$interface}' {$selected}>" . ucwords($interface) . "</option>\n";
foreach ($interfaces as $interface) {
if (interface_has_gateway($interface)) {
if ($pconfig[$dnsgw] == $interface) {
$selected = "selected";
} else {
$selected = "";
}
$friendly_interface = convert_friendly_interface_to_friendly_descr($interface);
echo "<option value='{$interface}' {$selected}>" . ucwords($friendly_interface) . "</option>\n";
}
}
?>
</select>
<?php
}
?>
</td>
示例4: gettext
if (is_ipaddrv6($pconfig[$dnsname]) && validate_address_family($pconfig[$dnsname], $pconfig[$dnsgwname]) === false) {
$input_errors[] = gettext("You can not specify IPv4 gateway '{$pconfig[$dnsgwname]}' for IPv6 DNS server '{$pconfig[$dnsname]}'");
}
} else {
// The user selected a gateway but did not provide a DNS address. Be nice and set the gateway back to "none".
$ignore_posted_dnsgw[$dnsgwname] = true;
}
}
}
/* XXX cranky low-level call, please refactor */
$direct_networks_list = explode(' ', filter_get_direct_networks_list(filter_generate_optcfg_array()));
for ($dnscounter = 1; $dnscounter < 5; $dnscounter++) {
$dnsitem = "dns{$dnscounter}";
$dnsgwitem = "dns{$dnscounter}gw";
if (!empty($pconfig[$dnsgwitem])) {
if (interface_has_gateway($pconfig[$dnsgwitem])) {
foreach ($direct_networks_list as $direct_network) {
if (ip_in_subnet($_POST[$dnsitem], $direct_network)) {
$input_errors[] = sprintf(gettext("You can not assign a gateway to DNS '%s' server which is on a directly connected network."), $pconfig[$dnsitem]);
}
}
}
}
}
# it's easy to have a little too much whitespace in the field, clean it up for the user before processing.
$pconfig['timeservers'] = preg_replace('/[[:blank:]]+/', ' ', $pconfig['timeservers']);
$pconfig['timeservers'] = trim($pconfig['timeservers']);
foreach (explode(' ', $pconfig['timeservers']) as $ts) {
if (!is_domain($ts)) {
$input_errors[] = gettext("A NTP Time Server name may only contain the characters a-z, 0-9, '-' and '.'.");
}
示例5: get_configured_interface_with_descr
* lets automatically create entries
* for all of the interfaces to make life easier on the pip-o-chap
*/
$ifdescrs = get_configured_interface_with_descr();
foreach ($ifdescrs as $if => $ifdesc) {
if (interface_has_gateway($if)) {
continue;
}
$osipaddr = get_interface_ip($if);
$ossubnet = get_interface_subnet($if);
if (!is_ipaddr($osipaddr) || empty($ossubnet)) {
continue;
}
$osn = gen_subnet($osipaddr, $ossubnet);
foreach ($ifdescrs as $if2 => $ifdesc2) {
if (!interface_has_gateway($if2)) {
continue;
}
$natent = array();
$natent['source']['network'] = "{$osn}/{$ossubnet}";
$natent['dstport'] = "500";
$natent['descr'] = sprintf(gettext('Auto created rule for ISAKMP - %1$s to %2$s'), $ifdesc, $ifdesc2);
$natent['target'] = "";
$natent['interface'] = $if2;
$natent['destination']['any'] = true;
$natent['staticnatport'] = true;
$a_out[] = $natent;
$natent = array();
$natent['source']['network'] = "{$osn}/{$ossubnet}";
$natent['sourceport'] = "";
$natent['descr'] = sprintf(gettext('Auto created rule for %1$s to %2$s'), $ifdesc, $ifdesc2);