Commit 14f7dd4b authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(legacy) refactor services_ntpd.php

(cherry picked from commit 9871f0ba)
parent f0b9bd07
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2016 Deciso B.V.
Copyright (C) 2013 Dagorlad Copyright (C) 2013 Dagorlad
Copyright (C) 2012 Jim Pingle Copyright (C) 2012 Jim Pingle
All rights reserved. All rights reserved.
...@@ -34,134 +34,103 @@ require_once("services.inc"); ...@@ -34,134 +34,103 @@ require_once("services.inc");
require_once("system.inc"); require_once("system.inc");
require_once("interfaces.inc"); require_once("interfaces.inc");
if (!isset($config['ntpd']) || !is_array($config['ntpd'])) if (!isset($config['ntpd']) || !is_array($config['ntpd'])) {
$config['ntpd'] = array(); $config['ntpd'] = array();
if (empty($config['ntpd']['interface'])) {
$pconfig['interface'] = array();
} else {
$pconfig['interface'] = explode(",", $config['ntpd']['interface']);
} }
$a_ntpd = &$config['ntpd'];
if ($_POST) { $copy_fields = array('orphan', 'statsgraph', 'logpeer', 'logsys', 'clockstats', 'loopstats', 'interface',
unset($input_errors); 'peerstats', 'noquery', 'noserve', 'kod', 'nomodify', 'nopeer', 'notrap', 'leapsec');
$pconfig = $_POST; if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = array();
if (isset($_POST['interface']) && is_array($_POST['interface']))
$config['ntpd']['interface'] = implode(",", $_POST['interface']);
elseif (isset($config['ntpd']['interface']))
unset($config['ntpd']['interface']);
unset($config['ntpd']['prefer']); foreach ($copy_fields as $fieldname) {
unset($config['ntpd']['noselect']); if (isset($a_ntpd[$fieldname])) {
$timeservers = ''; $pconfig[$fieldname] = $a_ntpd[$fieldname];
for ($i = 0; $i < 10; $i++) {
$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} ";
} }
} }
$config['system']['timeservers'] = trim($timeservers);
if (empty($config['system']['timeservers'])) {
unset($config['system']['timeservers']);
}
if (!empty($_POST['ntporphan']) && ($_POST['ntporphan'] < 17) && ($_POST['ntporphan'] != '12'))
$config['ntpd']['orphan'] = $_POST['ntporphan'];
elseif (isset($config['ntpd']['orphan']))
unset($config['ntpd']['orphan']);
if (!empty($_POST['logpeer']))
$config['ntpd']['logpeer'] = $_POST['logpeer'];
elseif (isset($config['ntpd']['logpeer']))
unset($config['ntpd']['logpeer']);
if (!empty($_POST['logsys']))
$config['ntpd']['logsys'] = $_POST['logsys'];
elseif (isset($config['ntpd']['logsys']))
unset($config['ntpd']['logsys']);
if (!empty($_POST['clockstats']))
$config['ntpd']['clockstats'] = $_POST['clockstats'];
elseif (isset($config['ntpd']['clockstats']))
unset($config['ntpd']['clockstats']);
if (!empty($_POST['loopstats']))
$config['ntpd']['loopstats'] = $_POST['loopstats'];
elseif (isset($config['ntpd']['loopstats']))
unset($config['ntpd']['loopstats']);
if (!empty($_POST['peerstats']))
$config['ntpd']['peerstats'] = $_POST['peerstats'];
elseif (isset($config['ntpd']['peerstats']))
unset($config['ntpd']['peerstats']);
if (empty($_POST['kod'])) // base64 encoded
$config['ntpd']['kod'] = 'on'; $pconfig['leapsec'] = base64_decode(chunk_split($pconfig['leapsec']));
elseif (isset($config['ntpd']['kod']))
unset($config['ntpd']['kod']);
if (empty($_POST['nomodify'])) // array types
$config['ntpd']['nomodify'] = 'on'; $pconfig['interface'] = !empty($pconfig['interface']) ? explode(",", $pconfig['interface']) : array();
elseif (isset($config['ntpd']['nomodify']))
unset($config['ntpd']['nomodify']);
if (!empty($_POST['noquery'])) // parse timeservers
$config['ntpd']['noquery'] = $_POST['noquery']; $pconfig['timeservers_host'] = array();
elseif (isset($config['ntpd']['noquery'])) $pconfig['timeservers_noselect'] = array();
unset($config['ntpd']['noquery']); $pconfig['timeservers_prefer'] = array();;
if (!empty($config['system']['timeservers'])) {
$pconfig['timeservers_noselect'] = !empty($a_ntpd['noselect']) ? explode(' ', $a_ntpd['noselect']) : array();
$pconfig['timeservers_prefer'] = !empty($a_ntpd['prefer']) ? explode(' ', $a_ntpd['prefer']) : array();
$pconfig['timeservers_host'] = explode(' ', $config['system']['timeservers']);
}
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pconfig = $_POST;
$input_errors = array();
if (!empty($pconfig['orphan']) && ($pconfig['orphan'] < 0 || $pconfig['orphan'] > 15 || !is_numeric($pconfig['orphan']))) {
$input_errors[] = gettext("Orphan mode must be a value between 0..15");
}
if (!empty($_POST['noserve'])) // swap fields, really stupid field usage which we are not going to change now....
$config['ntpd']['noserve'] = $_POST['noserve']; foreach (array('kod', 'nomodify', 'nopeer', 'notrap') as $fieldname) {
elseif (isset($config['ntpd']['noserve'])) $pconfig[$fieldname] = empty($pconfig[$fieldname]);
unset($config['ntpd']['noserve']); }
if (empty($_POST['nopeer'])) if (count($input_errors) == 0) {
$config['ntpd']['nopeer'] = 'on'; // copy fields
elseif (isset($config['ntpd']['nopeer'])) foreach ($copy_fields as $fieldname) {
unset($config['ntpd']['nopeer']); if (!empty($pconfig[$fieldname])) {
$a_ntpd[$fieldname] = $pconfig[$fieldname];
} elseif (isset($a_ntpd[$fieldname])) {
unset($a_ntpd[$fieldname]);
}
}
if (empty($_POST['notrap'])) // list types
$config['ntpd']['notrap'] = 'on'; $config['system']['timeservers'] = trim(implode(' ', $pconfig['timeservers_host']));
elseif (isset($config['ntpd']['notrap'])) $a_ntpd['noselect'] = !empty($pconfig['timeservers_noselect']) ? trim(implode(' ', $pconfig['timeservers_noselect'])) : null;
unset($config['ntpd']['notrap']); $a_ntpd['prefer'] = "";
if (!empty($pconfig['timeservers_prefer'])) {
foreach ($pconfig['timeservers_prefer'] as $timeserver) {
if (!in_array($timeserver, $pconfig['timeservers_noselect'])) {
// a timeserver can't be both preferred and disabled, don't set preferred when disabled
$a_ntpd['prefer'] .= $timeserver . " ";
}
}
}
$a_ntpd['prefer'] = trim($a_ntpd['prefer']);
$a_ntpd['interface'] = implode(',', $pconfig['interface']);
if ((empty($_POST['statsgraph'])) != (isset($config['ntpd']['statsgraph']))); // unset empty
enable_rrd_graphing(); foreach (array('noselect', 'prefer', 'interface') as $fieldname) {
if (!empty($_POST['statsgraph'])) if (empty($a_ntpd[$fieldname])) {
$config['ntpd']['statsgraph'] = $_POST['statsgraph']; unset($a_ntpd[$fieldname]);
elseif (isset($config['ntpd']['statsgraph'])) }
unset($config['ntpd']['statsgraph']); }
if (empty($config['system']['timeservers'])) {
unset($config['system']['timeservers']);
}
if (!empty($_POST['leaptxt'])) if (!empty($a_ntpd['leapsec'])) {
$config['ntpd']['leapsec'] = base64_encode($_POST['leaptxt']); $a_ntpd['leapsec'] = base64_encode($a_ntpd['leapsec']);
elseif (isset($config['ntpd']['leapsec'])) } elseif(isset($config['ntpd']['leapsec'])) {
unset($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'])); $a_ntpd['leapsec'] = base64_encode(file_get_contents($_FILES['leapfile']['tmp_name']));
}
write_config("Updated NTP Server Settings"); write_config("Updated NTP Server Settings");
system_ntp_configure();
$retval = 0; header("Location: services_ntpd.php");
$retval = system_ntp_configure(); exit;
$savemsg = get_std_save_message(); }
}
$pconfig = &$config['ntpd'];
if (empty($pconfig['interface'])) {
$pconfig['interface'] = array();
} else {
$pconfig['interface'] = explode(",", $pconfig['interface']);
} }
$service_hook = 'ntpd'; $service_hook = 'ntpd';
legacy_html_escape_form_data($pconfig);
include("head.inc"); include("head.inc");
?> ?>
<body> <body>
...@@ -173,217 +142,252 @@ include("head.inc"); ...@@ -173,217 +142,252 @@ include("head.inc");
aodiv = document.getElementById(configvalueID); aodiv = document.getElementById(configvalueID);
aodiv.style.display = "block"; aodiv.style.display = "block";
} }
//]]>
//Insure only one of two mutually exclusive options are checked </script>
function CheckOffOther(clicked, checkOff) { <script type="text/javascript">
if (document.getElementById(clicked).checked) { $( document ).ready(function() {
document.getElementById(checkOff).checked=false; /**
} * Aliases
} */
function removeRow() {
//Show another time server line, limited to 10 servers if ( $('#timeservers_table > tbody > tr').length == 1 ) {
function NewTimeServer(add) { $('#timeservers_table > tbody > tr:last > td > input').each(function(){
//If the last line has a value $(this).val("");
var CheckServer = 'server' + (add - 1); $(this).prop('checked', false);
var LastId = document.getElementById(CheckServer); });
if (document.getElementById(CheckServer).value != '') { } else {
if (add < 10) { $(this).parent().parent().remove();
var TimeServerID = 'timeserver' + add;
document.getElementById(TimeServerID).style.display = 'block';
//then revise the add another server line
if (add < 9) {
var next = add + 1;
var newdiv = '<a class="btn btn-default btn-xs" title="<?= gettext("Add another Time server");?>" onclick="NewTimeServer(' + next + ')" alt="add" ><span class="glyphicon glyphicon-plus"></span></a>\n';
document.getElementById('addserver').innerHTML=newdiv;
}else{
document.getElementById('addserver').style.display = 'none';
}
}
} }
} }
//]]> // add new detail record
$("#addNew").click(function(){
// copy last row and reset values
$('#timeservers_table > tbody').append('<tr>'+$('#timeservers_table > tbody > tr:last').html()+'</tr>');
$('#timeservers_table > tbody > tr:last > td > input').each(function(){
$(this).val("");
$(this).prop('checked', false);
});
$(".act-removerow").click(removeRow);
});
$(".act-removerow").click(removeRow);
// on submit form, set checkbox values
$("#iform").submit(function(event){
$('#timeservers_table > tbody > tr').each(function(){
var timesrv = $(this).find("td > input:first").val();
$(this).find(".ts_checkbox").each(function(){
$(this).val(timesrv);
});
});
});
});
</script> </script>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
<section class="page-content-main">
<section class="page-content-main">
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?> <?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<section class="col-xs-12"> <section class="col-xs-12">
<div class="tab-content content-box col-xs-12"> <div class="tab-content content-box col-xs-12">
<form method="post" name="iform" id="iform" enctype="multipart/form-data" accept-charset="utf-8">
<form action="services_ntpd.php" method="post" name="iform" id="iform" enctype="multipart/form-data" accept-charset="utf-8">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped"> <table class="table table-striped">
<thead>
<tr> <tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Server Configuration"); ?></td> <td width="22%">
<strong><?=gettext("NTP Server Configuration"); ?></strong>
</td>
<td width="78%" align="right">
<small><?=gettext("full help"); ?> </small>
<i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i>
&nbsp;&nbsp;
</td>
</tr> </tr>
</thead>
<tbody>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('Interface(s)') ?></td> <td><a id="help_for_interfaces" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Interface(s)') ?></td>
<td width="78%" class="vtable"> <td>
<?php <?php
$interfaces = get_configured_interface_with_descr(); $interfaces = get_configured_interface_with_descr();
$carplist = get_configured_carp_interface_list(); $carplist = get_configured_carp_interface_list();
foreach ($carplist as $cif => $carpip) foreach ($carplist as $cif => $carpip) {
$interfaces[$cif] = $carpip." (".get_vip_descr($carpip).")"; $interfaces[$cif] = $carpip." (".get_vip_descr($carpip).")";
}
$aliaslist = get_configured_ip_aliases_list(); $aliaslist = get_configured_ip_aliases_list();
foreach ($aliaslist as $aliasip => $aliasif) foreach ($aliaslist as $aliasip => $aliasif) {
$interfaces[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")"; $interfaces[$aliasip] = $aliasip." (".get_vip_descr($aliasip).")";
$size = (count($interfaces) < 10) ? count($interfaces) : 10; }?>
?> <select id="interface" name="interface[]" multiple="multiple" class="selectpicker">
<select id="interface" name="interface[]" multiple="multiple" class="formselect" size="<?= $size; ?>"> <?php
<?php foreach ($interfaces as $iface => $ifacename):
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; continue;
echo "<option value='{$iface}'"; }?>
if (is_array($pconfig['interface'])) <option value="<?=$iface;?>" <?=in_array($iface, $pconfig['interface']) ?" selected=\"selected\"" : "";?>>
if (in_array($iface, $pconfig['interface'])) echo " selected=\"selected\""; <?=htmlspecialchars($ifacename);?>
echo ">" . htmlspecialchars($ifacename) . "</option>\n"; </option>
} ?> <?php
endforeach;?>
</select> </select>
<div class="hidden" for="help_for_interfaces">
<?=gettext("Interfaces without an IP address will not be shown."); ?>
<br /> <br />
<br /><?= gettext("Interfaces without an IP address will not be shown."); ?> <br /><?=gettext("Selecting no interfaces will listen on all interfaces with a wildcard."); ?>
<br /> <br /><?=gettext("Selecting all interfaces will explicitly listen on only the interfaces/IPs specified."); ?>
<br /><?= gettext("Selecting no interfaces will listen on all interfaces with a wildcard."); ?> </div>
<br /><?= gettext("Selecting all interfaces will explicitly listen on only the interfaces/IPs specified."); ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('Time servers') ?></td> <td><a id="help_for_timeservers" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Time servers') ?></td>
<td width="78%" class="vtable"> <td>
<?php <table class="table table-striped table-condensed" id="timeservers_table">
$timeservers = explode( ' ', $config['system']['timeservers']); <thead>
for ($i = $j = 0; $i < 10; $i++){ <tr>
echo "<div id=\"timeserver{$i}\""; <th></th>
if ((isset($timeservers[$i])) || ($i < 3)) { <th><?=gettext("Network"); ?></th>
$j++; <th><?=gettext("Prefer"); ?></th>
}else{ <th><?=gettext("Do not use"); ?></th>
echo " style=\"display:none\""; </tr>
} </thead>
echo ">\n"; <tbody>
if (!isset($timeservers[$i])) { <?php
$timeserverVal = null; if (count($pconfig['timeservers_host']) == 0 ) {
} else { $pconfig['timeservers_host'][] = "";
$timeserverVal =$timeservers[$i]; $pconfig['timeservers_prefer'][] = false;
} $pconfig['timeservers_noselect'][] = false;
echo "<input name=\"server{$i}\" class=\"formfld unknown\" id=\"server{$i}\" size=\"30\" value=\"{$timeserverVal}\" type=\"text\" />&emsp;";
echo "\n<input name=\"servprefer{$i}\" class=\"formcheckbox\" id=\"servprefer{$i}\" onclick=\"CheckOffOther('servprefer{$i}', 'servselect{$i}')\" type=\"checkbox\"";
if (!empty($config['ntpd']['prefer']) && !empty($timeserverVal) && substr_count($config['ntpd']['prefer'], $timeserverVal)) echo " checked=\"checked\"";
echo " />&nbsp;" . gettext('prefer this server') . "&emsp;";
echo "\n<input name=\"servselect{$i}\" class=\"formcheckbox\" id=\"servselect{$i}\" onclick=\"CheckOffOther('servselect{$i}', 'servprefer{$i}')\" type=\"checkbox\"";
if (!empty($config['ntpd']['noselect']) && !empty($timeserverVal) && substr_count($config['ntpd']['noselect'], $timeserverVal)) echo " checked=\"checked\"";
echo " />&nbsp;" . gettext('do not use this server') . "\n<br />\n</div>\n";
} }
?> foreach($pconfig['timeservers_host'] as $item_idx => $timeserver):?>
<div id="addserver"> <tr>
<a class="btn btn-default btn-xs" title="<?= gettext("Add another Time server");?>" onclick="NewTimeServer(<?= $j;?>)" alt="add" ><span class="glyphicon glyphicon-plus"></span> </a> <td>
</div> <div style="cursor:pointer;" class="act-removerow btn btn-default btn-xs" alt="remove"><span class="glyphicon glyphicon-minus"></span></div>
<br /> </td>
<?= gettext('For best results three to five servers should be configured here.'); ?> <td>
<input name="timeservers_host[]" type="text" value="<?=$timeserver;?>" />
</td>
<td>
<input name="timeservers_prefer[]" class="ts_checkbox" type="checkbox" value="<?=$timeserver;?>" <?=in_array($timeserver, $pconfig['timeservers_prefer']) ? " checked=\"checked\"" : "";?> />
</td>
<td>
<input name="timeservers_noselect[]" class="ts_checkbox" type="checkbox" value="<?=$timeserver;?>" <?=in_array($timeserver, $pconfig['timeservers_noselect']) ? " checked=\"checked\"" : "";?> />
</td>
</tr>
<?php
endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan="4">
<div id="addNew" style="cursor:pointer;" class="btn btn-default btn-xs" alt="add"><span class="glyphicon glyphicon-plus"></span></div>
</td>
</tr>
</tfoot>
</table>
<div class="hidden" for="help_for_timeservers">
<?=gettext('For best results three to five servers should be configured here.'); ?>
<br /> <br />
<?= sprintf(gettext('The %sprefer%s option indicates that NTP should favor the use of this server more than all others.'),'<i>','</i>') ?> <?= sprintf(gettext('The %sprefer%s option indicates that NTP should favor the use of this server more than all others.'),'<i>','</i>') ?>
<br /> <br />
<?= sprintf(gettext('The %snoselect%s option indicates that NTP should not use this server for time, but stats for this server will be collected and displayed.'),'<i>','</i>') ?> <?= sprintf(gettext('The %snoselect%s option indicates that NTP should not use this server for time, but stats for this server will be collected and displayed.'),'<i>','</i>') ?>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('Orphan mode') ?></td> <td><a id="help_for_orphan" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Orphan mode') ?></td>
<td width="78%" class="vtable"> <td>
<input name="ntporphan" type="text" class="formfld unknown" id="ntporphan" min="1" max="16" size="20" value="<?=htmlspecialchars(isset($pconfig['orphan']) ? $pconfig['orphan']:"");?>" /><?= gettext("(0-15)");?><br /> <input name="orphan" type="text" value="<?=$pconfig['orphan']?>" />
<?= 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)."); ?> <div class="hidden" for="help_for_orphan">
<?=gettext("(0-15)");?><br />
<?=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)."); ?>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('NTP graphs') ?></td> <td><a id="help_for_statsgraph" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('NTP graphs') ?></td>
<td width="78%" class="vtable"> <td>
<input name="statsgraph" type="checkbox" class="formcheckbox" id="statsgraph" <?php if(!empty($pconfig['statsgraph'])) echo " checked=\"checked\""; ?> /> <input name="statsgraph" type="checkbox" id="statsgraph" <?=!empty($pconfig['statsgraph']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Enable rrd graphs of NTP statistics (default: disabled)."); ?> <div class="hidden" for="help_for_statsgraph">
<?=gettext("Enable rrd graphs of NTP statistics (default: disabled)."); ?>
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('Syslog logging') ?></td> <td><a id="help_for_syslog" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext('Syslog logging') ?></td>
<td width="78%" class="vtable"> <td>
<?= gettext("These options enable additional messages from NTP to be written to the System Log");?> (<a href="diag_logs_ntpd.php"><?= gettext("Status > System Logs > NTP"); ?></a>). <input name="logpeer" type="checkbox" <?=!empty($pconfig['logpeer']) ? " checked=\"checked\"" : ""; ?> />
<br /><br /> <?=gettext("Enable logging of peer messages (default: disabled)."); ?>
<input name="logpeer" type="checkbox" class="formcheckbox" id="logpeer"<?php if(!empty($pconfig['logpeer'])) echo " checked=\"checked\""; ?> />
<?= gettext("Enable logging of peer messages (default: disabled)."); ?>
<br /> <br />
<input name="logsys" type="checkbox" class="formcheckbox" id="logsys"<?php if(!empty($pconfig['logsys'])) echo " checked=\"checked\""; ?> /> <input name="logsys" type="checkbox" <?=!empty($pconfig['logsys']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Enable logging of system messages (default: disabled)."); ?> <?=gettext("Enable logging of system messages (default: disabled)."); ?>
<div class="hidden" for="help_for_syslog">
<?=gettext("These options enable additional messages from NTP to be written to the System Log");?> (<a href="diag_logs_ntpd.php"><?=gettext("Status > System Logs > NTP"); ?></a>).
</div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('Statistics logging') ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext('Statistics logging') ?></td>
<td width="78%" class="vtable"> <td>
<div id="showstatisticsbox"> <div id="showstatisticsbox">
<input class="btn btn-default btn-xs" type="button" onclick="show_advanced('showstatisticsbox', 'showstatistics')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show statistics logging options");?> <input class="btn btn-default btn-xs" type="button" onclick="show_advanced('showstatisticsbox', 'showstatistics')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show statistics logging options");?>
</div> </div>
<div id="showstatistics" style="display:none"> <div id="showstatistics" style="display:none">
<strong><?= gettext("Warning: ")?></strong><?= gettext("these options will create persistant daily log files in /var/log/ntp."); ?> <strong><?=gettext("Warning: ")?></strong><?=gettext("these options will create persistant daily log files in /var/log/ntp."); ?>
<br /><br /> <br /><br />
<input name="clockstats" type="checkbox" class="formcheckbox" id="clockstats"<?php if(!empty($pconfig['clockstats'])) echo " checked=\"checked\""; ?> /> <input name="clockstats" type="checkbox" id="clockstats"<?=!empty($pconfig['clockstats']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Enable logging of reference clock statistics (default: disabled)."); ?> <?=gettext("Enable logging of reference clock statistics (default: disabled)."); ?>
<br /> <br />
<input name="loopstats" type="checkbox" class="formcheckbox" id="loopstats"<?php if(!empty($pconfig['loopstats'])) echo " checked=\"checked\""; ?> /> <input name="loopstats" type="checkbox" id="loopstats"<?=!empty($pconfig['loopstats']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Enable logging of clock discipline statistics (default: disabled)."); ?> <?=gettext("Enable logging of clock discipline statistics (default: disabled)."); ?>
<br /> <br />
<input name="peerstats" type="checkbox" class="formcheckbox" id="peerstats"<?php if(!empty($pconfig['peerstats'])) echo " checked=\"checked\""; ?> /> <input name="peerstats" type="checkbox" id="peerstats"<?=!empty($pconfig['peerstats']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Enable logging of NTP peer statistics (default: disabled)."); ?> <?=gettext("Enable logging of NTP peer statistics (default: disabled)."); ?>
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('Access restrictions') ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext('Access restrictions') ?></td>
<td width="78%" class="vtable"> <td>
<div id="showrestrictbox"> <div id="showrestrictbox">
<input type="button" class="btn btn-default btn-xs" onclick="show_advanced('showrestrictbox', 'showrestrict')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show access restriction options");?> <input type="button" class="btn btn-default btn-xs" onclick="show_advanced('showrestrictbox', 'showrestrict')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show access restriction options");?>
</div> </div>
<div id="showrestrict" style="display:none"> <div id="showrestrict" style="display:none">
<?= gettext("these options control access to NTP from the WAN."); ?> <?=gettext("these options control access to NTP from the WAN."); ?>
<br /><br /> <br /><br />
<input name="kod" type="checkbox" class="formcheckbox" id="kod"<?php if(empty($pconfig['kod'])) echo " checked=\"checked\""; ?> /> <input name="kod" type="checkbox" id="kod"<?=empty($pconfig['kod']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Enable Kiss-o'-death packets (default: enabled)."); ?> <?=gettext("Enable Kiss-o'-death packets (default: enabled)."); ?>
<br /> <br />
<input name="nomodify" type="checkbox" class="formcheckbox" id="nomodify"<?php if(empty($pconfig['nomodify'])) echo " checked=\"checked\""; ?> /> <input name="nomodify" type="checkbox" id="nomodify"<?=empty($pconfig['nomodify']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Deny state modifications (i.e. run time configuration) by ntpq and ntpdc (default: enabled)."); ?> <?=gettext("Deny state modifications (i.e. run time configuration) by ntpq and ntpdc (default: enabled)."); ?>
<br /> <br />
<input name="noquery" type="checkbox" class="formcheckbox" id="noquery"<?php if(!empty($pconfig['noquery'])) echo " checked=\"checked\""; ?> /> <input name="noquery" type="checkbox" id="noquery"<?=!empty($pconfig['noquery']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Disable ntpq and ntpdc queries (default: disabled)."); ?> <?=gettext("Disable ntpq and ntpdc queries (default: disabled)."); ?>
<br /> <br />
<input name="noserve" type="checkbox" class="formcheckbox" id="noserve"<?php if(!empty($pconfig['noserve'])) echo " checked=\"checked\""; ?> /> <input name="noserve" type="checkbox" id="noserve"<?=!empty($pconfig['noserve']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Disable all except ntpq and ntpdc queries (default: disabled)."); ?> <?=gettext("Disable all except ntpq and ntpdc queries (default: disabled)."); ?>
<br /> <br />
<input name="nopeer" type="checkbox" class="formcheckbox" id="nopeer"<?php if(empty($pconfig['nopeer'])) echo " checked=\"checked\""; ?> /> <input name="nopeer" type="checkbox" id="nopeer"<?=empty($pconfig['nopeer']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Deny packets that attempt a peer association (default: enabled)."); ?> <?=gettext("Deny packets that attempt a peer association (default: enabled)."); ?>
<br /> <br />
<input name="notrap" type="checkbox" class="formcheckbox" id="notrap"<?php if(empty($pconfig['notrap'])) echo " checked=\"checked\""; ?> /> <input name="notrap" type="checkbox" id="notrap"<?=empty($pconfig['notrap']) ? " checked=\"checked\"" : ""; ?> />
<?= gettext("Deny mode 6 control message trap service (default: enabled)."); ?> <?=gettext("Deny mode 6 control message trap service (default: enabled)."); ?>
</div> </div>
</td> </td>
</tr> </tr>
<tr> <tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext('Leap seconds') ?></td> <td><i class="fa fa-info-circle text-muted"></i> <?=gettext('Leap seconds') ?></td>
<td width="78%" class="vtable"> <td>
<div id="showleapsecbox"> <div id="showleapsecbox">
<input type="button" class="btn btn-default btn-xs" onclick="show_advanced('showleapsecbox', 'showleapsec')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Leap second configuration");?> <input type="button" class="btn btn-default btn-xs" onclick="show_advanced('showleapsecbox', 'showleapsec')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show Leap second configuration");?>
</div> </div>
<div id="showleapsec" style="display:none"> <div id="showleapsec" style="display:none">
<?= gettext("A leap second file allows NTP to advertize an upcoming leap second addition or subtraction.");?> <?=gettext("A leap second file allows NTP to advertize an upcoming leap second addition or subtraction.");?>
<?= gettext("Normally this is only useful if this server is a stratum 1 time server.");?> <?=gettext("Normally this is only useful if this server is a stratum 1 time server.");?>
<br /><br /> <br /><br />
<?= gettext("Enter Leap second configuration as text:");?><br /> <?=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(isset($pconfig['leapsec'])?$pconfig['leapsec']:"")); echo $text;?></textarea><br /> <textarea name="leapsec" cols="65" rows="7"><?=$pconfig['leapsec'];?></textarea><br />
<strong><?= gettext("Or");?></strong>, <?= gettext("select a file to upload:");?> <strong><?=gettext("Or");?></strong>, <?=gettext("select a file to upload:");?>
<input type="file" name="leapfile" class="formfld file" id="leapfile" /> <input type="file" name="leapfile"/>
</div> </div>
</td> </td>
</tr> </tr>
...@@ -393,13 +397,13 @@ include("head.inc"); ...@@ -393,13 +397,13 @@ include("head.inc");
<input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" /> <input name="Submit" type="submit" class="btn btn-primary" value="<?=gettext("Save");?>" />
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
</div> </div>
</form> </form>
</div> </div>
</section> </section>
</div> </div>
</div> </div>
</section> </section>
<?php include("foot.inc"); ?> <?php include("foot.inc"); ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment