Remove backup/restore and factory reset; add APRS/POCSAG custom settings

- 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.
This commit is contained in:
2026-07-21 14:41:30 +08:00
parent 0c4bed5b6f
commit 7c93c30689
12 changed files with 48 additions and 577 deletions
-1
View File
@@ -277,7 +277,6 @@ if ($_SERVER["PHP_SELF"] == "/admin/calibration.php") {
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> | <a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></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/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a> |
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a> <a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
</p> </p>
</div> </div>
-267
View File
@@ -1,267 +0,0 @@
<?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');
// Sanity Check that this file has been opened correctly
if ($_SERVER["PHP_SELF"] == "/admin/config_backup.php") {
// Sanity Check Passed.
header('Cache-Control: no-cache');
session_start();
?>
<!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 Power" />
<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['backup_restore'];?></title>
<link rel="stylesheet" type="text/css" href="css/pistar-css.php" />
</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']?> / <?php echo $lang['dashboard'].": ".$version; ?></div>
<h1>CDN <?php echo $lang['digital_voice']." - ".$lang['backup_restore'];?></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><?php echo $lang['backup_restore'];?></h2>
<?php if (!empty($_POST)) {
echo '<div class="settings-card">'."\n";
if ( escapeshellcmd($_POST["action"]) == "download" ) {
$output = "Finding config files to be backed up\n";
$backupDir = "/tmp/config_backup";
$backupZip = "/tmp/config_backup.zip";
$hostNameInfo = exec('cat /etc/hostname');
$output .= shell_exec("sudo rm -rf $backupZip 2>&1");
$output .= shell_exec("sudo rm -rf $backupDir 2>&1");
$output .= shell_exec("sudo mkdir $backupDir 2>&1");
if (shell_exec('cat /etc/dhcpcd.conf | grep "static ip_address" | grep -v "#"')) {
$output .= shell_exec("sudo cp /etc/dhcpcd.conf $backupDir 2>&1");
}
$output .= shell_exec("sudo cp /etc/wpa_supplicant/wpa_supplicant.conf $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/ircddbgateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/mmdvmhost $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/dstarrepeater $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/dapnetgateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/p25gateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/m17gateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/ysfgateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/ysf2dmr $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/dgidgateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/nxdngateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/dmrgateway $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/mobilegps $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/starnetserver $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/timeserver $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/dstar-radio.* $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/pistar-remote $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/hosts $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/hostname $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/bmapi.key $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/dapnetapi.key $backupDir 2>&1");
$output .= shell_exec("sudo cp /etc/pistar-css.ini $backupDir 2>&1");
$output .= shell_exec("sudo cp /usr/local/etc/RSSI.dat $backupDir 2>&1");
$output .= shell_exec("sudo cp /var/www/dashboard/config/ircddblocal.php $backupDir 2>&1");
$output .= shell_exec("sudo cp /var/www/dashboard/config/config.php $backupDir 2>&1");
$output .= "Compressing backup files\n";
$output .= shell_exec("sudo zip -j $backupZip $backupDir/* 2>&1");
$output .= "Starting download\n";
echo "<pre>$output</pre>\n";
if (file_exists($backupZip)) {
$utc_time = gmdate('Y-m-d H:i:s');
$utc_tz = new DateTimeZone('UTC');
$local_tz = new DateTimeZone(date_default_timezone_get ());
$dt = new DateTime($utc_time, $utc_tz);
$dt->setTimeZone($local_tz);
$local_time = $dt->format('Y-M-d');
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
if ($hostNameInfo != "cdn") {
header('Content-Disposition: attachment; filename="'.basename("CDN_Config_".$hostNameInfo."_".$local_time.".zip").'"');
}
else {
header('Content-Disposition: attachment; filename="'.basename("CDN_Config_$local_time.zip").'"');
}
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($backupZip));
ob_clean();
flush();
readfile($backupZip);
exit;
}
};
if ( escapeshellcmd($_POST["action"]) == "restore" ) {
$output = "Uploading your Config data\n";
$target_dir = "/tmp/config_restore/";
shell_exec("sudo rm -rf $target_dir 2>&1");
shell_exec("mkdir $target_dir 2>&1");
if($_FILES["fileToUpload"]["name"]) {
$filename = $_FILES["fileToUpload"]["name"];
$source = $_FILES["fileToUpload"]["tmp_name"];
$type = $_FILES["fileToUpload"]["type"];
$name = explode(".", $filename);
$accepted_types = array('application/zip', 'application/x-zip-compressed', 'multipart/x-zip', 'application/x-compressed');
foreach($accepted_types as $mime_type) {
if($mime_type == $type) {
$okay = true;
break;
}
}
}
$continue = strtolower($name[1]) == 'zip' ? true : false;
if(!$continue) {
$output .= "The file you are trying to upload is not a .zip file. Please try again.\n";
}
$target_path = $target_dir.$filename;
if(move_uploaded_file($source, $target_path)) {
$zip = new ZipArchive();
$x = $zip->open($target_path);
if ($x === true) {
$zip->extractTo($target_dir); // change this to the correct site path
$zip->close();
unlink($target_path);
}
$output .= "Your .zip file was uploaded and unpacked.\n";
$output .= "Stopping Services.\n";
// Stop the DV Services
shell_exec('sudo systemctl stop cron.service 2>&1'); //Cron
shell_exec('sudo systemctl stop dstarrepeater.service 2>&1'); //D-Star Radio Service
shell_exec('sudo systemctl stop mmdvmhost.service 2>&1'); //MMDVMHost Radio Service
shell_exec('sudo systemctl stop ircddbgateway.service 2>&1'); //ircDDBGateway Service
shell_exec('sudo systemctl stop timeserver.service 2>&1'); //Time Server Service
shell_exec('sudo systemctl stop pistar-watchdog.service 2>&1'); //PiStar-Watchdog Service
shell_exec('sudo systemctl stop pistar-remote.service 2>&1'); //PiStar-Remote Service
shell_exec('sudo systemctl stop ysfgateway.service 2>&1'); //YSFGateway
shell_exec('sudo systemctl stop ysf2dmr.service 2>&1'); //YSF2DMR
shell_exec('sudo systemctl stop p25gateway.service 2>&1'); //P25Gateway
shell_exec('sudo systemctl stop nxdngateway.service 2>&1'); //NXDNGateway
shell_exec('sudo systemctl stop m17gateway.service 2>&1'); //M17Gateway
shell_exec('sudo systemctl stop dapnetgateway.service 2>&1'); //DAPNETGateway
shell_exec('sudo systemctl stop mobilegps.service 2>&1'); //MobileGPS
// Make the disk Writable
shell_exec('sudo mount -o remount,rw / 2>&1');
// Overwrite the configs
$output .= "Writing new Config\n";
$output .= shell_exec("sudo rm -f /etc/dstar-radio.* 2>&1")."\n";
$output .= shell_exec("sudo mv -f /tmp/config_restore/RSSI.dat /usr/local/etc/ 2>&1")."\n";
$output .= shell_exec("sudo mv -f /tmp/config_restore/ircddblocal.php /var/www/dashboard/config/ 2>&1")."\n";
$output .= shell_exec("sudo mv -f /tmp/config_restore/config.php /var/www/dashboard/config/ 2>&1")."\n";
$output .= shell_exec("sudo mv -v -f /tmp/config_restore/wpa_supplicant.conf /etc/wpa_supplicant/ 2>&1")."\n";
$output .= shell_exec("sudo mv -v -f /tmp/config_restore/* /etc/ 2>&1")."\n";
//Restore the Timezone Config
$timeZone = shell_exec('grep date /var/www/dashboard/config/config.php | grep -o "\'.*\'" | sed "s/\'//g"');
$timeZone = preg_replace( "/\r|\n/", "", $timeZone); //Remove the linebreaks
shell_exec('sudo timedatectl set-timezone '.$timeZone.' 2>&1');
//Restore ircDDGBateway Link Manager Password
$ircRemotePassword = shell_exec('grep remotePassword /etc/ircddbgateway | awk -F\'=\' \'{print $2}\'');
shell_exec('sudo sed -i "/password=/c\\password='.$ircRemotePassword.'" /root/.Remote\ Control');
// Make the disk Read-Only
shell_exec('sudo mount -o remount,ro / 2>&1');
// Start the services
$output .= "Starting Services.\n";
shell_exec('sudo systemctl start dstarrepeater.service 2>&1'); //D-Star Radio Service
shell_exec('sudo systemctl start mmdvmhost.service 2>&1'); //MMDVMHost Radio Service
shell_exec('sudo systemctl start ircddbgateway.service 2>&1'); //ircDDBGateway Service
shell_exec('sudo systemctl start timeserver.service 2>&1'); //Time Server Service
shell_exec('sudo systemctl start pistar-watchdog.service 2>&1'); //PiStar-Watchdog Service
shell_exec('sudo systemctl start pistar-remote.service 2>&1'); //PiStar-Remote Service
if (substr(exec('grep "pistar-upnp.service" /etc/crontab | cut -c 1'), 0, 1) !== '#') {
shell_exec('sudo systemctl start pistar-upnp.service 2>&1'); //PiStar-UPnP Service
}
shell_exec('sudo systemctl start ysfgateway.service 2>&1'); //YSFGateway
shell_exec('sudo systemctl start ysf2dmr.service 2>&1'); //YSF2DMR
shell_exec('sudo systemctl start p25gateway.service 2>&1'); //P25Gateway
shell_exec('sudo systemctl start nxdngateway.service 2>&1'); //NXDNGateway
shell_exec('sudo systemctl start m17gateway.service 2>&1'); //M17Gateway
shell_exec('sudo systemctl start dapnetgateway.service 2>&1'); //DAPNETGateway
shell_exec('sudo systemctl start mobilegps.service 2>&1'); //MobileGPS
shell_exec('sudo systemctl start cron.service 2>&1'); //Cron
// Complete
$output .= "Configuration Restore Complete.\n";
}
else {
$output .= "There was a problem with the upload. Please try again.<br />";
$output .= "\n".'<button onclick="goBack()">Go Back</button><br />'."\n";
$output .= '<script>'."\n";
$output .= 'function goBack() {'."\n";
$output .= ' window.history.back();'."\n";
$output .= '}'."\n";
$output .= '</script>'."\n";
}
echo "<pre>$output</pre>\n";
};
echo "</div>\n";
} else { ?>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post" enctype="multipart/form-data">
<div class="settings-card action-tiles">
<button class="action-tile" name="action" value="download">
<img src="/images/download.png" alt="Download Config" />
<span>Download Configuration</span>
</button>
<div class="action-tile action-tile-upload">
<img src="/images/restore.png" alt="Restore Config" />
<span>Restore Configuration</span>
<input type="file" name="fileToUpload" id="fileToUpload" />
<button type="submit" name="action" value="restore">Upload &amp; Restore</button>
</div>
</div>
<div class="settings-card">
<div class="field-row"><div class="field-note" style="flex:1 1 100%;">
<b>WARNING:</b> Editing the files outside of CDN *could* have un-desireable side effects.<br />
This backup and restore tool will back up your config files to a Zip file, and allow you to restore them later, either to this CDN or another one.
<ul>
<li>System Passwords / Dashboard passwords are NOT backed up / restored.</li>
<li>Wireless Configuration IS backed up and restored</li>
</ul>
</div></div>
</div>
</form>
<?php } ?>
</div>
</div>
</body>
</html>
<?php
}
?>
+44 -52
View File
@@ -203,19 +203,12 @@ $MYCALL=strtoupper($configs['gatewayCallsign']);
disablesubmitbuttons(); disablesubmitbuttons();
document.getElementById("autoApPassForm").submit(); document.getElementById("autoApPassForm").submit();
} }
function factoryReset() {
if (confirm('WARNING: This will set all your settings back to factory defaults. WiFi setup will be retained to maintain network access to this Pi.\n\nAre you SURE you want to do this?\n\nPress OK to restore the factory configuration\nPress Cancel to go back.')) {
document.getElementById("factoryReset").submit();
} else {
return false;
}
}
function resizeIframe(obj) { function resizeIframe(obj) {
var numpix = parseInt(obj.contentWindow.document.body.scrollHeight, 10); var numpix = parseInt(obj.contentWindow.document.body.scrollHeight, 10);
obj.style.height = numpix + 'px'; obj.style.height = numpix + 'px';
} }
</script> </script>
<script type="text/javascript" src="/functions.js?version=1.715"></script> <script type="text/javascript" src="/functions.js?version=1.717"></script>
</head> </head>
<body onload="checkFrequency(); return false;"> <body onload="checkFrequency(); return false;">
<?php <?php
@@ -253,9 +246,7 @@ if (file_exists($bmAPIkeyFile) && fopen($bmAPIkeyFile,'r')) {
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> | <a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> |
<a href="/admin/expert/" style="color: #ffffff;">专家模式</a> | <a href="/admin/expert/" style="color: #ffffff;">专家模式</a> |
<a href="/admin/calibration.php" style="color: #ffffff;">校准</a> | <a href="/admin/calibration.php" style="color: #ffffff;">校准</a> |
<a href="/admin/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a> | <a href="/admin/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a>
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
<a href="javascript:factoryReset();" style="color: #ffffff;"><?php echo $lang['factory_reset'];?></a>
</p> </p>
</div> </div>
<div class="contentwide"> <div class="contentwide">
@@ -361,33 +352,6 @@ if ($_SERVER["PHP_SELF"] == "/admin/configure.php") {
// Let the services actualy stop // Let the services actualy stop
sleep(1); sleep(1);
// Factory Reset Handler Here
if (empty($_POST['factoryReset']) != TRUE ) {
echo "<br />\n";
echo "<div class=\"settings-card\" style=\"max-width:480px;margin:24px auto;text-align:center;\">\n";
echo "<table>\n";
echo "<tr><th>Factory Reset Config</th></tr>\n";
echo "<tr><td>Loading fresh configuration file(s)...</td><tr>\n";
echo "</table>\n";
echo "</div>\n";
unset($_POST);
// Over-write the config files with the clean copies
exec('sudo unzip -o /usr/local/bin/config_clean.zip -d /etc/');
exec('sudo rm -rf /etc/dstar-radio.*');
exec('sudo rm -rf /etc/pistar-css.ini');
exec('sudo git --work-tree=/usr/local/sbin --git-dir=/usr/local/sbin/.git update-index --assume-unchanged pistar-upnp.service');
exec('sudo git --work-tree=/usr/local/sbin --git-dir=/usr/local/sbin/.git reset --hard origin/master');
exec('sudo git --work-tree=/usr/local/bin --git-dir=/usr/local/bin/.git reset --hard origin/master');
exec('sudo git --work-tree=/var/www/dashboard --git-dir=/var/www/dashboard/.git reset --hard origin/master');
echo '<script type="text/javascript">setTimeout(function() { window.location=window.location;},5000);</script>';
// Make the root filesystem read-only
system('sudo sync && sudo sync && sudo sync && sudo mount -o remount,ro /');
echo "<br />\n</div>\n";
echo "</div>\n</body>\n</html>\n";
die();
}
// Handle the case where the config is not read correctly // Handle the case where the config is not read correctly
if (count($configmmdvm) <= 18) { if (count($configmmdvm) <= 18) {
echo "<br />\n"; echo "<br />\n";
@@ -550,18 +514,41 @@ if ($_SERVER["PHP_SELF"] == "/admin/configure.php") {
// Set the APRS Host for ircDDBGateway // Set the APRS Host for ircDDBGateway
if (empty($_POST['selectedAPRSHost']) != TRUE ) { if (empty($_POST['selectedAPRSHost']) != TRUE ) {
$rollAPRSHost = 'sudo sed -i "/aprsHostname=/c\\aprsHostname='.escapeshellcmd($_POST['selectedAPRSHost']).'" /etc/ircddbgateway'; // "custom" lets the operator type their own APRS-IS server + port
// instead of picking from /usr/local/etc/APRSHosts.txt (which is
// always port 14580). Validate both before use: the value is
// still run through escapeshellcmd() below, but a hostname
// containing "/" would break the sed "/pattern/c\..." syntax
// (sed's default delimiter), so reject anything that isn't a
// plain hostname/IP up front rather than relying on
// escapeshellcmd() alone.
if ($_POST['selectedAPRSHost'] === 'custom' && !empty($_POST['customAPRSHost']) && preg_match('/^[A-Za-z0-9.\-]+$/', trim($_POST['customAPRSHost']))) {
$aprsHost = escapeshellcmd(trim($_POST['customAPRSHost']));
$aprsPort = (!empty($_POST['customAPRSPort']) && ctype_digit(trim($_POST['customAPRSPort'])) && (int)trim($_POST['customAPRSPort']) >= 1 && (int)trim($_POST['customAPRSPort']) <= 65535) ? trim($_POST['customAPRSPort']) : '14580';
} else {
$aprsHost = escapeshellcmd($_POST['selectedAPRSHost']);
$aprsPort = '14580';
}
$rollAPRSHost = 'sudo sed -i "/aprsHostname=/c\\aprsHostname='.$aprsHost.'" /etc/ircddbgateway';
system($rollAPRSHost); system($rollAPRSHost);
$configysfgateway['aprs.fi']['Server'] = escapeshellcmd($_POST['selectedAPRSHost']); $rollAPRSPort = 'sudo sed -i "/^aprsPort=/c\\aprsPort='.$aprsPort.'" /etc/ircddbgateway';
$configysf2dmr['aprs.fi']['Server'] = escapeshellcmd($_POST['selectedAPRSHost']); system($rollAPRSPort);
$configysf2nxdn['aprs.fi']['Server'] = escapeshellcmd($_POST['selectedAPRSHost']); $configysfgateway['aprs.fi']['Server'] = $aprsHost;
$configysf2p25['aprs.fi']['Server'] = escapeshellcmd($_POST['selectedAPRSHost']); $configysfgateway['aprs.fi']['Port'] = $aprsPort;
$configysf2dmr['aprs.fi']['Server'] = $aprsHost;
$configysf2dmr['aprs.fi']['Port'] = $aprsPort;
$configysf2nxdn['aprs.fi']['Server'] = $aprsHost;
$configysf2nxdn['aprs.fi']['Port'] = $aprsPort;
$configysf2p25['aprs.fi']['Server'] = $aprsHost;
$configysf2p25['aprs.fi']['Port'] = $aprsPort;
$configysf2dmr['aprs.fi']['Enable'] = "0"; $configysf2dmr['aprs.fi']['Enable'] = "0";
$configysf2nxdn['aprs.fi']['Enable'] = "0"; $configysf2nxdn['aprs.fi']['Enable'] = "0";
$configysf2p25['aprs.fi']['Enable'] = "0"; $configysf2p25['aprs.fi']['Enable'] = "0";
if ($configPistarRelease['Pi-Star']['Version'] >= "4.1.4") { if ($configPistarRelease['Pi-Star']['Version'] >= "4.1.4") {
$rollAPRSGatewayHost = 'sudo sed -i "/Server=/c\\Server='.escapeshellcmd($_POST['selectedAPRSHost']).'" /etc/aprsgateway'; $rollAPRSGatewayHost = 'sudo sed -i "/Server=/c\\Server='.$aprsHost.'" /etc/aprsgateway';
system($rollAPRSGatewayHost); system($rollAPRSGatewayHost);
$rollAPRSGatewayPort = 'sudo sed -i "/^Port=/c\\Port='.$aprsPort.'" /etc/aprsgateway';
system($rollAPRSGatewayPort);
} }
} }
@@ -3604,10 +3591,6 @@ else:
$toggleircddbEnabledCr = ""; $toggleircddbEnabledCr = "";
} }
?> ?>
<form id="factoryReset" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<div><input type="hidden" name="factoryReset" value="1" /></div>
</form>
<form id="config" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post"> <form id="config" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<h2><?php echo $lang['control_software'];?></h2> <h2><?php echo $lang['control_software'];?></h2>
<div class="settings-card"> <div class="settings-card">
@@ -4069,22 +4052,31 @@ else:
} }
} ?> } ?>
<div class="field-row"> <div class="field-row">
<div align="left"><a class="tooltip2" href="#"><?php echo $lang['aprs_host'];?>:<span><b>APRS Host</b>Set your prefered APRS host here.</span></a></div> <div align="left"><a class="tooltip2" href="#"><?php echo $lang['aprs_host'];?>:<span><b>APRS Host</b>Set your prefered APRS host here, or pick "自定义" to type your own server + port.</span></a></div>
<div colspan="2" style="text-align: left;"><select name="selectedAPRSHost"> <div colspan="2" style="text-align: left;">
<select name="selectedAPRSHost" onchange="document.getElementById('customAPRSFields').style.display = (this.value == 'custom') ? 'inline' : 'none';">
<?php <?php
$testAPSRHost = $configs['aprsHostname']; $testAPSRHost = $configs['aprsHostname'];
$aprsHostIsCustom = true;
$aprsHostFile = fopen("/usr/local/etc/APRSHosts.txt", "r"); $aprsHostFile = fopen("/usr/local/etc/APRSHosts.txt", "r");
while (!feof($aprsHostFile)) { while (!feof($aprsHostFile)) {
$aprsHostFileLine = fgets($aprsHostFile); $aprsHostFileLine = fgets($aprsHostFile);
$aprsHost = preg_split('/:/', $aprsHostFileLine); $aprsHost = preg_split('/:/', $aprsHostFileLine);
if ((strpos($aprsHost[0], ';') === FALSE ) && ($aprsHost[0] != '')) { if ((strpos($aprsHost[0], ';') === FALSE ) && ($aprsHost[0] != '')) {
if ($testAPSRHost == $aprsHost[0]) { echo " <option value=\"$aprsHost[0]\" selected=\"selected\">$aprsHost[0]</option>\n"; } if ($testAPSRHost == $aprsHost[0]) { echo " <option value=\"$aprsHost[0]\" selected=\"selected\">$aprsHost[0]</option>\n"; $aprsHostIsCustom = false; }
else { echo " <option value=\"$aprsHost[0]\">$aprsHost[0]</option>\n"; } else { echo " <option value=\"$aprsHost[0]\">$aprsHost[0]</option>\n"; }
} }
} }
fclose($aprsHostFile); fclose($aprsHostFile);
echo " <option value=\"custom\"".($aprsHostIsCustom ? " selected=\"selected\"" : "").">自定义 (Custom)</option>\n";
?> ?>
</select></div> </select>
<span id="customAPRSFields" style="display:<?php echo $aprsHostIsCustom ? 'inline' : 'none'; ?>;">
<input type="text" name="customAPRSHost" placeholder="server.example.com" size="22" maxlength="64" value="<?php echo $aprsHostIsCustom ? htmlspecialchars(trim($testAPSRHost), ENT_QUOTES, 'UTF-8') : ''; ?>" />
:
<input type="text" name="customAPRSPort" placeholder="14580" size="6" maxlength="5" value="<?php echo htmlspecialchars(trim(isset($configs['aprsPort']) ? $configs['aprsPort'] : '14580'), ENT_QUOTES, 'UTF-8'); ?>" />
</span>
</div>
</div> </div>
<div class="field-row"> <div class="field-row">
<div align="left"><a class="tooltip2" href="#"><?php echo $lang['timezone'];?>:<span><b>System TimeZone</b>Set the system timezone</span></a></div> <div align="left"><a class="tooltip2" href="#"><?php echo $lang['timezone'];?>:<span><b>System TimeZone</b>Set the system timezone</span></a></div>
+2 -34
View File
@@ -25,16 +25,6 @@ require_once('../config/version.php');
<meta http-equiv="Expires" content="0" /> <meta http-equiv="Expires" content="0" />
<title>CDN - Digital Voice Dashboard - Expert Editor</title> <title>CDN - Digital Voice Dashboard - Expert Editor</title>
<link rel="stylesheet" type="text/css" href="../css/pistar-css.php" /> <link rel="stylesheet" type="text/css" href="../css/pistar-css.php" />
<script type="text/javascript">
function factoryReset()
{
if (confirm('WARNING: This will set these settings back to factory defaults.\n\nAre you SURE you want to do this?\n\nPress OK to restore the factory configuration\nPress Cancel to go back.')) {
document.getElementById("factoryReset").submit();
} else {
return false;
}
}
</script>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
@@ -74,24 +64,8 @@ $filepath = '/tmp/bW1kd4jg6b3N0DQo.tmp';
//after the form submit //after the form submit
if($_POST) { if($_POST) {
$data = $_POST; $data = $_POST;
// Factory Reset Handler Here //update ini file, call function
if (empty($_POST['factoryReset']) != TRUE ) { update_ini_file($data, $filepath);
echo "<br />\n";
echo "<div class=\"settings-card\">\n";
echo "<h3>Factory Reset Config</h3>\n";
echo "<div>Loading fresh configuration file(s)...</div>\n";
echo "</div>\n";
unset($_POST);
//Reset the config
exec('sudo mount -o remount,rw /'); // Make rootfs writable
exec('sudo rm -rf /etc/pistar-css.ini'); // Delete the Config
exec('sudo mount -o remount,ro /'); // Make rootfs read-only
echo '<script type="text/javascript">setTimeout(function() { window.location=window.location;},0);</script>';
die();
} else {
//update ini file, call function
update_ini_file($data, $filepath);
}
} }
//this is the function going to update your ini file //this is the function going to update your ini file
@@ -174,12 +148,6 @@ echo '<form action="" method="post">'."\n";
echo '<div class="field-actions"><input type="submit" value="'.$lang['apply'].'" /></div>'."\n"; echo '<div class="field-actions"><input type="submit" value="'.$lang['apply'].'" /></div>'."\n";
} }
echo "</form>"; echo "</form>";
echo "<br />\n";
echo 'if you took it all too far and now it makes you feel sick, click below to reset the changes made on this page, this will ONLY reset the CSS settings above and will not change any other settings or configuration.'."\n";
echo '<form id="factoryReset" action="" method="post">'."\n";
echo ' <div><input type="hidden" name="factoryReset" value="1" /></div>'."\n";
echo '</form>'."\n";
echo '<input type="button" onclick="javascript:factoryReset();" value="'.$lang['factory_reset'].'" />'."\n";
?> ?>
</div> </div>
-130
View File
@@ -1,130 +0,0 @@
<?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');
?>
<!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 Expert Editor" />
<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 - Digital Voice Dashboard - Expert Editor</title>
<link rel="stylesheet" type="text/css" href="../css/pistar-css.php" />
</head>
<body>
<div class="container">
<?php include './header-menu.inc'; ?>
<div class="contentwide">
<?php
//Do some file wrangling...
if (file_exists('/etc/bmapi.key')) {
exec('sudo cp /etc/bmapi.key /tmp/d39fk36sg55433gd.tmp');
} else {
exec('sudo touch /tmp/d39fk36sg55433gd.tmp');
exec('sudo echo "[key]" > /tmp/d39fk36sg55433gd.tmp');
exec('sudo echo "apikey=None" >> /tmp/d39fk36sg55433gd.tmp');
}
exec('sudo chown www-data:www-data /tmp/d39fk36sg55433gd.tmp');
exec('sudo chmod 664 /tmp/d39fk36sg55433gd.tmp');
//ini file to open
$filepath = '/tmp/d39fk36sg55433gd.tmp';
//after the form submit
if($_POST) {
$data = $_POST;
//update ini file, call function
update_ini_file($data, $filepath);
}
//this is the function going to update your ini file
function update_ini_file($data, $filepath) {
$content = "";
//parse the ini file using default parse_ini_file() PHP function
$parsed_ini = parse_ini_file($filepath, true);
foreach($data as $section=>$values) {
// UnBreak special cases
$section = str_replace("_", " ", $section);
$content .= "[".$section."]\n";
//append the values
foreach($values as $key=>$value) {
if ($value == '') {
$content .= $key."=none\n";
} else {
$content .= $key."=".$value."\n";
}
}
$content .= "\n";
}
//write it into file
if (!$handle = fopen($filepath, 'w')) {
return false;
}
$success = fwrite($handle, $content);
fclose($handle);
// Updates complete - copy the working file back to the proper location
exec('sudo mount -o remount,rw /'); // Make rootfs writable
exec('sudo mv /tmp/d39fk36sg55433gd.tmp /etc/bmapi.key'); // Move the file back
exec('sudo chmod 644 /etc/bmapi.key'); // Set the correct runtime permissions
exec('sudo chown root:root /etc/bmapi.key'); // Set the owner
exec('sudo mount -o remount,ro /'); // Make rootfs read-only
return $success;
}
//parse the ini file using default parse_ini_file() PHP function
$parsed_ini = parse_ini_file($filepath, true);
if (!isset($parsed_ini['key']['apikey'])) { $parsed_ini['key']['apikey'] = ""; }
echo '<form action="" method="post">'."\n";
foreach($parsed_ini as $section=>$values) {
// keep the section as hidden text so we can update once the form submitted
echo "<input type=\"hidden\" value=\"$section\" name=\"$section\" />\n";
echo "<div class=\"settings-card\">\n";
echo "<h3>$section</h3>\n";
// print all other values as input fields, so can edit.
// note the name='' attribute it has both section and key
foreach($values as $key=>$value) {
if (($key == "Options") || ($value)) {
echo "<div class=\"field-row\"><div>$key</div><div><textarea name=\"{$section}[$key]\" cols=\"60\" rows=\"13\">$value</textarea></div></div>\n";
}
elseif (($key == "Display") && ($value == '')) {
echo "<div class=\"field-row\"><div>$key</div><div><textarea name=\"{$section}[$key]\" cols=\"60\" rows=\"13\">$value</textarea></div></div>\n";
}
else {
echo "<div class=\"field-row\"><div>$key</div><div><textarea name=\"{$section}[$key]\" cols=\"60\" rows=\"13\">$value</textarea></div></div>\n";
}
}
echo "</div>\n";
echo '<input type="submit" value="'.$lang['apply'].'" />'."\n";
echo "<br />\n";
}
echo "</form>";
?>
</div>
</div>
</body>
</html>
-85
View File
@@ -1,85 +0,0 @@
<?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');
?>
<!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 Expert Editor" />
<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 - Digital Voice Dashboard - Expert Editor</title>
<link rel="stylesheet" type="text/css" href="../css/pistar-css.php" />
</head>
<body>
<div class="container">
<?php include './header-menu.inc'; ?>
<div class="contentwide">
<?php
if(isset($_POST['data'])) {
// File Wrangling
exec('sudo cp /etc/pistar-remote /tmp/fmehg65934eg.tmp');
exec('sudo chown www-data:www-data /tmp/fmehg65934eg.tmp');
exec('sudo chmod 664 /tmp/fmehg65934eg.tmp');
// Open the file and write the data
$filepath = '/tmp/fmehg65934eg.tmp';
$fh = fopen($filepath, 'w');
fwrite($fh, $_POST['data']);
fclose($fh);
exec('sudo mount -o remount,rw /');
exec('sudo cp /tmp/fmehg65934eg.tmp /etc/pistar-remote');
exec('sudo chmod 644 /etc/pistar-remote');
exec('sudo chown root:root /etc/pistar-remote');
exec('sudo mount -o remount,ro /');
// Reload the affected daemon
exec('sudo systemctl restart pistar-remote.service'); // Reload the daemon
// Re-open the file and read it
$fh = fopen($filepath, 'r');
$theData = fread($fh, filesize($filepath));
} else {
// File Wrangling
exec('sudo cp /etc/pistar-remote /tmp/fmehg65934eg.tmp');
exec('sudo chown www-data:www-data /tmp/fmehg65934eg.tmp');
exec('sudo chmod 664 /tmp/fmehg65934eg.tmp');
// Open the file and read it
$filepath = '/tmp/fmehg65934eg.tmp';
$fh = fopen($filepath, 'r');
$theData = fread($fh, filesize($filepath));
}
fclose($fh);
?>
<h2>PiStar-Remote (Full Edit)</h2>
<div class="settings-card" style="padding-top:16px;">
<form name="test" method="post" action="">
<textarea class="raw-editor" name="data"><?php echo $theData; ?></textarea><br />
<div class="field-actions"><input type="submit" name="submit" value="<?php echo $lang['apply']; ?>" /></div>
</form>
</div>
</div>
</div>
</body>
</html>
-3
View File
@@ -4,7 +4,6 @@
<p style="padding-right: 5px; text-align: right; color: #ffffff;"> <p style="padding-right: 5px; text-align: right; color: #ffffff;">
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> | <a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> | <a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> |
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a> <a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
</p> </p>
<p style="padding-right: 5px; text-align: right; color: #ffffff;"> <p style="padding-right: 5px; text-align: right; color: #ffffff;">
@@ -20,9 +19,7 @@
<a href="edit_dapnetgateway.php" style="color: #ffffff;">DAPNET 网关</a><br /> <a href="edit_dapnetgateway.php" style="color: #ffffff;">DAPNET 网关</a><br />
<b>完整编辑:</b> <b>完整编辑:</b>
<a href="fulledit_dmrgateway.php" style="color: #ffffff;">DMR 网关</a> | <a href="fulledit_dmrgateway.php" style="color: #ffffff;">DMR 网关</a> |
<a href="fulledit_pistar-remote.php" style="color: #ffffff;">PiStar-Remote</a> |
<a href="fulledit_wpaconfig.php" style="color: #ffffff;">WiFi</a> | <a href="fulledit_wpaconfig.php" style="color: #ffffff;">WiFi</a> |
<a href="fulledit_bmapikey.php" style="color: #ffffff;">BM API</a> |
<a href="fulledit_dapnetapi.php" style="color: #ffffff;">DAPNET API</a> | <a href="fulledit_dapnetapi.php" style="color: #ffffff;">DAPNET API</a> |
<a href="fulledit_cron.php" style="color: #ffffff;">系统 Cron 任务</a> | <a href="fulledit_cron.php" style="color: #ffffff;">系统 Cron 任务</a> |
<a href="fulledit_rssidat.php" style="color: #ffffff;">RSSI 数据</a> <a href="fulledit_rssidat.php" style="color: #ffffff;">RSSI 数据</a>
-1
View File
@@ -94,7 +94,6 @@ if ($_SERVER["PHP_SELF"] == "/admin/live_modem_log.php") {
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> | <a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></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/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a> |
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a> <a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
</p> </p>
</div> </div>
-1
View File
@@ -40,7 +40,6 @@ if ($_SERVER["PHP_SELF"] == "/admin/power.php") {
<p style="padding-right: 5px; text-align: right; color: #ffffff;"> <p style="padding-right: 5px; text-align: right; color: #ffffff;">
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> | <a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> | <a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></a> |
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a> <a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
</p> </p>
</div> </div>
-1
View File
@@ -103,7 +103,6 @@ function formatSize( $bytes ) {
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> | <a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></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/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a> |
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a> <a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
</p> </p>
</div> </div>
-1
View File
@@ -42,7 +42,6 @@ header('Cache-Control: no-cache');
<a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> | <a href="/" style="color: #ffffff;"><?php echo $lang['dashboard'];?></a> |
<a href="/admin/" style="color: #ffffff;"><?php echo $lang['admin'];?></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/power.php" style="color: #ffffff;"><?php echo $lang['power'];?></a> |
<a href="/admin/config_backup.php" style="color: #ffffff;"><?php echo $lang['backup_restore'];?></a> |
<a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a> <a href="/admin/configure.php" style="color: #ffffff;"><?php echo $lang['configuration'];?></a>
</p> </p>
</div> </div>
+1
View File
@@ -94,6 +94,7 @@ function checkFrequency(){
var intFreqPOCSAG = parseFloat(freqPOCSAG.value); // Swap to float var intFreqPOCSAG = parseFloat(freqPOCSAG.value); // Swap to float
// TX Good // TX Good
if (144 <= intFreqPOCSAG && intFreqPOCSAG <= 148) { pocsagFrequency.style.backgroundColor = goodColor; } if (144 <= intFreqPOCSAG && intFreqPOCSAG <= 148) { pocsagFrequency.style.backgroundColor = goodColor; }
if (150 <= intFreqPOCSAG && intFreqPOCSAG <= 160) { pocsagFrequency.style.backgroundColor = goodColor; }
if (220 <= intFreqPOCSAG && intFreqPOCSAG <= 225) { pocsagFrequency.style.backgroundColor = goodColor; } if (220 <= intFreqPOCSAG && intFreqPOCSAG <= 225) { pocsagFrequency.style.backgroundColor = goodColor; }
if (420 <= intFreqPOCSAG && intFreqPOCSAG <= 450) { pocsagFrequency.style.backgroundColor = goodColor; } if (420 <= intFreqPOCSAG && intFreqPOCSAG <= 450) { pocsagFrequency.style.backgroundColor = goodColor; }
if (842 <= intFreqPOCSAG && intFreqPOCSAG <= 950) { pocsagFrequency.style.backgroundColor = goodColor; } if (842 <= intFreqPOCSAG && intFreqPOCSAG <= 950) { pocsagFrequency.style.backgroundColor = goodColor; }