diff options
author | Phil Davis <phil.davis@inf.org> | 2015-12-08 18:48:13 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-12-08 18:48:13 +0545 |
commit | 83b9d03e228829e18be09e85d9a83faaa2df5858 (patch) | |
tree | fbbd8c1f8de16c00edd409b7330bbe1c646fa909 | |
parent | af83299d085a900e75e4d6de9d5fe65de6bd251a (diff) | |
download | pfsense-83b9d03e228829e18be09e85d9a83faaa2df5858.zip pfsense-83b9d03e228829e18be09e85d9a83faaa2df5858.tar.gz |
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.
-rw-r--r-- | src/usr/local/www/services_ntpd.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php index 6e6413f..8803d79 100644 --- a/src/usr/local/www/services_ntpd.php +++ b/src/usr/local/www/services_ntpd.php @@ -107,7 +107,7 @@ if ($_POST) { unset($config['ntpd']['noselect']); $timeservers = ''; - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < NUMTIMESERVERS; $i++) { $tserver = trim($_POST["server{$i}"]); if (!empty($tserver)) { $timeservers .= "{$tserver} "; @@ -299,8 +299,8 @@ $section->addInput(new Form_Select( 'Selecting no interfaces will listen on all interfaces with a wildcard.' . '<br />' . 'Selecting all interfaces will explicitly listen on only the interfaces/IPs specified.'); -$maxrows = 3; $timeservers = explode( ' ', $config['system']['timeservers']); +$maxrows = max(count($timeservers), 1); for ($counter=0; $counter < $maxrows; $counter++) { $group = new Form_Group($counter == 0 ? 'Time servers':''); $group->addClass('repeatable'); |