diff options
author | Scott Ullrich <sullrich@sullrich-MacBookPro.geekgod.com> | 2009-06-15 16:58:29 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@sullrich-MacBookPro.geekgod.com> | 2009-06-15 16:58:29 -0400 |
commit | 8aabf022b6b303d9b11ce2e029f238da9c5f303d (patch) | |
tree | d902c12ba8ec0f3e76f5113d9df71c0af25db689 /config | |
parent | f056939073d7edaf2d8e516c1335dcc0233c4973 (diff) | |
download | pfsense-packages-8aabf022b6b303d9b11ce2e029f238da9c5f303d.tar.gz pfsense-packages-8aabf022b6b303d9b11ce2e029f238da9c5f303d.tar.bz2 pfsense-packages-8aabf022b6b303d9b11ce2e029f238da9c5f303d.zip |
Handle case of no ipsec tunnels (clear foreach() error)
Diffstat (limited to 'config')
-rw-r--r-- | config/lcdproc/lcdproc_client.php | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/config/lcdproc/lcdproc_client.php b/config/lcdproc/lcdproc_client.php index e391f2ce..b39f6e01 100644 --- a/config/lcdproc/lcdproc_client.php +++ b/config/lcdproc/lcdproc_client.php @@ -258,29 +258,31 @@ $activecounter = 0; $inactivecounter = 0; - - foreach ($config['ipsec']['tunnel'] as $tunnel){ - $ipsecstatus = false; - $tun_disabled = "false"; - $foundsrc = false; - $founddst = false; + if($config['ipsec']['tunnel']) { + foreach ($config['ipsec']['tunnel'] as $tunnel){ + $ipsecstatus = false; + + $tun_disabled = "false"; + $foundsrc = false; + $founddst = false; - if (isset($tunnel['disabled'])) { - $tun_disabled = "true"; - continue; - } + if (isset($tunnel['disabled'])) { + $tun_disabled = "true"; + continue; + } - if(output_ipsec_tunnel_status($tunnel)) { - /* tunnel is up */ - $iconfn = "true"; - $activecounter++; - } else { - /* tunnel is down */ - $iconfn = "false"; - $inactivecounter++; - } + if(output_ipsec_tunnel_status($tunnel)) { + /* tunnel is up */ + $iconfn = "true"; + $activecounter++; + } else { + /* tunnel is down */ + $iconfn = "false"; + $inactivecounter++; + } + } } if (is_array($config['ipsec']['tunnel'])) { |