diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2007-10-19 19:36:41 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2007-10-19 19:36:41 +0000 |
commit | 3b9758deb430321322bfac0d931d8dc093cf23e2 (patch) | |
tree | e9db1aa0a28b8f8965aae782e1a47840917b54be /etc | |
parent | 2be84cfa8882a78444fd4ba9196149dc307834f6 (diff) | |
download | pfsense-3b9758deb430321322bfac0d931d8dc093cf23e2.zip pfsense-3b9758deb430321322bfac0d931d8dc093cf23e2.tar.gz |
Check if array exists
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/pfsense-utils.inc | 10 | ||||
-rw-r--r-- | etc/inc/system.inc | 22 |
2 files changed, 19 insertions, 13 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc index a6a3d1f..5ecdf49 100644 --- a/etc/inc/pfsense-utils.inc +++ b/etc/inc/pfsense-utils.inc @@ -3380,10 +3380,12 @@ function get_interface_gateway($interface) { $gw = file_get_contents("{$g['tmp_path']}/{$realif}_router"); $gw = rtrim($gw); } else { - foreach($config['gateways']['gateway_item'] as $gateway) { - if($gateway['name'] == $gateway['name']) { - $gatewayip = $gateway['gateway']; - $interfacegw = $gateway['interface']; + if(is_array($config['gateways'])) { + foreach($config['gateways']['gateway_item'] as $gateway) { + if($gateway['name'] == $gateway['name']) { + $gatewayip = $gateway['gateway']; + $interfacegw = $gateway['interface']; + } } } $gw = $gatewayip; diff --git a/etc/inc/system.inc b/etc/inc/system.inc index c055874..d58f9e6 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -282,10 +282,12 @@ function system_routing_configure() { } if($dont_add_route == false) { - foreach($config['gateways']['gateway_item'] as $gateway) { - if(isset($gateway['defaultgw'])) { - $gatewayip = $gateway['gateway']; - $interfacegw = $gateway['interface']; + if(is_array($config['gateways'])) { + foreach($config['gateways']['gateway_item'] as $gateway) { + if(isset($gateway['defaultgw'])) { + $gatewayip = $gateway['gateway']; + $interfacegw = $gateway['interface']; + } } } mwexec("/sbin/route add default " . escapeshellarg($gatewayip)); @@ -300,10 +302,12 @@ function system_routing_configure() { } foreach ($config['staticroutes']['route'] as $rtent) { - foreach($config['gateways']['gateway_item'] as $gateway) { - if($rtent['gateway'] == $gateway['name']) { - $gatewayip = $gateway['gateway']; - $interfacegw = $gateway['interface']; + if(is_array($config['gateways'])) { + foreach($config['gateways']['gateway_item'] as $gateway) { + if($rtent['gateway'] == $gateway['name']) { + $gatewayip = $gateway['gateway']; + $interfacegw = $gateway['interface']; + } } } if(isset($rtent['interfacegateway'])) { @@ -1295,4 +1299,4 @@ function enable_watchdog() { } } -?>
\ No newline at end of file +?> |