本文整理汇总了PHP中get_configured_interface_with_descr函数的典型用法代码示例。如果您正苦于以下问题:PHP get_configured_interface_with_descr函数的具体用法?PHP get_configured_interface_with_descr怎么用?PHP get_configured_interface_with_descr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_configured_interface_with_descr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formInterfaces
/**
* build array with interface options for this form
*/
function formInterfaces()
{
global $config;
$interfaces = array();
foreach (get_configured_interface_with_descr(false, true) as $if => $ifdesc) {
$interfaces[$if] = $ifdesc;
}
if (isset($config['l2tp']['mode']) && $config['l2tp']['mode'] == "server") {
$interfaces['l2tp'] = "L2TP VPN";
}
if (isset($config['pptpd']['mode']) && $config['pptpd']['mode'] == "server") {
$interfaces['pptp'] = "PPTP VPN";
}
if (is_pppoe_server_enabled()) {
$interfaces['pppoe'] = "PPPoE VPN";
}
/* add ipsec interfaces */
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) {
$interfaces["enc0"] = "IPsec";
}
/* add openvpn/tun interfaces */
if (isset($config['openvpn']['openvpn-server']) || isset($config['openvpn']['openvpn-client'])) {
$interfaces['openvpn'] = 'OpenVPN';
}
return $interfaces;
}
示例2: easyrule_find_rule_interface
function easyrule_find_rule_interface($int)
{
global $config;
/* Borrowed from firewall_rules.php */
$iflist = get_configured_interface_with_descr(false, true);
if (isset($config['pptpd']['mode']) && $config['pptpd']['mode'] == "server") {
$iflist['pptp'] = "PPTP VPN";
}
if (isset($config['pppoe']['mode']) && $config['pppoe']['mode'] == "server") {
$iflist['pppoe'] = "PPPoE VPN";
}
if (isset($config['l2tp']['mode']) && $config['l2tp']['mode'] == "server") {
$iflist['l2tp'] = "L2TP VPN";
}
/* add ipsec interfaces */
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) {
$iflist["enc0"] = "IPSEC";
}
if (isset($iflist[$int])) {
return $int;
}
foreach ($iflist as $if => $ifd) {
if (strtolower($int) == strtolower($ifd)) {
return $if;
}
}
if (substr($int, 0, 4) == "ovpn") {
return "openvpn";
}
return false;
}
示例3: formNetworks
/**
* fetch list of selectable networks to use in form
*/
function formNetworks()
{
$networks = array();
$networks["any"] = gettext("any");
$networks["pptp"] = gettext("PPTP clients");
$networks["pppoe"] = gettext("PPPoE clients");
$networks["l2tp"] = gettext("L2TP clients");
foreach (get_configured_interface_with_descr() as $ifent => $ifdesc) {
$networks[$ifent] = htmlspecialchars($ifdesc) . " " . gettext("net");
$networks[$ifent . "ip"] = htmlspecialchars($ifdesc) . " " . gettext("address");
}
return $networks;
}
示例4: get_interfacestatus
function get_interfacestatus()
{
$data = "";
global $config;
//build interface list for widget use
$ifdescrs = get_configured_interface_with_descr();
foreach ($ifdescrs as $ifdescr => $ifname) {
$ifinfo = get_interface_info($ifdescr);
$data .= $ifname . ",";
if ($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") {
$data .= "up";
} else {
if ($ifinfo['status'] == "no carrier") {
$data .= "down";
} else {
if ($ifinfo['status'] == "down") {
$data .= "block";
}
}
}
$data .= ",";
if ($ifinfo['ipaddr']) {
$data .= htmlspecialchars($ifinfo['ipaddr']);
}
$data .= ",";
if ($ifinfo['status'] != "down") {
$data .= htmlspecialchars($ifinfo['media']);
}
$data .= "~";
}
return $data;
}
示例5: Form_StaticText
$section->addInput(new Form_StaticText('Associated filter rule', '<span class="help-block">' . 'This is associated with a NAT rule.<br/>' . 'You cannot edit the interface, protocol, source, or destination of associated filter rules.' . $extra . '</span>'));
$form->addGlobal(new Form_Input('associated-rule-id', null, 'hidden', $pconfig['associated-rule-id']));
if (!empty($pconfig['interface'])) {
$form->addGlobal(new Form_Input('interface', null, 'hidden', $pconfig['interface']));
}
}
$interfaces = array();
// add group interfaces
if (is_array($config['ifgroups']['ifgroupentry'])) {
foreach ($config['ifgroups']['ifgroupentry'] as $ifgen) {
if (have_ruleint_access($ifgen['ifname'])) {
$interfaces[$ifgen['ifname']] = $ifgen['ifname'];
}
}
}
foreach (get_configured_interface_with_descr() as $ifent => $ifdesc) {
if (have_ruleint_access($ifent)) {
$interfaces[$ifent] = $ifdesc;
}
}
if ($config['l2tp']['mode'] == "server" && have_ruleint_access("l2tp")) {
$interfaces['l2tp'] = 'L2TP VPN';
}
if (is_pppoe_server_enabled() && have_ruleint_access("pppoe")) {
$interfaces['pppoe'] = "PPPoE Server";
}
// add ipsec interfaces
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']) && have_ruleint_access("enc0")) {
$interfaces["enc0"] = "IPsec";
}
// add openvpn/tun interfaces
示例6: get_configured_interface_with_descr
?>
<?php
echo $spane;
?>
</td>
<td class="listr" onclick="fr_toggle(<?php
echo $i;
?>
)" id="frd<?php
echo $i;
?>
">
<?php
echo $spans;
if ($ph1ent['interface']) {
$iflabels = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list();
foreach ($carplist as $cif => $carpip) {
$iflabels[$cif] = $carpip . " (" . get_vip_descr($carpip) . ")";
}
$aliaslist = get_configured_ip_aliases_list();
foreach ($aliaslist as $aliasip => $aliasif) {
$iflabels[$aliasip] = $aliasip . " (" . get_vip_descr($aliasip) . ")";
}
$grouplist = return_gateway_groups_array();
foreach ($grouplist as $name => $group) {
if ($group[0]['vip'] != "") {
$vipif = $group[0]['vip'];
} else {
$vipif = $group[0]['int'];
}
示例7: build_bridge_list
function build_bridge_list()
{
$list = array();
$serverbridge_interface['none'] = "none";
$serverbridge_interface = array_merge($serverbridge_interface, get_configured_interface_with_descr());
$carplist = get_configured_carp_interface_list();
foreach ($carplist as $cif => $carpip) {
$serverbridge_interface[$cif . '|' . $carpip] = $carpip . " (" . get_vip_descr($carpip) . ")";
}
$aliaslist = get_configured_ip_aliases_list();
foreach ($aliaslist as $aliasip => $aliasif) {
$serverbridge_interface[$aliasif . '|' . $aliasip] = $aliasip . " (" . get_vip_descr($aliasip) . ")";
}
foreach ($serverbridge_interface as $iface => $ifacename) {
$list[$iface] = htmlspecialchars($ifacename);
}
return $list;
}
示例8: get_configured_interface_with_descr
?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<section class="col-xs-12">
<div class="content-box">
<div class="table-responsive">
<table class="table table-striped">
<?php
$i = 0;
$ifdescrs = get_configured_interface_with_descr(false, true);
foreach ($ifdescrs as $ifdescr => $ifname) {
$ifinfo = get_interface_info($ifdescr);
// Load MAC-Manufacturer table
$mac_man = load_mac_manufacturer_table();
?>
<thead>
<tr>
<th colspan="2" class="listtopic">
<?php
echo htmlspecialchars($ifname);
?>
<?php
echo gettext("interface");
?>
示例9: mwexec
##|*DESCR=Allow access to the 'Firewall: Traffic Shaper' page.
##|*MATCH=firewall_shaper.php*
##|-PRIV
require "guiconfig.inc";
require_once "functions.inc";
require_once "filter.inc";
require_once "shaper.inc";
require_once "rrd.inc";
if ($_GET['reset'] != "") {
/* XXX: Huh, why are we killing php? */
mwexec("killall -9 pfctl php");
exit;
}
$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"));
$statusurl = "status_queues.php";
$shaperIFlist = get_configured_interface_with_descr();
read_altq_config();
/*
* The whole logic in these code maybe can be specified.
* If you find a better way contact me :).
*/
if ($_GET) {
if ($_GET['queue']) {
$qname = trim($_GET['queue']);
}
if ($_GET['interface']) {
$interface = htmlspecialchars(trim($_GET['interface']));
}
if ($_GET['action']) {
$action = htmlspecialchars($_GET['action']);
}
示例10: build_if_list
function build_if_list()
{
$list = array();
$interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list();
foreach ($carplist as $cif => $carpip) {
$interfaces[$cif . '|' . $carpip] = $carpip . " (" . get_vip_descr($carpip) . ")";
}
$aliaslist = get_configured_ip_aliases_list();
foreach ($aliaslist as $aliasip => $aliasif) {
$interfaces[$aliasif . '|' . $aliasip] = $aliasip . " (" . get_vip_descr($aliasip) . ")";
}
$grouplist = return_gateway_groups_array();
foreach ($grouplist as $name => $group) {
if ($group['ipprotocol'] != inet) {
continue;
}
if ($group[0]['vip'] != "") {
$vipif = $group[0]['vip'];
} else {
$vipif = $group[0]['int'];
}
$interfaces[$name] = "GW Group {$name}";
}
$interfaces['lo0'] = "Localhost";
$interfaces['any'] = "any";
foreach ($interfaces as $iface => $ifacename) {
$list[$iface] = $ifacename;
}
return $list;
}
示例11: Form_Select
$section->addInput(new Form_Select('bogonsinterval', 'Update Frequency', empty($pconfig['bogonsinterval']) ? 'monthly' : $pconfig['bogonsinterval'], array('monthly' => gettext('Monthly'), 'weekly' => gettext('Weekly'), 'daily' => gettext('Daily'))))->setHelp('The frequency of updating the lists of IP addresses that are ' . 'reserved (but not RFC 1918) or not yet assigned by IANA.');
$form->add($section);
if (count($config['interfaces']) > 1) {
$section = new Form_Section('Network Address Translation');
if (isset($config['system']['disablenatreflection'])) {
$value = 'disable';
} elseif (!isset($config['system']['enablenatreflectionpurenat'])) {
$value = 'proxy';
} else {
$value = 'purenat';
}
$section->addInput(new Form_Select('natreflection', 'NAT Reflection mode for port forwards', $value, array('disable' => gettext('disabled'), 'proxy' => gettext('NAT + proxy'), 'purenat' => gettext('Pure NAT'))))->setHelp('</span><ul class="help-block"><li>The pure NAT mode uses a set of NAT rules to direct ' . 'packets to the target of the port forward. It has better scalability, ' . 'but it must be possible to accurately determine the interface and ' . 'gateway IP used for communication with the target at the time the ' . 'rules are loaded. There are no inherent limits to the number of ports ' . 'other than the limits of the protocols. All protocols available for ' . 'port forwards are supported.</li><li>The NAT + proxy mode uses a ' . 'helper program to send packets to the target of the port forward. ' . 'It is useful in setups where the interface and/or gateway IP used ' . 'for communication with the target cannot be accurately determined at ' . 'the time the rules are loaded. Reflection rules are not created for ' . 'ranges larger than 500 ports and will not be used for more than 1000 ' . 'ports total between all port forwards. Only TCP and UDP protocols are ' . 'supported.</li></ul><span class="help-block">Individual rules may be configured to override ' . 'this system setting on a per-rule basis.');
$section->addInput(new Form_Input('reflectiontimeout', 'Reflection Timeout', 'number', $config['system']['reflectiontimeout'], ['min' => 1]))->setHelp('Enter value for Reflection timeout in seconds.<br/>Note: Only ' . 'applies to Reflection on port forwards in NAT + proxy mode.');
$section->addInput(new Form_Checkbox('enablebinatreflection', 'Enable NAT Reflection for 1:1 NAT', 'Automatic creation of additional NAT redirect rules from within the internal networks.', isset($config['system']['enablebinatreflection'])))->setHelp('Note: Reflection on 1:1 mappings is only for the inbound component of ' . 'the 1:1 mappings. This functions the same as the pure NAT mode for port ' . 'forwards. For more details, refer to the pure NAT mode description ' . 'above. Individual rules may be configured to override this system setting on a ' . 'per-rule basis.');
$section->addInput(new Form_Checkbox('enablenatreflectionhelper', 'Enable automatic outbound NAT for Reflection', 'Automatic create outbound NAT rules that direct traffic back out to the same subnet it originated from.', isset($config['system']['enablenatreflectionhelper'])))->setHelp('Required for full functionality of the pure NAT mode of NAT ' . 'Reflection for port forwards or NAT Reflection for 1:1 NAT. Note: This only works ' . 'for assigned interfaces. Other interfaces require manually creating the ' . 'outbound NAT rules that direct the reply packets back through the router.');
$section->addInput(new Form_Select('tftpinterface', 'TFTP Proxy', $pconfig['tftpinterface'], get_configured_interface_with_descr(), true))->setHelp('Choose the interfaces on which to enable TFTP proxy helper.');
$form->add($section);
}
$section = new Form_Section('State Timeouts (seconds - blank for default)');
$tcpTimeouts = array('First', 'Opening', 'Established', 'Closing', 'FIN Wait', 'Closed');
foreach ($tcpTimeouts as $name) {
$keyname = 'tcp' . strtolower(str_replace(" ", "", $name)) . 'timeout';
$section->addInput(new Form_Input($keyname, 'TCP ' . $name, 'number', $config['system'][$keyname]));
}
$udpTimeouts = array('First', 'Single', 'Multiple');
foreach ($udpTimeouts as $name) {
$keyname = 'udp' . strtolower(str_replace(" ", "", $name)) . 'timeout';
$section->addInput(new Form_Input($keyname, 'UDP ' . $name, 'number', $config['system'][$keyname]));
}
$icmpTimeouts = array('First', 'Error');
foreach ($icmpTimeouts as $name) {
示例12: in_array
/>Block</label>
<label><input name="actreject" type="checkbox" value="Reject"
<?php
echo in_array('reject', $include_acts) ? 'checked="checked"' : '';
?>
/>Reject</label>
</div>
</div>
<div class="form-group">
<label for="filterlogentriesinterfaces"
class="col-sm-4 control-label">Filter interface</label>
<div class="col-sm-6 checkbox">
<select name="filterlogentriesinterfaces" class="form-control">
<?php
foreach (array("All" => "ALL") + get_configured_interface_with_descr() as $iface => $ifacename) {
?>
<option value="<?php
echo $iface;
?>
"
<?php
echo $nentriesinterfaces == $iface ? 'selected="selected"' : '';
?>
><?php
echo htmlspecialchars($ifacename);
?>
</option>
<?php
}
?>
示例13: display_row
function display_row($trc, $value, $fieldname, $type, $rowhelper, $size)
{
global $text;
echo "<td>\n";
switch ($type) {
case "input":
echo "<input size='{$size}' name='{$fieldname}{$trc}' id='{$fieldname}{$trc}' class='formfld unknown' value=\"" . htmlspecialchars($value) . "\" />\n";
break;
case "checkbox":
echo "<input size='{$size}' type='checkbox' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' value='ON' " . ($value ? "CHECKED" : "") . " />\n";
break;
case "password":
echo "<input size='{$size}' type='password' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' class='formfld pwd' value=\"" . htmlspecialchars($value) . "\" />\n";
break;
case "textarea":
echo "<textarea rows='2' cols='12' id='{$fieldname}{$trc}' class='formfld unknown' name='{$fieldname}{$trc}'>{$value}</textarea>\n";
case "select":
echo "<select style='height:22px;' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' {$title}>\n";
foreach ($rowhelper['options']['option'] as $rowopt) {
$text .= "<option value='{$rowopt['value']}'>{$rowopt['name']}</option>";
echo "<option value='{$rowopt['value']}'" . ($rowopt['value'] == $value ? " selected=\"selected\"" : "") . ">{$rowopt['name']}</option>\n";
}
echo "</select>\n";
break;
case "interfaces_selection":
$size = $size ? "size=\"{$size}\"" : '';
$multiple = '';
if (isset($rowhelper['multiple'])) {
$fieldname .= '[]';
$multiple = "multiple=\"multiple\"";
}
echo "<select style='height:22px;' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}' {$size} {$multiple}>\n";
$ifaces = get_configured_interface_with_descr();
$additional_ifaces = $rowhelper['add_to_interfaces_selection'];
if (!empty($additional_ifaces)) {
$ifaces = array_merge($ifaces, explode(',', $additional_ifaces));
}
if (is_array($value)) {
$values = $value;
} else {
$values = explode(',', $value);
}
$ifaces["lo0"] = "loopback";
echo "<option><name></name><value></value></option>/n";
foreach ($ifaces as $ifname => $iface) {
$text .= "<option value=\"{$ifname}\">{$iface}</option>";
echo "<option value=\"{$ifname}\" " . (in_array($ifname, $values) ? 'selected="selected"' : '') . ">{$iface}</option>\n";
}
echo "</select>\n";
break;
case "select_source":
echo "<select style='height:22px;' id='{$fieldname}{$trc}' name='{$fieldname}{$trc}'>\n";
if (isset($rowhelper['show_disable_value'])) {
echo "<option value='{$rowhelper['show_disable_value']}'>{$rowhelper['show_disable_value']}</option>\n";
}
$source_url = $rowhelper['source'];
eval("\$pkg_source_txt = &{$source_url};");
foreach ($pkg_source_txt as $opt) {
$source_name = $rowhelper['source_name'] ? $opt[$rowhelper['source_name']] : $opt[$rowhelper['name']];
$source_value = $rowhelper['source_value'] ? $opt[$rowhelper['source_value']] : $opt[$rowhelper['value']];
$text .= "<option value='{$source_value}'>{$source_name}</option>";
echo "<option value='{$source_value}'" . ($source_value == $value ? " selected=\"selected\"" : "") . ">{$source_name}</option>\n";
}
echo "</select>\n";
break;
}
echo "</td>\n";
}
示例14: build_interface_list
function build_interface_list()
{
$interfaces = get_configured_interface_with_descr();
$viplist = get_configured_vip_list();
foreach ($viplist as $vip => $address) {
$interfaces[$vip] = $address;
if (get_vip_descr($address)) {
$interfaces[$vip] .= " (" . get_vip_descr($address) . ")";
}
}
$grouplist = return_gateway_groups_array();
foreach ($grouplist as $name => $group) {
if ($group[0]['vip'] != "") {
$vipif = $group[0]['vip'];
} else {
$vipif = $group[0]['int'];
}
$interfaces[$name] = sprintf(gettext("GW Group %s"), $name);
}
return $interfaces;
}
示例15: gettext
<thead>
<tr>
<th colspan="2"><?php
echo gettext("Track IPv6 Interface");
?>
</th>
</tr>
<tr>
<td width="22%"><a id="help_for_track6-interface" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?php
echo gettext("IPv6 Interface");
?>
</td>
<td width="78%">
<select name='track6-interface' class='selectpicker' data-style='btn-default' >
<?php
foreach (get_configured_interface_with_descr(false, true) as $iface => $ifacename) {
switch ($config['interfaces'][$iface]['ipaddrv6']) {
case "6to4":
case "6rd":
case "dhcp6":
break;
default:
continue 2;
}
?>
<option value="<?php
echo $iface;
?>
" <?php
echo $iface == $pconfig['track6-interface'] ? " selected=\"selected\"" : "";
?>