diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2008-01-30 00:51:44 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2008-01-30 00:51:44 +0000 |
commit | f3c709591962bc9c1c5f30d2e806702299f22063 (patch) | |
tree | afbdab7df419535a3b326d13e651be31eb5bc854 | |
parent | ae2aefedb60d7a55ffb253335b87cd245a509773 (diff) | |
download | pfsense-packages-f3c709591962bc9c1c5f30d2e806702299f22063.tar.gz pfsense-packages-f3c709591962bc9c1c5f30d2e806702299f22063.tar.bz2 pfsense-packages-f3c709591962bc9c1c5f30d2e806702299f22063.zip |
Only iterate items if the variable is an array.
-rw-r--r-- | packages/openbgpd/openbgpd.inc | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/packages/openbgpd/openbgpd.inc b/packages/openbgpd/openbgpd.inc index 6404e81e..14a9a28d 100644 --- a/packages/openbgpd/openbgpd.inc +++ b/packages/openbgpd/openbgpd.inc @@ -85,30 +85,34 @@ function openbgpd_install_conf() { } // Handle neighbors that do not have a group assigned to them - foreach($openbgpd_neighbors as $neighbor) { - $used_this_item = false; - if($neighbor['groupname'] == "") { - $conffile .= " neighbor {$neighbor['neighbor']} {\n"; - $conffile .= " descr \"{$neighbor['descr']}\"\n"; - $used_this_item = true; - foreach($neighbor['row'] as $row) { - $conffile .= " {$row['paramaters']} {$row['parmvalue']} \n"; + if(is_array($openbgpd_neighbors)) { + foreach($openbgpd_neighbors as $neighbor) { + $used_this_item = false; + if($neighbor['groupname'] == "") { + $conffile .= " neighbor {$neighbor['neighbor']} {\n"; + $conffile .= " descr \"{$neighbor['descr']}\"\n"; + $used_this_item = true; + foreach($neighbor['row'] as $row) { + $conffile .= " {$row['paramaters']} {$row['parmvalue']} \n"; + } + if($used_this_item) + $conffile .= " }\n"; } - if($used_this_item) - $conffile .= " }\n"; } - } - if($used_this_item) - $conffile .= "}\n"; + if($used_this_item) + $conffile .= "}\n"; + } // OpenBGPD filters $conffile .= "deny from any\n"; $conffile .= "deny to any\n"; - foreach($openbgpd_neighbors as $neighbor) { - $conffile .= "allow from {$neighbor['neighbor']}\n"; - $conffile .= "allow to {$neighbor['neighbor']}\n"; + if(is_array($openbgpd_neighbors)) { + foreach($openbgpd_neighbors as $neighbor) { + $conffile .= "allow from {$neighbor['neighbor']}\n"; + $conffile .= "allow to {$neighbor['neighbor']}\n"; + } } - + // Write out the configuration file fwrite($fd, "# This file was created by the pfSense package manager. Do not edit!\n\n"); fwrite($fd, $conffile); |