Project

General

Profile

« Previous | Next » 

Revision 7e2237f6

Added by timdufrane over 12 years ago

Clean inconsistent "none" and empty conventions for advanced fields - removes residual "none" entries on save

View differences:

usr/local/www/firewall_rules_edit.php
169 169
	$pconfig['gateway'] = $a_filter[$id]['gateway'];
170 170
	
171 171
	/* Shaper support */
172
	$pconfig['defaultqueue'] = $a_filter[$id]['defaultqueue'];
173
	$pconfig['ackqueue'] = $a_filter[$id]['ackqueue'];
174
	$pconfig['dnpipe'] = $a_filter[$id]['dnpipe'];
175
	$pconfig['pdnpipe'] = $a_filter[$id]['pdnpipe'];
176
	$pconfig['l7container'] = $a_filter[$id]['l7container'];
172
	$pconfig['defaultqueue'] = (($a_filter[$id]['ackqueue'] == "none") ? '' : $a_filter[$id]['defaultqueue']);
173
	$pconfig['ackqueue'] = (($a_filter[$id]['ackqueue'] == "none") ? '' : $a_filter[$id]['ackqueue']);
174
	$pconfig['dnpipe'] = (($a_filter[$id]['dnpipe'] == "none") ? '' : $a_filter[$id]['dnpipe']);
175
	$pconfig['pdnpipe'] = (($a_filter[$id]['pdnpipe'] == "none") ? '' : $a_filter[$id]['pdnpipe']);
176
	$pconfig['l7container'] = (($a_filter[$id]['l7container'] == "none") ? '' : $a_filter[$id]['l7container']);
177 177

  
178 178
	//schedule support
179
	$pconfig['sched'] = $a_filter[$id]['sched'];
180
	$pconfig['vlanprio'] = $a_filter[$id]['vlanprio'];
181
	$pconfig['vlanprioset'] = $a_filter[$id]['vlanprioset'];
179
	$pconfig['sched'] = (($a_filter[$id]['sched'] == "none") ? '' : $a_filter[$id]['sched']);
180
	$pconfig['vlanprio'] = (($a_filter[$id]['vlanprio'] == "none") ? '' : $a_filter[$id]['vlanprio']);
181
	$pconfig['vlanprioset'] = (($a_filter[$id]['vlanprioset'] == "none") ? '' : $a_filter[$id]['vlanprioset']);
182 182
	if (!isset($_GET['dup']))
183 183
		$pconfig['associated-rule-id'] = $a_filter[$id]['associated-rule-id'];
184 184

  
......
441 441
		if( $_POST['proto'] != "tcp" )
442 442
			$input_errors[] = gettext("OS detection is only valid with protocol tcp.");
443 443

  
444
	if ($_POST['ackqueue'] && $_POST['ackqueue'] != "none") {
445
		if ($_POST['defaultqueue'] == "none" )
444
	if ($_POST['ackqueue'] != "") {
445
		if ($_POST['defaultqueue'] == "" )
446 446
			$input_errors[] = gettext("You have to select a queue when you select an acknowledge queue too.");
447 447
		else if ($_POST['ackqueue'] == $_POST['defaultqueue'])
448 448
			$input_errors[] = gettext("Acknowledge queue and Queue cannot be the same.");		
449 449
	}
450
	if (isset($_POST['floating']) && $_POST['pdnpipe'] != "none" && (empty($_POST['direction']) || $_POST['direction'] == "any"))
450
	if (isset($_POST['floating']) && $_POST['pdnpipe'] != "" && (empty($_POST['direction']) || $_POST['direction'] == "any"))
451 451
		$input_errors[] = gettext("You can not use limiters in Floating rules without choosing a direction.");
452 452
	if (isset($_POST['floating']) && $_POST['gateway'] != "" && (empty($_POST['direction']) || $_POST['direction'] == "any"))
453 453
		$input_errors[] = gettext("You can not use gateways in Floating rules without choosing a direction.");
454
	if ($_POST['pdnpipe'] && $_POST['pdnpipe'] != "none") {
455
		if ($_POST['dnpipe'] == "none" )
454
	if ($_POST['pdnpipe'] && $_POST['pdnpipe'] != "") {
455
		if ($_POST['dnpipe'] == "" )
456 456
			$input_errors[] = gettext("You must select a queue for the In direction before selecting one for Out too.");
457 457
		else if ($_POST['pdnpipe'] == $_POST['dnpipe'])
458 458
			$input_errors[] = gettext("In and Out Queue cannot be the same.");
......
465 465
	}
466 466
	if( !empty($_POST['ruleid']) && !ctype_digit($_POST['ruleid']))
467 467
		$input_errors[] = gettext('ID must be an integer');
468
	if($_POST['l7container'] && $_POST['l7container'] != "none") {
468
	if($_POST['l7container'] && $_POST['l7container'] != "") {
469 469
		if(!($_POST['proto'] == "tcp" || $_POST['proto'] == "udp" || $_POST['proto'] == "tcp/udp"))
470 470
			$input_errors[] = gettext("You can only select a layer7 container for TCP and/or UDP protocols");
471 471
		if ($_POST['type'] <> "pass")
......
598 598
			$filterent['gateway'] = $_POST['gateway'];
599 599
		}
600 600
		
601
		if (isset($_POST['defaultqueue']) && $_POST['defaultqueue'] != "none") {
601
		if ($_POST['defaultqueue'] != "") {
602 602
			$filterent['defaultqueue'] = $_POST['defaultqueue'];
603
			if (isset($_POST['ackqueue']) && $_POST['ackqueue'] != "none")
603
			if ($_POST['ackqueue'] != "")
604 604
				$filterent['ackqueue'] = $_POST['ackqueue'];
605 605
		}
606 606

  
607
		if (isset($_POST['dnpipe']) && $_POST['dnpipe'] != "none") {
607
		if ($_POST['dnpipe'] != "") {
608 608
			$filterent['dnpipe'] = $_POST['dnpipe'];
609
			if (isset($_POST['pdnpipe']) && $_POST['pdnpipe'] != "none")
609
			if ($_POST['pdnpipe'] != "")
610 610
				$filterent['pdnpipe'] = $_POST['pdnpipe'];
611 611
		}
612 612

  
613
		if (isset($_POST['l7container']) && $_POST['l7container'] != "none") {
613
		if ($_POST['l7container'] != "") {
614 614
			$filterent['l7container'] = $_POST['l7container'];
615 615
		}
616 616
		
......
1439 1439
<?php
1440 1440
		if (!is_array($dnqlist))
1441 1441
			$dnqlist = array();
1442
		echo "<option value=\"none\"";
1442
		echo "<option value=\"\"";
1443 1443
		if (!$dnqselected) echo " selected=\"selected\"";
1444 1444
		echo " >none</option>";
1445 1445
		foreach ($dnqlist as $dnq => $dnqkey) {
......
1457 1457
			<select name="pdnpipe">
1458 1458
<?php
1459 1459
		$dnqselected = 0;
1460
		echo "<option value=\"none\"";
1460
		echo "<option value=\"\"";
1461 1461
		if (!$dnqselected) echo " selected=\"selected\"";
1462 1462
		echo " >none</option>";
1463 1463
		foreach ($dnqlist as $dnq => $dnqkey) {
......
1489 1489
<?php
1490 1490
			if (!is_array($qlist))
1491 1491
				$qlist = array();
1492
			echo "<option value=\"none\"";
1492
			echo "<option value=\"\"";
1493 1493
			if (!$qselected) echo " selected=\"selected\"";
1494 1494
			echo " >none</option>";
1495 1495
			foreach ($qlist as $q => $qkey) {
......
1510 1510
				<select name="defaultqueue">
1511 1511
<?php
1512 1512
			$qselected = 0;
1513
			echo "<option value=\"none\"";
1513
			echo "<option value=\"\"";
1514 1514
			if (!$qselected) echo " selected=\"selected\"";
1515 1515
			echo " >none</option>";
1516 1516
			foreach ($qlist as $q => $qkey) {
......
1544 1544
<?php
1545 1545
					if (!is_array($l7clist))
1546 1546
						$l7clist = array();
1547
					echo "<option value=\"none\"";
1547
					echo "<option value=\"\"";
1548 1548
					echo " >none</option>";
1549 1549
					foreach ($l7clist as $l7ckey) {
1550 1550
						echo "<option value=\"{$l7ckey}\"";

Also available in: Unified diff