Project

General

Profile

« Previous | Next » 

Revision 58325912

Added by Stilez y almost 9 years ago

Simplify another loop

View differences:

src/usr/local/www/firewall_rules_edit.php
305 305
	if (($_POST['ipprotocol'] <> "") && ($_POST['gateway'] <> "")) {
306 306
		if (is_array($config['gateways']['gateway_group'])) {
307 307
			foreach ($config['gateways']['gateway_group'] as $gw_group) {
308
				if ($gw_group['name'] == $_POST['gateway']) {
309
					$family = $a_gatewaygroups[$_POST['gateway']]['ipprotocol'];
310
					if ($_POST['ipprotocol'] == $family) {
311
						continue;
312
					}
313
					if (($_POST['ipprotocol'] == "inet46") && ($_POST['ipprotocol'] != $family)) {
308
				if ($gw_group['name'] == $_POST['gateway'] && $_POST['ipprotocol'] != $a_gatewaygroups[$_POST['gateway']]['ipprotocol']) {
309
					if ($_POST['ipprotocol'] == "inet46") {
314 310
						$input_errors[] = gettext("Gateways can not be assigned in a rule that applies to both IPv4 and IPv6.");
315
					}
316
					if (($_POST['ipprotocol'] == "inet6") && ($_POST['ipprotocol'] != $family)) {
311
					} elseif ($_POST['ipprotocol'] == "inet6") {
317 312
						$input_errors[] = gettext("An IPv4 gateway group can not be assigned in IPv6 rules.");
318
					}
319
					if (($_POST['ipprotocol'] == "inet") && ($_POST['ipprotocol'] != $family)) {
313
					} elseif ($_POST['ipprotocol'] == "inet") {
320 314
						$input_errors[] = gettext("An IPv6 gateway group can not be assigned in IPv4 rules.");
321 315
					}
322 316
				}

Also available in: Unified diff