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:
@@ -25,16 +25,6 @@ require_once('../config/version.php');
|
||||
<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" />
|
||||
<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>
|
||||
<body>
|
||||
<div class="container">
|
||||
@@ -74,24 +64,8 @@ $filepath = '/tmp/bW1kd4jg6b3N0DQo.tmp';
|
||||
//after the form submit
|
||||
if($_POST) {
|
||||
$data = $_POST;
|
||||
// Factory Reset Handler Here
|
||||
if (empty($_POST['factoryReset']) != TRUE ) {
|
||||
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);
|
||||
}
|
||||
//update ini file, call function
|
||||
update_ini_file($data, $filepath);
|
||||
}
|
||||
|
||||
//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 "</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>
|
||||
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -4,7 +4,6 @@
|
||||
<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/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>
|
||||
</p>
|
||||
<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 />
|
||||
<b>完整编辑:</b>
|
||||
<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_bmapikey.php" style="color: #ffffff;">BM 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_rssidat.php" style="color: #ffffff;">RSSI 数据</a>
|
||||
|
||||
Reference in New Issue
Block a user