7c93c30689
- Remove admin/config_backup.php (backup/restore page) and all nav links to it across the admin pages and the expert-mode shared header. - Remove factory reset: the full-device version in configure.php (JS confirm, POST handler that reset three git repos + wiped /etc config, and the hidden form) and the CSS-only version in expert/edit_dashboard.php. - Remove the PiStar-Remote and BM API full editors (admin/expert/fulledit_pistar-remote.php, fulledit_bmapikey.php) and their links from the expert-mode menu. - Add a "custom" option to the APRS server dropdown in configure.php so operators can type their own server + port instead of picking from APRSHosts.txt; wires the port through to ircDDBGateway, YSFGateway/YSF2DMR/YSF2NXDN/YSF2P25, and APRSGateway (previously only the hostname was ever configurable, port was hardcoded 14580). - Extend the POCSAG frequency band validator (functions.js) to also treat 150-160MHz as a valid/green range.
200 lines
9.8 KiB
PHP
200 lines
9.8 KiB
PHP
<?php
|
|
// Load the language support
|
|
require_once('config/language.php');
|
|
// Load the Pi-Star Release file
|
|
$pistarReleaseConfig = '/etc/pistar-release';
|
|
$configPistarRelease = array();
|
|
$configPistarRelease = parse_ini_file($pistarReleaseConfig, true);
|
|
// Load the Version Info
|
|
require_once('config/version.php');
|
|
|
|
// Retrieve server information
|
|
$system = system_information();
|
|
|
|
function system_information() {
|
|
@list($system, $host, $kernel) = preg_split('/[\s,]+/', php_uname('a'), 5);
|
|
$meminfo = false;
|
|
if (@is_readable('/proc/meminfo')) {
|
|
$data = explode("\n", file_get_contents("/proc/meminfo"));
|
|
$meminfo = array();
|
|
foreach ($data as $line) {
|
|
if (strpos($line, ':') !== false) {
|
|
list($key, $val) = explode(":", $line);
|
|
$meminfo[$key] = 1024 * floatval( trim( str_replace( ' kB', '', $val ) ) );
|
|
}
|
|
}
|
|
}
|
|
return array('date' => date('Y-m-d H:i:s T'),
|
|
'mem_info' => $meminfo,
|
|
'partitions' => disk_list()
|
|
);
|
|
}
|
|
|
|
function disk_list() {
|
|
$partitions = array();
|
|
// Fetch partition information from df command
|
|
// I would have used disk_free_space() and disk_total_space() here but
|
|
// there appears to be no way to get a list of partitions in PHP?
|
|
$output = array();
|
|
@exec('df --block-size=1', $output);
|
|
foreach($output as $line) {
|
|
$columns = array();
|
|
foreach(explode(' ', $line) as $column) {
|
|
$column = trim($column);
|
|
if($column != '') $columns[] = $column;
|
|
}
|
|
|
|
// Only process 6 column rows
|
|
// (This has the bonus of ignoring the first row which is 7)
|
|
if(count($columns) == 6) {
|
|
$partition = $columns[5];
|
|
$partitions[$partition]['Temporary']['bool'] = in_array($columns[0], array('tmpfs', 'devtmpfs'));
|
|
$partitions[$partition]['Partition']['text'] = $partition;
|
|
$partitions[$partition]['FileSystem']['text'] = $columns[0];
|
|
if(is_numeric($columns[1]) && is_numeric($columns[2]) && is_numeric($columns[3])) {
|
|
$partitions[$partition]['Size']['value'] = $columns[1];
|
|
$partitions[$partition]['Free']['value'] = $columns[3];
|
|
$partitions[$partition]['Used']['value'] = $columns[2];
|
|
}
|
|
else {
|
|
// Fallback if we don't get numerical values
|
|
$partitions[$partition]['Size']['text'] = $columns[1];
|
|
$partitions[$partition]['Used']['text'] = $columns[2];
|
|
$partitions[$partition]['Free']['text'] = $columns[3];
|
|
}
|
|
}
|
|
}
|
|
return $partitions;
|
|
}
|
|
|
|
function formatSize( $bytes ) {
|
|
$types = array( 'B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB' );
|
|
for( $i = 0; $bytes >= 1024 && $i < ( count( $types ) -1 ); $bytes /= 1024, $i++ );
|
|
return( round( $bytes, 2 ) . " " . $types[$i] );
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" lang="en">
|
|
<head>
|
|
<meta name="robots" content="index" />
|
|
<meta name="robots" content="follow" />
|
|
<meta name="language" content="English" />
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
<meta name="Author" content="Andrew Taylor (MW0MWZ)" />
|
|
<meta name="Description" content="CDN SysInfo" />
|
|
<meta name="KeyWords" content="CDN" />
|
|
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
|
|
<meta http-equiv="pragma" content="no-cache" />
|
|
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
|
|
<meta http-equiv="Expires" content="0" />
|
|
<title>CDN - <?php echo $lang['digital_voice']." ".$lang['dashboard']." - ".$lang['update'];?></title>
|
|
<link rel="stylesheet" type="text/css" href="css/pistar-css.php" />
|
|
<script type="text/javascript" src="/jquery.min.js"></script>
|
|
<script type="text/javascript" src="/jquery-timing.min.js"></script>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<div style="font-size: 8px; text-align: right; padding-right: 8px;">CDN:<?php echo $configPistarRelease['Pi-Star']['Version']?> / Dashboard:<?php echo $version; ?></div>
|
|
<h1>CDN - <?php echo $lang['digital_voice']." ".$lang['dashboard']." - SysInfo";?></h1>
|
|
<p style="padding-right: 5px; text-align: right; color: #ffffff;">
|
|
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
|
|
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> |
|
|
<a href="/admin/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a> |
|
|
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
|
|
</p>
|
|
</div>
|
|
<div class="contentwide">
|
|
<h2>CDN System Information</h2>
|
|
<?php
|
|
// Ram information
|
|
if ($system['mem_info']) {
|
|
echo " <h3>Memory</h3>\n <div class=\"settings-card\">\n";
|
|
$sysRamUsed = $system['mem_info']['MemTotal'] - $system['mem_info']['MemFree'] - $system['mem_info']['Buffers'] - $system['mem_info']['Cached'];
|
|
$sysRamPercent = sprintf('%.2f',($sysRamUsed / $system['mem_info']['MemTotal']) * 100);
|
|
echo " <div class=\"field-row\"><div>RAM</div><div>\n";
|
|
echo " <div class='meter'><div class='meter-bar' style='width: ".$sysRamPercent."%;'></div><span class='meter-label'>".$sysRamPercent."% used</span></div>\n";
|
|
echo " <div class=\"field-note\"><b>Total:</b> ".formatSize($system['mem_info']['MemTotal'])." <b>Used:</b> ".formatSize($sysRamUsed)." <b>Free:</b> ".formatSize($system['mem_info']['MemTotal'] - $sysRamUsed)."</div>\n";
|
|
echo " </div></div>\n </div>\n";
|
|
}
|
|
// Filesystem Information
|
|
if (count($system['partitions']) > 0) {
|
|
echo " <h3>Mounted Filesystems</h3>\n <div class=\"settings-card\">\n";
|
|
foreach($system['partitions'] as $fs) {
|
|
if ($fs['Used']['value'] > 0 && $fs['FileSystem']['text']!= "none" && $fs['FileSystem']['text']!= "udev") {
|
|
$diskFree = $fs['Free']['value'];
|
|
$diskTotal = $fs['Size']['value'];
|
|
$diskUsed = $fs['Used']['value'];
|
|
$diskPercent = sprintf('%.2f',($diskUsed / $diskTotal) * 100);
|
|
|
|
echo " <div class=\"field-row\"><div>".$fs['Partition']['text']."</div><div>\n";
|
|
echo " <div class='meter'><div class='meter-bar' style='width: ".$diskPercent."%;'></div><span class='meter-label'>".$diskPercent."% used</span></div>\n";
|
|
echo " <div class=\"field-note\"><b>Total:</b> ".formatSize($diskTotal)." <b>Used:</b> ".formatSize($diskUsed)." <b>Free:</b> ".formatSize($diskFree)."</div>\n";
|
|
echo " </div></div>\n";
|
|
}
|
|
}
|
|
echo " </div>\n";
|
|
}
|
|
// Binary Information
|
|
echo " <h3>Installed Binaries</h3>\n <div class=\"settings-card\">\n";
|
|
if (is_executable('/usr/local/bin/MMDVMHost')) {
|
|
$MMDVMHost_Ver = exec('/usr/local/bin/MMDVMHost -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>MMDVMHost</div><div>".$MMDVMHost_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/DMRGateway')) {
|
|
$DMRGateway_Ver = exec('/usr/local/bin/DMRGateway -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>DMRGateway</div><div>".$DMRGateway_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/DMR2YSF')) {
|
|
$DMR2YSF_Ver = exec('/usr/local/bin/DMR2YSF -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>DMR2YSF</div><div>".$DMR2YSF_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/DMR2NXDN')) {
|
|
$DMR2NXDN_Ver = exec('/usr/local/bin/DMR2NXDN -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>DMR2NXDN</div><div>".$DMR2NXDN_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/YSFGateway')) {
|
|
$YSFGateway_Ver = exec('/usr/local/bin/YSFGateway -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>YSFGateway</div><div>".$YSFGateway_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/DGIdGateway')) {
|
|
$DGIdGateway_Ver = exec('/usr/local/bin/DGIdGateway -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>DGIdGateway</div><div>".$DGIdGateway_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/YSF2DMR')) {
|
|
$YSF2DMR_Ver = exec('/usr/local/bin/YSF2DMR -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>YSF2DMR</div><div>".$YSF2DMR_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/YSF2P25')) {
|
|
$YSF2P25_Ver = exec('/usr/local/bin/YSF2P25 -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>YSF2P25</div><div>".$YSF2P25_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/YSF2NXDN')) {
|
|
$YSF2NXDN_Ver = exec('/usr/local/bin/YSF2NXDN -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>YSF2NXDN</div><div>".$YSF2NXDN_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/P25Gateway')) {
|
|
$P25Gateway_Ver = exec('/usr/local/bin/P25Gateway -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>P25Gateway</div><div>".$P25Gateway_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/NXDNGateway')) {
|
|
$NXDNGateway_Ver = exec('/usr/local/bin/NXDNGateway -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>NXDNGateway</div><div>".$NXDNGateway_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/M17Gateway')) {
|
|
$M17Gateway_Ver = exec('/usr/local/bin/M17Gateway -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>M17Gateway</div><div>".$M17Gateway_Ver."</div></div>\n";
|
|
}
|
|
if (is_executable('/usr/local/bin/DAPNETGateway')) {
|
|
$DAPNETGateway_Ver = exec('/usr/local/bin/DAPNETGateway -v | cut -d\' \' -f 3-');
|
|
echo " <div class=\"field-row\"><div>DAPNETGateway</div><div>".$DAPNETGateway_Ver."</div></div>\n";
|
|
}
|
|
echo " </div>\n";
|
|
?>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|