with `-v` to print version * banners (MMDVMHost, DMRGateway, DMR2YSF/NXDN, YSFGateway, * DGIdGateway, YSF2DMR/P25/NXDN, P25Gateway, NXDNGateway, * M17Gateway, DAPNETGateway). */ require_once($_SERVER['DOCUMENT_ROOT'].'/config/security_headers.php'); require_once($_SERVER['DOCUMENT_ROOT'].'/config/banner_warnings.inc'); setSecurityHeaders(); // Layer 2 of the default-password protection — see config/banner_warnings.inc. // MUST run BEFORE any output so header('Location: ...') works. pistar_warnings_enforce_redirect(); // 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] ); } ?> Pi-Star - <?php echo $lang['digital_voice']." ".$lang['dashboard']." - ".$lang['update'];?>
Pi-Star: / Dashboard:

Pi-Star -

| | | |

\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 " \n"; } // Filesystem Information if (count($system['partitions']) > 0) { echo " \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 " \n"; } } } // Binary Information echo " \n"; if (is_executable('/usr/local/bin/MMDVMHost')) { $MMDVMHost_Ver = exec('/usr/local/bin/MMDVMHost -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/DMRGateway')) { $DMRGateway_Ver = exec('/usr/local/bin/DMRGateway -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/DMR2YSF')) { $DMR2YSF_Ver = exec('/usr/local/bin/DMR2YSF -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/DMR2NXDN')) { $DMR2NXDN_Ver = exec('/usr/local/bin/DMR2NXDN -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/YSFGateway')) { $YSFGateway_Ver = exec('/usr/local/bin/YSFGateway -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/DGIdGateway')) { $DGIdGateway_Ver = exec('/usr/local/bin/DGIdGateway -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/YSF2DMR')) { $YSF2DMR_Ver = exec('/usr/local/bin/YSF2DMR -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/YSF2P25')) { $YSF2P25_Ver = exec('/usr/local/bin/YSF2P25 -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/YSF2NXDN')) { $YSF2NXDN_Ver = exec('/usr/local/bin/YSF2NXDN -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/P25Gateway')) { $P25Gateway_Ver = exec('/usr/local/bin/P25Gateway -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/NXDNGateway')) { $NXDNGateway_Ver = exec('/usr/local/bin/NXDNGateway -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/M17Gateway')) { $M17Gateway_Ver = exec('/usr/local/bin/M17Gateway -v | cut -d\' \' -f 3-'); echo " \n"; } if (is_executable('/usr/local/bin/DAPNETGateway')) { $DAPNETGateway_Ver = exec('/usr/local/bin/DAPNETGateway -v | cut -d\' \' -f 3-'); echo " \n"; } ?>
Pi-Star System Information
MemoryStats
RAM
Used ".$sysRamPercent."%
"; echo " Total: ".formatSize($system['mem_info']['MemTotal'])." Used: ".formatSize($sysRamUsed)." Free: ".formatSize($system['mem_info']['MemTotal'] - $sysRamUsed)."
MountStats
".$fs['Partition']['text']."
Used ".$diskPercent."%
"; echo " Total: ".formatSize($diskTotal)." Used: ".formatSize($diskUsed)." Free: ".formatSize($diskFree)."
BinaryVersion
MMDVMHost".$MMDVMHost_Ver."
DMRGateway".$DMRGateway_Ver."
DMR2YSF".$DMR2YSF_Ver."
DMR2NXDN".$DMR2NXDN_Ver."
YSFGateway".$YSFGateway_Ver."
DGIdGateway".$DGIdGateway_Ver."
YSF2DMR".$YSF2DMR_Ver."
YSF2P25".$YSF2P25_Ver."
YSF2NXDN".$YSF2NXDN_Ver."
P25Gateway".$P25Gateway_Ver."
NXDNGateway".$NXDNGateway_Ver."
M17Gateway".$M17Gateway_Ver."
DAPNETGateway".$DAPNETGateway_Ver."