Commit 9476f748 authored by Franco Fichtner's avatar Franco Fichtner

inc: the usual isset() splatter

parent 4df19f1b
...@@ -734,8 +734,8 @@ function filter_get_vpns_list() { ...@@ -734,8 +734,8 @@ function filter_get_vpns_list() {
/* openvpn */ /* openvpn */
foreach (array('client', 'server') as $type) { foreach (array('client', 'server') as $type) {
if(is_array($config['openvpn']["openvpn-$type"])) { if (isset($config['openvpn']['openvpn-' . $type])) {
foreach ($config['openvpn']["openvpn-$type"] as $settings) { foreach ($config['openvpn']['openvpn-' . $type] as $settings) {
if(is_array($settings)) { if(is_array($settings)) {
if (!isset($settings['disable'])) { if (!isset($settings['disable'])) {
$remote_networks = explode(',', $settings['remote_network']); $remote_networks = explode(',', $settings['remote_network']);
...@@ -1357,19 +1357,23 @@ function filter_nat_rules_automatic_tonathosts($with_descr = false) { ...@@ -1357,19 +1357,23 @@ function filter_nat_rules_automatic_tonathosts($with_descr = false) {
} }
/* add openvpn interfaces */ /* add openvpn interfaces */
if(is_array($config['openvpn']['openvpn-server'])) if (isset($config['openvpn']['openvpn-server'])) {
foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) foreach ($config['openvpn']['openvpn-server'] as $ovpnsrv) {
if (!isset($ovpnsrv['disable']) && !empty($ovpnsrv['tunnel_network'])) { if (!isset($ovpnsrv['disable']) && !empty($ovpnsrv['tunnel_network'])) {
$tonathosts[] = $ovpnsrv['tunnel_network']; $tonathosts[] = $ovpnsrv['tunnel_network'];
$descriptions[] = gettext("OpenVPN server"); $descriptions[] = gettext("OpenVPN server");
} }
}
}
if(is_array($config['openvpn']['openvpn-client'])) if (isset($config['openvpn']['openvpn-client'])) {
foreach ($config['openvpn']['openvpn-client'] as $ovpncli) foreach ($config['openvpn']['openvpn-client'] as $ovpncli) {
if (!isset($ovpncli['disable']) && !empty($ovpncli['tunnel_network'])) { if (!isset($ovpncli['disable']) && !empty($ovpncli['tunnel_network'])) {
$tonathosts[] = $ovpncli['tunnel_network']; $tonathosts[] = $ovpncli['tunnel_network'];
$descriptions[] = gettext("OpenVPN client"); $descriptions[] = gettext("OpenVPN client");
} }
}
}
/* IPsec mode_cfg subnet */ /* IPsec mode_cfg subnet */
if (isset($config['ipsec']['client']['enable']) && if (isset($config['ipsec']['client']['enable']) &&
......
...@@ -1225,13 +1225,19 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg = ...@@ -1225,13 +1225,19 @@ function interface_bring_down($interface = "wan", $destroy = false, $ifacecfg =
*/ */
if ($ifacecfg === false) { if ($ifacecfg === false) {
$ifcfg = $config['interfaces'][$interface]; $ifcfg = $config['interfaces'][$interface];
$ppps = $config['ppps']['ppp']; $ppps = array();
if (isset($config['ppps']['ppp'])) {
$ppps = $config['ppps']['ppp'];
}
$realif = get_real_interface($interface); $realif = get_real_interface($interface);
$realifv6 = get_real_interface($interface, "inet6", true); $realifv6 = get_real_interface($interface, "inet6", true);
} elseif (!is_array($ifacecfg)) { } elseif (!is_array($ifacecfg)) {
log_error(gettext("Wrong parameters used during interface_bring_down")); log_error(gettext("Wrong parameters used during interface_bring_down"));
$ifcfg = $config['interfaces'][$interface]; $ifcfg = $config['interfaces'][$interface];
$ppps = $config['ppps']['ppp']; $ppps = array();
if (isset($config['ppps']['ppp'])) {
$ppps = $config['ppps']['ppp'];
}
$realif = get_real_interface($interface); $realif = get_real_interface($interface);
$realifv6 = get_real_interface($interface, "inet6", true); $realifv6 = get_real_interface($interface, "inet6", true);
} else { } else {
......
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