Commit 318426c6 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

isset() vs !empty(), when the legacy code stores false.... it eventually...

isset() vs !empty(), when the legacy code stores false.... it eventually translates into a missing entry after save, before save, it's set with false....

(cherry picked from commit 3a96c1dd)
(cherry picked from commit e77d568e)
parent 4bfdfc0b
......@@ -44,7 +44,7 @@ function if_ipsec_services()
$services = array();
if (isset($config['ipsec']['enable']) || isset($config['ipsec']['client']['enable'])) {
if (!empty($config['ipsec']['enable']) || !empty($config['ipsec']['client']['enable'])) {
$pconfig = array();
$pconfig['name'] = 'strongswan';
$pconfig['description'] = gettext('IPsec VPN');
......@@ -68,17 +68,17 @@ function if_ipsec_interfaces()
if (isset($config['ipsec']['phase1']) && isset($config['ipsec']['phase2'])) {
foreach ($config['ipsec']['phase1'] as $ph1ent) {
if (isset($ph1ent['disabled'])) {
if (!empty($ph1ent['disabled'])) {
continue;
}
foreach ($config['ipsec']['phase2'] as $ph2ent) {
if (isset($ph2ent['disabled']) || $ph1ent['ikeid'] != $ph2ent['ikeid']) {
if (!empty($ph2ent['disabled']) || $ph1ent['ikeid'] != $ph2ent['ikeid']) {
continue;
}
if ((isset($ph2ent['mobile']) && !isset($config['ipsec']['client']['enable'])) ||
!isset($config['ipsec']['enable'])) {
if ((!empty($ph2ent['mobile']) && empty($config['ipsec']['client']['enable'])) ||
empty($config['ipsec']['enable'])) {
continue;
}
......
......@@ -47,7 +47,7 @@ function if_openvpn_services()
foreach (array('server', 'client') as $mode) {
if (isset($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as $setting) {
if (!isset($setting['disable'])) {
if (empty($setting['disable'])) {
$pconfig = array();
$pconfig['description'] = "OpenVPN {$mode}: " . htmlspecialchars($setting['description']);
$pconfig['pidfile'] = "/var/run/openvpn_{$mode}{$setting['vpnid']}.pid";
......@@ -75,7 +75,7 @@ function if_openvpn_interfaces()
foreach (array('server', 'client') as $mode) {
if (isset($config['openvpn']["openvpn-{$mode}"])) {
foreach ($config['openvpn']["openvpn-{$mode}"] as &$settings) {
if (!isset($settings['disable'])) {
if (empty($settings['disable'])) {
$oic = array('enable' => true);
$oic['if'] = 'openvpn';
$oic['descr'] = 'OpenVPN';
......
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