Project

General

Profile

« Previous | Next » 

Revision 83b9d03e

Added by Phil Davis over 9 years ago

Create the required number of rows for NTP time servers

depending on how many are already defined in the config, making sure to always have a minimum of 1.

Also I used the constant NUMTIMESERVERS that was defined up the top of this file to control the loop that limits the number saved to 10.

Note: There also needs to be a limit on the number of rows of time server data allowed to be added - at the moment you can keep pressing the Add button and enter loads of them, only the first 10 are saved.

View differences:

src/usr/local/www/services_ntpd.php
107 107
		unset($config['ntpd']['noselect']);
108 108
		$timeservers = '';
109 109

  
110
		for ($i = 0; $i < 10; $i++) {
110
		for ($i = 0; $i < NUMTIMESERVERS; $i++) {
111 111
			$tserver = trim($_POST["server{$i}"]);
112 112
			if (!empty($tserver)) {
113 113
				$timeservers .= "{$tserver} ";
......
299 299
			'Selecting no interfaces will listen on all interfaces with a wildcard.' . '<br />' .
300 300
			'Selecting all interfaces will explicitly listen on only the interfaces/IPs specified.');
301 301

  
302
$maxrows = 3;
303 302
$timeservers = explode( ' ', $config['system']['timeservers']);
303
$maxrows = max(count($timeservers), 1);
304 304
for ($counter=0; $counter < $maxrows; $counter++) {
305 305
	$group = new Form_Group($counter == 0 ? 'Time servers':'');
306 306
	$group->addClass('repeatable');

Also available in: Unified diff