Commit ae95cf92 authored by Ad Schellevis's avatar Ad Schellevis

whitespace firewall_nat_edit.php

parent 8f02b7ac
...@@ -35,46 +35,45 @@ require_once("pfsense-utils.inc"); ...@@ -35,46 +35,45 @@ require_once("pfsense-utils.inc");
* build array with interface options for this form * build array with interface options for this form
*/ */
function formInterfaces() { function formInterfaces() {
global $config; global $config;
$interfaces = array(); $interfaces = array();
foreach ( get_configured_interface_with_descr(false, true) as $if => $ifdesc) foreach ( get_configured_interface_with_descr(false, true) as $if => $ifdesc)
$interfaces[$if] = $ifdesc; $interfaces[$if] = $ifdesc;
if (isset($config['l2tp']['mode']) && $config['l2tp']['mode'] == "server") if (isset($config['l2tp']['mode']) && $config['l2tp']['mode'] == "server")
$interfaces['l2tp'] = "L2TP VPN"; $interfaces['l2tp'] = "L2TP VPN";
if (isset($config['pptpd']['mode']) && $config['pptpd']['mode'] == "server") if (isset($config['pptpd']['mode']) && $config['pptpd']['mode'] == "server")
$interfaces['pptp'] = "PPTP VPN"; $interfaces['pptp'] = "PPTP VPN";
if (is_pppoe_server_enabled()) if (is_pppoe_server_enabled())
$interfaces['pppoe'] = "PPPoE VPN"; $interfaces['pppoe'] = "PPPoE VPN";
/* add ipsec interfaces */ /* add ipsec interfaces */
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable']))
$interfaces["enc0"] = "IPsec"; $interfaces["enc0"] = "IPsec";
/* add openvpn/tun interfaces */ /* add openvpn/tun interfaces */
if (isset($config['openvpn']['openvpn-server']) || isset($config['openvpn']['openvpn-client'])) { if (isset($config['openvpn']['openvpn-server']) || isset($config['openvpn']['openvpn-client'])) {
$interfaces['openvpn'] = 'OpenVPN'; $interfaces['openvpn'] = 'OpenVPN';
} }
return $interfaces; return $interfaces;
} }
/** /**
* fetch list of selectable networks to use in form * fetch list of selectable networks to use in form
*/ */
function formNetworks() { function formNetworks() {
$networks = array();
$networks = array(); $networks["any"] = gettext("any");
$networks["any"] = gettext("any"); $networks["pptp"] = gettext("PPTP clients");
$networks["pptp"] = gettext("PPTP clients"); $networks["pppoe"] = gettext("PPPoE clients");
$networks["pppoe"] = gettext("PPPoE clients"); $networks["l2tp"] = gettext("L2TP clients");
$networks["l2tp"] = gettext("L2TP clients"); foreach (get_configured_interface_with_descr() as $ifent => $ifdesc) {
foreach (get_configured_interface_with_descr() as $ifent => $ifdesc) { $networks[$ifent] = htmlspecialchars($ifdesc) . " " . gettext("net");
$networks[$ifent] = htmlspecialchars($ifdesc) . " " . gettext("net"); $networks[$ifent."ip"] = htmlspecialchars($ifdesc). " ". gettext("address");
$networks[$ifent."ip"] = htmlspecialchars($ifdesc). " ". gettext("address"); }
} return $networks;
return $networks;
} }
/** /**
...@@ -84,14 +83,14 @@ function formNetworks() { ...@@ -84,14 +83,14 @@ function formNetworks() {
$specialsrcdst = explode(" ", "any (self) pptp pppoe l2tp openvpn"); $specialsrcdst = explode(" ", "any (self) pptp pppoe l2tp openvpn");
$ifdisp = get_configured_interface_with_descr(); $ifdisp = get_configured_interface_with_descr();
foreach ($ifdisp as $kif => $kdescr) { foreach ($ifdisp as $kif => $kdescr) {
$specialsrcdst[] = "{$kif}"; $specialsrcdst[] = "{$kif}";
$specialsrcdst[] = "{$kif}ip"; $specialsrcdst[] = "{$kif}ip";
} }
// init config and get reference // init config and get reference
if (!isset($config['nat']['rule']) || !is_array($config['nat']['rule'])) { if (!isset($config['nat']['rule']) || !is_array($config['nat']['rule'])) {
$config['nat']['rule'] = array(); $config['nat']['rule'] = array();
} }
$a_nat = &$config['nat']['rule']; $a_nat = &$config['nat']['rule'];
...@@ -170,9 +169,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -170,9 +169,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$id = $_POST['id']; $id = $_POST['id'];
} }
if (isset($pconfig['after']) && isset($a_nat[$pconfig['after']])) { if (isset($pconfig['after']) && isset($a_nat[$pconfig['after']])) {
// place record after provided sequence number // place record after provided sequence number
$after = $pconfig['after']; $after = $pconfig['after'];
} }
/* Validate input data */ /* Validate input data */
foreach ($pconfig as $key => $value) { foreach ($pconfig as $key => $value) {
...@@ -299,13 +298,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -299,13 +298,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Create a rule or if we want to create a new one // Create a rule or if we want to create a new one
if( $natent['associated-rule-id']=='new' ) { if( $natent['associated-rule-id']=='new' ) {
$need_filter_rule = true; $need_filter_rule = true;
unset( $natent['associated-rule-id'] ); unset($natent['associated-rule-id']);
$pconfig['filter-rule-association']='add-associated'; $pconfig['filter-rule-association']='add-associated';
} }
// If creating a new rule, where we want to add the filter rule, associated or not // If creating a new rule, where we want to add the filter rule, associated or not
else if( isset($pconfig['filter-rule-association']) && else if (isset($pconfig['filter-rule-association']) && ($pconfig['filter-rule-association']=='add-associated' ||
($pconfig['filter-rule-association']=='add-associated' || $pconfig['filter-rule-association']=='add-unassociated')
$pconfig['filter-rule-association']=='add-unassociated') ) )
$need_filter_rule = true; $need_filter_rule = true;
if ($need_filter_rule) { if ($need_filter_rule) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment