Project

General

Profile

« Previous | Next » 

Revision 6e3488e9

Added by Phil Davis over 9 years ago

Code style services dhcp dnsmasq dyndns

View differences:

src/usr/local/www/services_dhcpv6.php
101 101
		$oc = $config['interfaces'][$ifent];
102 102

  
103 103
		if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
104
			(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
104
		    (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
105 105
			continue;
106 106
		}
107 107
		$if = $ifent;
......
160 160
if (is_array($dhcrelaycfg)) {
161 161
	foreach ($dhcrelaycfg as $dhcrelayif => $dhcrelayifconf) {
162 162
		if (isset($dhcrelayifconf['enable']) && isset($iflist[$dhcrelayif]) &&
163
			(!link_interface_to_bridge($dhcrelayif))) {
163
		    (!link_interface_to_bridge($dhcrelayif))) {
164 164
			$dhcrelay_enabled = true;
165 165
		}
166 166
	}
......
210 210
			$input_errors[] = gettext("A valid IPv6 address must be specified for the gateway.");
211 211
		}
212 212
		if (($_POST['dns1'] && !is_ipaddrv6($_POST['dns1'])) ||
213
			($_POST['dns2'] && !is_ipaddrv6($_POST['dns2'])) ||
214
			($_POST['dns3'] && !is_ipaddrv6($_POST['dns3'])) ||
215
			($_POST['dns4'] && !is_ipaddrv6($_POST['dns4']))) {
213
		    ($_POST['dns2'] && !is_ipaddrv6($_POST['dns2'])) ||
214
		    ($_POST['dns3'] && !is_ipaddrv6($_POST['dns3'])) ||
215
		    ($_POST['dns4'] && !is_ipaddrv6($_POST['dns4']))) {
216 216
			$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
217 217
		}
218 218

  
......
229 229
			$input_errors[] = gettext("A valid primary domain name server IPv4 address must be specified for the dynamic domain name.");
230 230
		}
231 231
		if (($_POST['ddnsdomainkey'] && !$_POST['ddnsdomainkeyname']) ||
232
			($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey'])) {
232
		    ($_POST['ddnsdomainkeyname'] && !$_POST['ddnsdomainkey'])) {
233 233
			$input_errors[] = gettext("You must specify both a valid domain key and key name.");
234 234
		}
235 235
		if ($_POST['domainsearchlist']) {
......
281 281

  
282 282
			if (is_ipaddrv6($ifcfgip)) {
283 283
				if ((!is_inrange_v6($_POST['range_from'], $subnet_start, $subnet_end)) ||
284
					(!is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
284
				    (!is_inrange_v6($_POST['range_to'], $subnet_start, $subnet_end))) {
285 285
					$input_errors[] = gettext("The specified range lies outside of the current subnet.");
286 286
				}
287 287
			}
......
308 308
						continue;
309 309
					}
310 310
					if ((inet_pton($map['ipaddrv6']) > $dynsubnet_start) &&
311
						(inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
311
					    (inet_pton($map['ipaddrv6']) < $dynsubnet_end)) {
312 312
						$input_errors[] = sprintf(gettext("The DHCP range cannot overlap any static DHCP mappings."));
313 313
						break;
314 314
					}
......
437 437
}
438 438

  
439 439
// Delete a row in the options table
440
if($_GET['act'] == "delopt") {
440
if ($_GET['act'] == "delopt") {
441 441
	$idx = $_GET['id'];
442 442

  
443
	if($pconfig['numberoptions'] && is_array($pconfig['numberoptions']['item'][$idx])) {
443
	if ($pconfig['numberoptions'] && is_array($pconfig['numberoptions']['item'][$idx])) {
444 444
	   unset($pconfig['numberoptions']['item'][$idx]);
445 445
	}
446 446
}
447 447

  
448 448
// Add an option row
449
if($_GET['act'] == "addopt") {
450
	if(!is_array($pconfig['numberoptions']['item']))
449
if ($_GET['act'] == "addopt") {
450
	if (!is_array($pconfig['numberoptions']['item'])) {
451 451
		$pconfig['numberoptions']['item'] = array();
452
	}
452 453

  
453 454
	array_push($pconfig['numberoptions']['item'], array('number' => null, 'value' => null));
454 455
}
......
459 460

  
460 461
include("head.inc");
461 462

  
462
if ($input_errors)
463
if ($input_errors) {
463 464
	print_input_errors($input_errors);
465
}
464 466

  
465
if ($savemsg)
467
if ($savemsg) {
466 468
	print_info_box($savemsg, 'success');
469
}
467 470

  
468 471
if ($dhcrelay_enabled) {
469 472
	print_info_box(gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface."), 'danger');
......
471 474
	exit;
472 475
}
473 476

  
474
if (is_subsystem_dirty('staticmaps'))
477
if (is_subsystem_dirty('staticmaps')) {
475 478
	print_info_box_np(gettext('The static mapping configuration has been changed') . '.<br />' . gettext('You must apply the changes in order for them to take effect.'));
479
}
476 480

  
477 481
/* active tabs */
478 482
$tab_array = array();
......
483 487
	$oc = $config['interfaces'][$ifent];
484 488

  
485 489

  
486
	if((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
487
		(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
490
	if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
491
	    (!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
488 492
		continue;
493
	}
489 494

  
490
	if ($ifent == $if)
495
	if ($ifent == $if) {
491 496
		$active = true;
492
	else
497
	} else {
493 498
		$active = false;
499
	}
494 500

  
495 501
	$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
496 502
	$tabscounter++;
......
499 505
/* tack on PPPoE or PPtP servers here */
500 506
/* pppoe server */
501 507
if (is_array($config['pppoes']['pppoe'])) {
502
	foreach($config['pppoes']['pppoe'] as $pppoe) {
508
	foreach ($config['pppoes']['pppoe'] as $pppoe) {
503 509
		if ($pppoe['mode'] == "server") {
504 510
			$ifent = "poes". $pppoe['pppoeid'];
505 511
			$ifname = strtoupper($ifent);
506 512

  
507
			if ($ifent == $if)
513
			if ($ifent == $if) {
508 514
				$active = true;
509
			else
515
			} else {
510 516
				$active = false;
517
			}
511 518

  
512 519
			$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
513 520
			$tabscounter++;
......
526 533
$tab_array = array();
527 534
$tab_array[] = array(gettext("DHCPv6 Server"),		 true,	"services_dhcpv6.php?if={$if}");
528 535
$tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}");
529
display_top_tabs($tab_array, false, 'nav nav-tabs' );
536
display_top_tabs($tab_array, false, 'nav nav-tabs');
530 537

  
531 538
$form = new Form(new Form_Button(
532 539
	'Submit',
......
542 549
	$pconfig['enable']
543 550
))->toggles('.form-group:not(:first-child)');
544 551

  
545
if(is_ipaddrv6($ifcfgip)) {
552
if (is_ipaddrv6($ifcfgip)) {
546 553

  
547 554
	$section->addInput(new Form_StaticText(
548 555
		'Subnet',
......
560 567
		));
561 568
}
562 569

  
563
if($is_olsr_enabled) {
570
if ($is_olsr_enabled) {
564 571
	$section->addInput(new Form_Select(
565 572
	'netmask',
566 573
	'Subnet Mask',
......
635 642

  
636 643
$group = new Form_Group('DNS Servers');
637 644

  
638
for($i=1;$i<=4; $i++) {
645
for ($i=1;$i<=4; $i++) {
639 646
	$group->add(new Form_input(
640 647
		'dns' . $i,
641 648
		null,
......
645 652
	));
646 653
}
647 654

  
648
$group->setHelp('Leave blank to use the system default DNS servers,this interface\'s IP if DNS forwarder is enabled, or the servers configured on the "General" page.');
655
$group->setHelp('Leave blank to use the system default DNS servers, this interface\'s IP if DNS forwarder is enabled, or the servers configured on the "General" page.');
649 656
$section->add($group);
650 657

  
651 658
$section->addInput(new Form_Input(
......
828 835

  
829 836
$title = 'Show Additional BOOTP/DHCP Options';
830 837

  
831
if($pconfig['numberoptions']) {
838
if ($pconfig['numberoptions']) {
832 839
	$counter = 0;
833 840
	$last = count($pconfig['numberoptions']['item']) - 1;
834 841

  
835
	foreach($pconfig['numberoptions']['item'] as $item) {
842
	foreach ($pconfig['numberoptions']['item'] as $item) {
836 843
		$group = new Form_Group(null);
837 844

  
838 845
		$group->add(new Form_Input(
......
904 911
			</thead>
905 912
			<tbody>
906 913
<?php
907
if(is_array($a_maps)):
914
if (is_array($a_maps)):
908 915
	$i = 0;
909 916
	foreach ($a_maps as $mapent):
910
		if($mapent['duid'] != "" or $mapent['ipaddrv6'] != ""):
917
		if ($mapent['duid'] != "" or $mapent['ipaddrv6'] != ""):
911 918
?>
912 919
				<tr>
913 920
					<td>
......
947 954

  
948 955
<script type="text/javascript">
949 956
//<![CDATA[
950
events.push(function(){
957
events.push(function() {
951 958

  
952 959
	function hideDDNS(hide) {
953 960
		hideCheckBox('ddnsupdate', hide);

Also available in: Unified diff