From ca6da31484767e293b1547b73bf243a62ed50c6e Mon Sep 17 00:00:00 2001 From: Chris Buechler Date: Sun, 2 Mar 2008 04:55:27 +0000 Subject: [PATCH] don't foreach if it isn't an array (maybe temp fix while I'm working through other issues) --- etc/inc/filter.inc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index b20538da79..f9b061a489 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -1671,24 +1671,27 @@ function generate_user_filter_rule($rule, $ngcounter) { $rg = rtrim($rg); } elseif ($config['interfaces'][$rule['interface']]['gateway'] <> "") { $rgwy = $config['interfaces'][$rule['interface']]['gateway']; - foreach($config['gateways']['gateway_item'] as $gwy) { - if ($gwy['name'] == $rgw) { + if (is_array($config['gateways']['gateway_item'])) { + foreach($config['gateways']['gateway_item'] as $gwy) { + if ($gwy['name'] == $rgw) { $rg = $gwy['gateway']; break; } - } + } + } } /* do not process reply-to for gateway'd rules */ if(($rule['gateway'] == "") and (stristr($rule['interface'],"opt") == true)) { - foreach($config['gateways']['gateway_item'] as $gwy) { - if ($gwy['name'] == $config['interfaces'][$rule['interface']]['gateway']) { - $rg = $gwy['gateway']; - $aline['reply'] = "reply-to (" . $ri . " " . $rg . ") "; - break; - } - } - + if (is_array($config['gateways']['gateway_item'])) { + foreach($config['gateways']['gateway_item'] as $gwy) { + if ($gwy['name'] == $config['interfaces'][$rule['interface']]['gateway']) { + $rg = $gwy['gateway']; + $aline['reply'] = "reply-to (" . $ri . " " . $rg . ") "; + break; + } + } + } } /* if user has selected a custom gateway, lets work with it */