Project

General

Profile

« Previous | Next » 

Revision 43e255d2

Added by Ermal Luçi almost 17 years ago

  • Introduce an apply button before the changes get effect.
  • Actually fix the form submit action to work correctly.

View differences:

usr/local/www/interfaces.php
236 236
	}
237 237
}
238 238

  
239
if ($_POST) {
239
if ($_POST['apply']) {
240

  
241
                unlink_if_exists("{$g['tmp_path']}/config.cache");
242
		unlink_if_exists("{$d_landirty_path}");
243

  
244
                ob_flush();
245
                flush();
246
                sleep(1);
247

  
248
                interface_configure($if);
249

  
250
                reset_carp();
251

  
252
		if ($if == "lan") {
253
			/* restart snmp so that it binds to correct address */
254
			services_snmpd_configure();
255
			$savemsg = "The changes have been applied.  You may need to correct your web browser's IP address.";
256
		} 
257

  
258
                /* sync filter configuration */
259
                filter_configure();
260

  
261
                /* set up static routes */
262
                system_routing_configure();
263

  
264
} else if ($_POST) {
240 265

  
241 266
	unset($input_errors);
242 267
	$pconfig = $_POST;
......
682 707

  
683 708
		write_config();
684 709
	
685
		if ($if = "lan") {
686
			/* restart snmp so that it binds to correct address */
687
                	services_snmpd_configure();
688
			$savemsg = "The changes have been applied.  You may need to correct your web browser's IP address.";
689
		}
690
    
691 710
		/* finally install the pppoerestart file */
692 711
		if (isset($_POST['pppoe_preset'])) {
693 712
		config_lock();
......
708 727

  
709 728
		$retval = 0;
710 729
		$savemsg = get_std_save_message($retval);
730

  
731
		touch($d_landirty_path);
732
		header("Location: interfaces.php?if={$if}");
733
		exit;
711 734
	}
712 735
}
713 736

  
......
782 805
</head>
783 806
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
784 807
<?php include("fbegin.inc"); ?>
808
            <form action="interfaces.php" method="post" name="iform" id="iform">
785 809
<?php if ($input_errors) print_input_errors($input_errors); ?>
786

  
810
<?php if (file_exists($d_landirty_path)): ?><p>
811
<?php print_info_box_np(gettext("The {$wancfg['descr']} configuration has been changed.<p>You must apply the changes in order for them to take effect.<p>Don't forget to adjust the DHCP Server range if needed before applying."));?><br />
812
<?php endif; ?>
787 813
<?php if ($savemsg) print_info_box($savemsg); ?>
788
            <form action="interfaces.php?if=<?php echo "{$if}";?>" method="post" name="iform" id="iform">
789 814
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
790 815
                <tr>
791 816
                  <td colspan="2" valign="top" class="listtopic">General configuration</td>
......
1404 1429
<?php include("fend.inc"); ?>
1405 1430
</body>
1406 1431
</html>
1407

  
1408

  
1409
<?php
1410

  
1411
if ($_POST) {
1412

  
1413
	if (!$input_errors) {
1414

  
1415
		unlink_if_exists("{$g['tmp_path']}/config.cache");
1416

  
1417
		ob_flush();
1418
		flush();
1419
		sleep(1);
1420

  
1421
		interface_configure($if);
1422

  
1423
		reset_carp();
1424

  
1425
		/* sync filter configuration */
1426
		filter_configure();
1427

  
1428
 		/* set up static routes */
1429
		system_routing_configure();
1430

  
1431
	}
1432
}
1433

  
1434
?>

Also available in: Unified diff