summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_ntpd.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-05-24 15:02:16 +0545
committerPhil Davis <phil.davis@inf.org>2015-05-24 15:02:16 +0545
commit7a6f0ebcbed31ef668f422d9fc6cdcabf788df71 (patch)
tree1f8925a22c7b5815c63ace7f3a47ff8a68079552 /usr/local/www/services_ntpd.php
parent88cbd0049b78bd731648be68c13e08161e5e943c (diff)
downloadpfsense-7a6f0ebcbed31ef668f422d9fc6cdcabf788df71.zip
pfsense-7a6f0ebcbed31ef668f422d9fc6cdcabf788df71.tar.gz
Code style services NTP
Diffstat (limited to 'usr/local/www/services_ntpd.php')
-rw-r--r--usr/local/www/services_ntpd.php455
1 files changed, 248 insertions, 207 deletions
diff --git a/usr/local/www/services_ntpd.php b/usr/local/www/services_ntpd.php
index 88d3f20..cea8ea6 100644
--- a/usr/local/www/services_ntpd.php
+++ b/usr/local/www/services_ntpd.php
@@ -43,8 +43,9 @@ require("guiconfig.inc");
require_once('rrd.inc');
require_once("shaper.inc");
-if (!is_array($config['ntpd']))
+if (!is_array($config['ntpd'])) {
$config['ntpd'] = array();
+}
if (empty($config['ntpd']['interface'])) {
if (is_array($config['installedpackages']['openntpd']) && is_array($config['installedpackages']['openntpd']['config']) &&
@@ -52,10 +53,12 @@ if (empty($config['ntpd']['interface'])) {
$pconfig['interface'] = explode(",", $config['installedpackages']['openntpd']['config'][0]['interface']);
unset($config['installedpackages']['openntpd']);
write_config("Upgraded settings from openttpd");
- } else
+ } else {
$pconfig['interface'] = array();
-} else
+ }
+} else {
$pconfig['interface'] = explode(",", $config['ntpd']['interface']);
+}
if ($_POST) {
@@ -63,15 +66,17 @@ if ($_POST) {
$pconfig = $_POST;
if (!$input_errors) {
- if (is_array($_POST['interface']))
+ if (is_array($_POST['interface'])) {
$config['ntpd']['interface'] = implode(",", $_POST['interface']);
- elseif (isset($config['ntpd']['interface']))
+ } elseif (isset($config['ntpd']['interface'])) {
unset($config['ntpd']['interface']);
+ }
- if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport']))
+ if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport'])) {
$config['ntpd']['gpsport'] = $_POST['gpsport'];
- elseif (isset($config['ntpd']['gpsport']))
+ } elseif (isset($config['ntpd']['gpsport'])) {
unset($config['ntpd']['gpsport']);
+ }
unset($config['ntpd']['prefer']);
unset($config['ntpd']['noselect']);
@@ -80,106 +85,128 @@ if ($_POST) {
$tserver = trim($_POST["server{$i}"]);
if (!empty($tserver)) {
$timeservers .= "{$tserver} ";
- if (!empty($_POST["servprefer{$i}"])) $config['ntpd']['prefer'] .= "{$tserver} ";
- if (!empty($_POST["servselect{$i}"])) $config['ntpd']['noselect'].= "{$tserver} ";
+ if (!empty($_POST["servprefer{$i}"])) {
+ $config['ntpd']['prefer'] .= "{$tserver} ";
+ }
+ if (!empty($_POST["servselect{$i}"])) {
+ $config['ntpd']['noselect'] .= "{$tserver} ";
+ }
}
}
- if (trim($timeservers) == "")
+ if (trim($timeservers) == "") {
$timeservers = "pool.ntp.org";
+ }
$config['system']['timeservers'] = trim($timeservers);
- if (!empty($_POST['ntporphan']) && ($_POST['ntporphan'] < 17) && ($_POST['ntporphan'] != '12'))
+ if (!empty($_POST['ntporphan']) && ($_POST['ntporphan'] < 17) && ($_POST['ntporphan'] != '12')) {
$config['ntpd']['orphan'] = $_POST['ntporphan'];
- elseif (isset($config['ntpd']['orphan']))
+ } elseif (isset($config['ntpd']['orphan'])) {
unset($config['ntpd']['orphan']);
+ }
- if (!empty($_POST['logpeer']))
+ if (!empty($_POST['logpeer'])) {
$config['ntpd']['logpeer'] = $_POST['logpeer'];
- elseif (isset($config['ntpd']['logpeer']))
+ } elseif (isset($config['ntpd']['logpeer'])) {
unset($config['ntpd']['logpeer']);
+ }
- if (!empty($_POST['logsys']))
+ if (!empty($_POST['logsys'])) {
$config['ntpd']['logsys'] = $_POST['logsys'];
- elseif (isset($config['ntpd']['logsys']))
+ } elseif (isset($config['ntpd']['logsys'])) {
unset($config['ntpd']['logsys']);
+ }
- if (!empty($_POST['clockstats']))
+ if (!empty($_POST['clockstats'])) {
$config['ntpd']['clockstats'] = $_POST['clockstats'];
- elseif (isset($config['ntpd']['clockstats']))
+ } elseif (isset($config['ntpd']['clockstats'])) {
unset($config['ntpd']['clockstats']);
+ }
- if (!empty($_POST['loopstats']))
+ if (!empty($_POST['loopstats'])) {
$config['ntpd']['loopstats'] = $_POST['loopstats'];
- elseif (isset($config['ntpd']['loopstats']))
+ } elseif (isset($config['ntpd']['loopstats'])) {
unset($config['ntpd']['loopstats']);
+ }
- if (!empty($_POST['peerstats']))
+ if (!empty($_POST['peerstats'])) {
$config['ntpd']['peerstats'] = $_POST['peerstats'];
- elseif (isset($config['ntpd']['peerstats']))
+ } elseif (isset($config['ntpd']['peerstats'])) {
unset($config['ntpd']['peerstats']);
+ }
- if (empty($_POST['kod']))
+ if (empty($_POST['kod'])) {
$config['ntpd']['kod'] = 'on';
- elseif (isset($config['ntpd']['kod']))
+ } elseif (isset($config['ntpd']['kod'])) {
unset($config['ntpd']['kod']);
+ }
- if (empty($_POST['nomodify']))
+ if (empty($_POST['nomodify'])) {
$config['ntpd']['nomodify'] = 'on';
- elseif (isset($config['ntpd']['nomodify']))
+ } elseif (isset($config['ntpd']['nomodify'])) {
unset($config['ntpd']['nomodify']);
+ }
- if (!empty($_POST['noquery']))
+ if (!empty($_POST['noquery'])) {
$config['ntpd']['noquery'] = $_POST['noquery'];
- elseif (isset($config['ntpd']['noquery']))
+ } elseif (isset($config['ntpd']['noquery'])) {
unset($config['ntpd']['noquery']);
+ }
- if (!empty($_POST['noserve']))
+ if (!empty($_POST['noserve'])) {
$config['ntpd']['noserve'] = $_POST['noserve'];
- elseif (isset($config['ntpd']['noserve']))
+ } elseif (isset($config['ntpd']['noserve'])) {
unset($config['ntpd']['noserve']);
+ }
- if (empty($_POST['nopeer']))
+ if (empty($_POST['nopeer'])) {
$config['ntpd']['nopeer'] = 'on';
- elseif (isset($config['ntpd']['nopeer']))
+ } elseif (isset($config['ntpd']['nopeer'])) {
unset($config['ntpd']['nopeer']);
+ }
- if (empty($_POST['notrap']))
+ if (empty($_POST['notrap'])) {
$config['ntpd']['notrap'] = 'on';
- elseif (isset($config['ntpd']['notrap']))
+ } elseif (isset($config['ntpd']['notrap'])) {
unset($config['ntpd']['notrap']);
+ }
- if ((empty($_POST['statsgraph'])) == (isset($config['ntpd']['statsgraph'])))
+ if ((empty($_POST['statsgraph'])) == (isset($config['ntpd']['statsgraph']))) {
$enable_rrd_graphing = true;
- if (!empty($_POST['statsgraph']))
+ }
+ if (!empty($_POST['statsgraph'])) {
$config['ntpd']['statsgraph'] = $_POST['statsgraph'];
- elseif (isset($config['ntpd']['statsgraph']))
+ } elseif (isset($config['ntpd']['statsgraph'])) {
unset($config['ntpd']['statsgraph']);
- if (isset($enable_rrd_graphing))
+ }
+ if (isset($enable_rrd_graphing)) {
enable_rrd_graphing();
+ }
- if (!empty($_POST['leaptxt']))
+ if (!empty($_POST['leaptxt'])) {
$config['ntpd']['leapsec'] = base64_encode($_POST['leaptxt']);
- elseif (isset($config['ntpd']['leapsec']))
+ } elseif (isset($config['ntpd']['leapsec'])) {
unset($config['ntpd']['leapsec']);
+ }
- if (is_uploaded_file($_FILES['leapfile']['tmp_name']))
+ if (is_uploaded_file($_FILES['leapfile']['tmp_name'])) {
$config['ntpd']['leapsec'] = base64_encode(file_get_contents($_FILES['leapfile']['tmp_name']));
+ }
write_config("Updated NTP Server Settings");
$retval = 0;
$retval = system_ntp_configure();
$savemsg = get_std_save_message($retval);
-
}
}
$closehead = false;
$pconfig = &$config['ntpd'];
-if (empty($pconfig['interface']))
+if (empty($pconfig['interface'])) {
$pconfig['interface'] = array();
-else
+} else {
$pconfig['interface'] = explode(",", $pconfig['interface']);
-$pgtitle = array(gettext("Services"),gettext("NTP"));
+}
+$pgtitle = array(gettext("Services"), gettext("NTP"));
$shortcut_section = "ntp";
include("head.inc");
@@ -215,7 +242,7 @@ include("head.inc");
var next = add + 1;
var newdiv = '<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?php echo gettext("Add another Time server");?>" onclick="NewTimeServer(' + next + ')" alt="add" />\n';
document.getElementById('addserver').innerHTML=newdiv;
- }else{
+ } else {
document.getElementById('addserver').style.display = 'none';
}
}
@@ -232,8 +259,8 @@ include("head.inc");
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ntpd">
- <tr>
- <td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("NTP"), true, "services_ntpd.php");
@@ -241,180 +268,194 @@ include("head.inc");
$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
display_top_tabs($tab_array);
?>
- </td>
- </tr>
- <tr>
- <td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Server Configuration"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Interface(s)</td>
- <td width="78%" class="vtable">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Server Configuration"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Interface(s)</td>
+ <td width="78%" class="vtable">
<?php
$interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list();
- foreach ($carplist as $cif => $carpip)
+ foreach ($carplist as $cif => $carpip) {
$interfaces[$cif] = $carpip." (".get_vip_descr($carpip).")";
+ }
$aliaslist = get_configured_ip_aliases_list();
- foreach ($aliaslist as $aliasip => $aliasif)
+ foreach ($aliaslist as $aliasip => $aliasif) {
$interfaces[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
+ }
$size = (count($interfaces) < 10) ? count($interfaces) : 10;
?>
- <select id="interface" name="interface[]" multiple="multiple" class="formselect" size="<?php echo $size; ?>">
-<?php
+ <select id="interface" name="interface[]" multiple="multiple" class="formselect" size="<?php echo $size; ?>">
+<?php
foreach ($interfaces as $iface => $ifacename) {
- if (!is_ipaddr(get_interface_ip($iface)) && !is_ipaddr($iface))
+ if (!is_ipaddr(get_interface_ip($iface)) && !is_ipaddr($iface)) {
continue;
+ }
echo "<option value='{$iface}'";
- if (is_array($pconfig['interface']))
- if (in_array($iface, $pconfig['interface'])) echo " selected=\"selected\"";
+ if (is_array($pconfig['interface'])) {
+ if (in_array($iface, $pconfig['interface'])) {
+ echo " selected=\"selected\"";
+ }
+ }
echo ">" . htmlspecialchars($ifacename) . "</option>\n";
- } ?>
- </select>
- <br />
- <br /><?php echo gettext("Interfaces without an IP address will not be shown."); ?>
- <br />
- <br /><?php echo gettext("Selecting no interfaces will listen on all interfaces with a wildcard."); ?>
- <br /><?php echo gettext("Selecting all interfaces will explicitly listen on only the interfaces/IPs specified."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Time servers</td>
- <td width="78%" class="vtable">
+ }
+?>
+ </select>
+ <br />
+ <br /><?php echo gettext("Interfaces without an IP address will not be shown."); ?>
+ <br />
+ <br /><?php echo gettext("Selecting no interfaces will listen on all interfaces with a wildcard."); ?>
+ <br /><?php echo gettext("Selecting all interfaces will explicitly listen on only the interfaces/IPs specified."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Time servers</td>
+ <td width="78%" class="vtable">
<?php
- $timeservers = explode( ' ', $config['system']['timeservers']);
- for ($i = $j = 0; $i < 10; $i++){
- echo "<div id=\"timeserver{$i}\"";
- if ((isset($timeservers[$i])) || ($i < 3)) {
- $j++;
- }else{
- echo " style=\"display:none\"";
+ $timeservers = explode(' ', $config['system']['timeservers']);
+ for ($i = $j = 0; $i < 10; $i++) {
+ echo "<div id=\"timeserver{$i}\"";
+ if ((isset($timeservers[$i])) || ($i < 3)) {
+ $j++;
+ } else {
+ echo " style=\"display:none\"";
+ }
+ echo ">\n";
+
+ echo "<input name=\"server{$i}\" class=\"formfld unknown\" id=\"server{$i}\" size=\"30\" value=\"{$timeservers[$i]}\" type=\"text\" />&emsp;";
+ echo "\n<input name=\"servprefer{$i}\" class=\"formcheckbox\" id=\"servprefer{$i}\" onclick=\"CheckOffOther('servprefer{$i}', 'servselect{$i}')\" type=\"checkbox\"";
+ if (isset($config['ntpd']['prefer']) && isset($timeservers[$i]) && substr_count($config['ntpd']['prefer'], $timeservers[$i])) {
+ echo " checked=\"checked\"";
+ }
+ echo " />&nbsp;prefer&emsp;";
+ echo "\n<input name=\"servselect{$i}\" class=\"formcheckbox\" id=\"servselect{$i}\" onclick=\"CheckOffOther('servselect{$i}', 'servprefer{$i}')\" type=\"checkbox\"";
+ if (isset($config['ntpd']['noselect']) && isset($timeservers[$i]) && substr_count($config['ntpd']['noselect'], $timeservers[$i])) {
+ echo " checked=\"checked\"";
+ }
+ echo " />&nbsp;noselect\n<br />\n</div>\n";
}
- echo ">\n";
-
- echo "<input name=\"server{$i}\" class=\"formfld unknown\" id=\"server{$i}\" size=\"30\" value=\"{$timeservers[$i]}\" type=\"text\" />&emsp;";
- echo "\n<input name=\"servprefer{$i}\" class=\"formcheckbox\" id=\"servprefer{$i}\" onclick=\"CheckOffOther('servprefer{$i}', 'servselect{$i}')\" type=\"checkbox\"";
- if (isset($config['ntpd']['prefer']) && isset($timeservers[$i]) && substr_count($config['ntpd']['prefer'], $timeservers[$i])) echo " checked=\"checked\"";
- echo " />&nbsp;prefer&emsp;";
- echo "\n<input name=\"servselect{$i}\" class=\"formcheckbox\" id=\"servselect{$i}\" onclick=\"CheckOffOther('servselect{$i}', 'servprefer{$i}')\" type=\"checkbox\"";
- if (isset($config['ntpd']['noselect']) && isset($timeservers[$i]) && substr_count($config['ntpd']['noselect'], $timeservers[$i])) echo " checked=\"checked\"";
- echo " />&nbsp;noselect\n<br />\n</div>\n";
- }
?>
- <div id="addserver">
- <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?php echo gettext("Add another Time server");?>" onclick="NewTimeServer(<?php echo $j;?>)" alt="add" />
- </div>
- <br />
- <?php echo gettext('For best results three to five servers should be configured here.'); ?>
- <br />
- <?php echo gettext('The <i>prefer</i> option indicates that NTP should favor the use of this server more than all others.'); ?>
- <br />
- <?php echo gettext('The <i>noselect</i> option indicates that NTP should not use this server for time, but stats for this server will be collected and displayed.'); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Orphan mode</td>
- <td width="78%" class="vtable">
- <input name="ntporphan" type="text" class="formfld unknown" id="ntporphan" min="1" max="16" size="20" value="<?=htmlspecialchars($pconfig['orphan']);?>" /><?php echo gettext("(0-15)");?><br />
- <?php echo gettext("Orphan mode allows the system clock to be used when no other clocks are available. The number here specifies the stratum reported during orphan mode and should normally be set to a number high enough to insure that any other servers available to clients are preferred over this server. (default: 12)."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">NTP graphs</td>
- <td width="78%" class="vtable">
- <input name="statsgraph" type="checkbox" class="formcheckbox" id="statsgraph" <?php if($pconfig['statsgraph']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable RRD graphs of NTP statistics (default: disabled)."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Syslog logging</td>
- <td width="78%" class="vtable">
- <?php echo gettext("These options enable additional messages from NTP to be written to the System Log");?> (<a href="diag_logs_ntpd.php"><?php echo gettext("Status > System Logs > NTP"); ?></a>).
- <br /><br />
- <input name="logpeer" type="checkbox" class="formcheckbox" id="logpeer"<?php if($pconfig['logpeer']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of peer messages (default: disabled)."); ?>
- <br />
- <input name="logsys" type="checkbox" class="formcheckbox" id="logsys"<?php if($pconfig['logsys']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of system messages (default: disabled)."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Statistics logging</td>
- <td width="78%" class="vtable">
- <div id="showstatisticsbox">
- <input type="button" onclick="show_advanced('showstatisticsbox', 'showstatistics')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show statistics logging options");?>
- </div>
- <div id="showstatistics" style="display:none">
- <strong><?php echo gettext("Warning: ")?></strong><?php echo gettext("these options will create persistent daily log files in /var/log/ntp."); ?>
- <br /><br />
- <input name="clockstats" type="checkbox" class="formcheckbox" id="clockstats"<?php if($pconfig['clockstats']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of reference clock statistics (default: disabled)."); ?>
- <br />
- <input name="loopstats" type="checkbox" class="formcheckbox" id="loopstats"<?php if($pconfig['loopstats']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of clock discipline statistics (default: disabled)."); ?>
- <br />
- <input name="peerstats" type="checkbox" class="formcheckbox" id="peerstats"<?php if($pconfig['peerstats']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable logging of NTP peer statistics (default: disabled)."); ?>
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Access restrictions</td>
- <td width="78%" class="vtable">
- <div id="showrestrictbox">
- <input type="button" onclick="show_advanced('showrestrictbox', 'showrestrict')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show access restriction options");?>
- </div>
- <div id="showrestrict" style="display:none">
- <?php echo gettext("these options control access to NTP from the WAN."); ?>
- <br /><br />
- <input name="kod" type="checkbox" class="formcheckbox" id="kod"<?php if(!$pconfig['kod']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Enable Kiss-o'-death packets (default: enabled)."); ?>
- <br />
- <input name="nomodify" type="checkbox" class="formcheckbox" id="nomodify"<?php if(!$pconfig['nomodify']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Deny state modifications (i.e. run time configuration) by ntpq and ntpdc (default: enabled)."); ?>
- <br />
- <input name="noquery" type="checkbox" class="formcheckbox" id="noquery"<?php if($pconfig['noquery']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Disable ntpq and ntpdc queries (default: disabled)."); ?>
- <br />
- <input name="noserve" type="checkbox" class="formcheckbox" id="noserve"<?php if($pconfig['noserve']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Disable all except ntpq and ntpdc queries (default: disabled)."); ?>
- <br />
- <input name="nopeer" type="checkbox" class="formcheckbox" id="nopeer"<?php if(!$pconfig['nopeer']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Deny packets that attempt a peer association (default: enabled)."); ?>
- <br />
- <input name="notrap" type="checkbox" class="formcheckbox" id="notrap"<?php if(!$pconfig['notrap']) echo " checked=\"checked\""; ?> />
- <?php echo gettext("Deny mode 6 control message trap service (default: enabled)."); ?>
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Leap seconds</td>
- <td width="78%" class="vtable">
- <div id="showleapsecbox">
- <input type="button" onclick="show_advanced('showleapsecbox', 'showleapsec')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Leap second configuration");?>
- </div>
- <div id="showleapsec" style="display:none">
- <?php echo gettext("A leap second file allows NTP to advertise an upcoming leap second addition or subtraction.");?>
- <?php echo gettext("Normally this is only useful if this server is a stratum 1 time server.");?>
- <br /><br />
- <?php echo gettext("Enter Leap second configuration as text:");?><br />
- <textarea name="leaptxt" class="formpre" id="leaptxt" cols="65" rows="7"><?php $text = base64_decode(chunk_split($pconfig['leapsec'])); echo $text;?></textarea><br />
- <strong><?php echo gettext("Or");?></strong>, <?php echo gettext("select a file to upload:");?>
- <input type="file" name="leapfile" class="formfld file" id="leapfile" />
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- </td>
- </tr>
- </table>
-</div></td></tr></table>
+ <div id="addserver">
+ <img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" title="<?php echo gettext("Add another Time server");?>" onclick="NewTimeServer(<?php echo $j;?>)" alt="add" />
+ </div>
+ <br />
+ <?php echo gettext('For best results three to five servers should be configured here.'); ?>
+ <br />
+ <?php echo gettext('The <i>prefer</i> option indicates that NTP should favor the use of this server more than all others.'); ?>
+ <br />
+ <?php echo gettext('The <i>noselect</i> option indicates that NTP should not use this server for time, but stats for this server will be collected and displayed.'); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Orphan mode</td>
+ <td width="78%" class="vtable">
+ <input name="ntporphan" type="text" class="formfld unknown" id="ntporphan" min="1" max="16" size="20" value="<?=htmlspecialchars($pconfig['orphan']);?>" /><?php echo gettext("(0-15)");?><br />
+ <?php echo gettext("Orphan mode allows the system clock to be used when no other clocks are available. The number here specifies the stratum reported during orphan mode and should normally be set to a number high enough to insure that any other servers available to clients are preferred over this server. (default: 12)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">NTP graphs</td>
+ <td width="78%" class="vtable">
+ <input name="statsgraph" type="checkbox" class="formcheckbox" id="statsgraph" <?php if ($pconfig['statsgraph']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable RRD graphs of NTP statistics (default: disabled)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Syslog logging</td>
+ <td width="78%" class="vtable">
+ <?php echo gettext("These options enable additional messages from NTP to be written to the System Log");?> (<a href="diag_logs_ntpd.php"><?php echo gettext("Status > System Logs > NTP"); ?></a>).
+ <br /><br />
+ <input name="logpeer" type="checkbox" class="formcheckbox" id="logpeer"<?php if ($pconfig['logpeer']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of peer messages (default: disabled)."); ?>
+ <br />
+ <input name="logsys" type="checkbox" class="formcheckbox" id="logsys"<?php if ($pconfig['logsys']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of system messages (default: disabled)."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Statistics logging</td>
+ <td width="78%" class="vtable">
+ <div id="showstatisticsbox">
+ <input type="button" onclick="show_advanced('showstatisticsbox', 'showstatistics')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show statistics logging options");?>
+ </div>
+ <div id="showstatistics" style="display:none">
+ <strong><?php echo gettext("Warning: ")?></strong><?php echo gettext("these options will create persistent daily log files in /var/log/ntp."); ?>
+ <br /><br />
+ <input name="clockstats" type="checkbox" class="formcheckbox" id="clockstats"<?php if ($pconfig['clockstats']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of reference clock statistics (default: disabled)."); ?>
+ <br />
+ <input name="loopstats" type="checkbox" class="formcheckbox" id="loopstats"<?php if ($pconfig['loopstats']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of clock discipline statistics (default: disabled)."); ?>
+ <br />
+ <input name="peerstats" type="checkbox" class="formcheckbox" id="peerstats"<?php if ($pconfig['peerstats']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable logging of NTP peer statistics (default: disabled)."); ?>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Access restrictions</td>
+ <td width="78%" class="vtable">
+ <div id="showrestrictbox">
+ <input type="button" onclick="show_advanced('showrestrictbox', 'showrestrict')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show access restriction options");?>
+ </div>
+ <div id="showrestrict" style="display:none">
+ <?php echo gettext("these options control access to NTP from the WAN."); ?>
+ <br /><br />
+ <input name="kod" type="checkbox" class="formcheckbox" id="kod"<?php if (!$pconfig['kod']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Enable Kiss-o'-death packets (default: enabled)."); ?>
+ <br />
+ <input name="nomodify" type="checkbox" class="formcheckbox" id="nomodify"<?php if (!$pconfig['nomodify']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Deny state modifications (i.e. run time configuration) by ntpq and ntpdc (default: enabled)."); ?>
+ <br />
+ <input name="noquery" type="checkbox" class="formcheckbox" id="noquery"<?php if ($pconfig['noquery']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Disable ntpq and ntpdc queries (default: disabled)."); ?>
+ <br />
+ <input name="noserve" type="checkbox" class="formcheckbox" id="noserve"<?php if ($pconfig['noserve']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Disable all except ntpq and ntpdc queries (default: disabled)."); ?>
+ <br />
+ <input name="nopeer" type="checkbox" class="formcheckbox" id="nopeer"<?php if (!$pconfig['nopeer']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Deny packets that attempt a peer association (default: enabled)."); ?>
+ <br />
+ <input name="notrap" type="checkbox" class="formcheckbox" id="notrap"<?php if (!$pconfig['notrap']) echo " checked=\"checked\""; ?> />
+ <?php echo gettext("Deny mode 6 control message trap service (default: enabled)."); ?>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Leap seconds</td>
+ <td width="78%" class="vtable">
+ <div id="showleapsecbox">
+ <input type="button" onclick="show_advanced('showleapsecbox', 'showleapsec')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Leap second configuration");?>
+ </div>
+ <div id="showleapsec" style="display:none">
+ <?php echo gettext("A leap second file allows NTP to advertise an upcoming leap second addition or subtraction.");?>
+ <?php echo gettext("Normally this is only useful if this server is a stratum 1 time server.");?>
+ <br /><br />
+ <?php echo gettext("Enter Leap second configuration as text:");?><br />
+ <textarea name="leaptxt" class="formpre" id="leaptxt" cols="65" rows="7"><?php $text = base64_decode(chunk_split($pconfig['leapsec'])); echo $text;?></textarea><br />
+ <strong><?php echo gettext("Or");?></strong>, <?php echo gettext("select a file to upload:");?>
+ <input type="file" name="leapfile" class="formfld file" id="leapfile" />
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+</table>
</form>
<?php include("fend.inc"); ?>
</body>
OpenPOWER on IntegriCloud