33 |
33 |
##|*MATCH=status_ntpd.php*
|
34 |
34 |
##|-PRIV
|
35 |
35 |
|
36 |
|
require_once("guiconfig.inc");
|
37 |
|
|
38 |
|
$allow_query = !isset($config['ntpd']['noquery']);
|
39 |
|
if (!empty($config['ntpd']['restrictions']['row']) && is_array($config['ntpd']['restrictions']['row'])) {
|
40 |
|
foreach ($config['ntpd']['restrictions']['row'] as $v) {
|
41 |
|
if (ip_in_subnet('127.0.0.1', "{$v['acl_network']}/{$v['mask']}") ||
|
42 |
|
ip_in_subnet('::1', "{$v['acl_network']}/{$v['mask']}")) {
|
43 |
|
$allow_query = !isset($v['noquery']);
|
44 |
|
}
|
|
36 |
require_once('confib.inc');
|
|
37 |
require_once('config.lib.inc');
|
|
38 |
require_once('guiconfig.inc');
|
|
39 |
|
|
40 |
$allow_query = !config_path_enabled('ntpd','noquery');
|
|
41 |
foreach (config_get_path('ntpd/restrictions/row') as $v) {
|
|
42 |
if (ip_in_subnet('127.0.0.1', "{$v['acl_network']}/{$v['mask']}") ||
|
|
43 |
ip_in_subnet('::1', "{$v['acl_network']}/{$v['mask']}")) {
|
|
44 |
$allow_query = !isset($v['noquery']);
|
45 |
45 |
}
|
46 |
46 |
}
|
47 |
47 |
|
48 |
|
if ($allow_query && ($config['ntpd']['enable'] != 'disabled')) {
|
49 |
|
if (isset($config['system']['ipv6allow'])) {
|
|
48 |
if ($allow_query && (config_get_path('ntpd/enable') != 'disabled')) {
|
|
49 |
if (config_path_enabled('system','ipv6allow')) {
|
50 |
50 |
$inet_version = "";
|
51 |
51 |
} else {
|
52 |
52 |
$inet_version = " -4";
|
... | ... | |
171 |
171 |
}
|
172 |
172 |
}
|
173 |
173 |
|
174 |
|
if (isset($gps_ok) && isset($config['ntpd']['gps']['extstatus']) && ($config['ntpd']['gps']['nmeaset']['gpgsv'] || $config['ntpd']['gps']['nmeaset']['gpgga'])) {
|
175 |
|
$lookfor['GPGSV'] = $config['ntpd']['gps']['nmeaset']['gpgsv'];
|
176 |
|
$lookfor['GPGGA'] = !isset($gps_sat) && $config['ntpd']['gps']['nmeaset']['gpgga'];
|
|
174 |
if (isset($gps_ok) && config_path_enabled('ntpd/gps','extstatus') &&
|
|
175 |
(config_path_enabled('ntpd/gps/nmeaset','gpgsv') ||
|
|
176 |
config_path_enabled('ntpd/gps/nmeaset','gpgga'))) {
|
|
177 |
$lookfor['GPGSV'] = config_path_enabled('ntpd/gps/nmeaset','gpgsv');
|
|
178 |
$lookfor['GPGGA'] = !isset($gps_sat) && config_path_enabled('ntpd/gps/nmeaset','gpgga');
|
177 |
179 |
$gpsport = fopen('/dev/gps0', 'r+');
|
178 |
180 |
while ($gpsport && ($lookfor['GPGSV'] || $lookfor['GPGGA'])) {
|
179 |
181 |
$buffer = fgets($gpsport);
|
180 |
182 |
if ($lookfor['GPGSV'] && substr($buffer, 0, 6) == '$GPGSV') {
|
181 |
183 |
$gpgsv = explode(',', $buffer);
|
182 |
184 |
$gps_satview = (int)$gpgsv[3];
|
183 |
|
$lookfor['GPGSV'] = 0;
|
|
185 |
$lookfor['GPGSV'] = false;
|
184 |
186 |
} elseif ($lookfor['GPGGA'] && substr($buffer, 0, 6) == '$GPGGA') {
|
185 |
187 |
$gpgga = explode(',', $buffer);
|
186 |
188 |
$gps_sat = (int)$gpgga[7];
|
187 |
189 |
$gps_alt = $gpgga[9];
|
188 |
190 |
$gps_alt_unit = $gpgga[10];
|
189 |
|
$lookfor['GPGGA'] = 0;
|
|
191 |
$lookfor['GPGGA'] = false;
|
190 |
192 |
}
|
191 |
193 |
}
|
192 |
194 |
}
|
... | ... | |
204 |
206 |
}
|
205 |
207 |
|
206 |
208 |
function print_status() {
|
207 |
|
global $config, $ntpq_servers, $allow_query;
|
|
209 |
global $ntpq_servers, $allow_query;
|
208 |
210 |
|
209 |
|
if ($config['ntpd']['enable'] == 'disabled'):
|
|
211 |
if (config_get_path('ntpd/enable') == 'disabled'):
|
210 |
212 |
print("<tr>\n");
|
211 |
213 |
print('<td class="warning" colspan="11">');
|
212 |
214 |
printf(gettext('NTP Server is disabled'));
|
Replace direct config accesses in status_graph.php, status_ntpd.php