Merge pull request #2 from pkali/Pecusx-patch-2

Update from github
This commit is contained in:
Pecusx
2016-10-30 11:57:13 +01:00
committed by GitHub
4 changed files with 94 additions and 17 deletions
+46 -3
View File
@@ -13,11 +13,54 @@
$msg = $_GET['file'];
if (isset($msg)) {
if ($msg == "restart") {
$end = "xxx";
$end = shell_exec('sudo ./scripts/restart.sh');
echo "PiRadio restart in progress.<br>\r\n";
echo "<script>\r\n";
echo "// redirect to main after 1 second\r\n";
echo "window.setTimeout(function() {\r\n";
echo " window.location.href = 'index.html';\r\n";
echo "}, 1000);\r\n";
echo "</script>\r\n";
} elseif ($msg == "reboot") {
$end = shell_exec('sudo ./scripts/reboot.sh');
/* UWAGA! Folder z plikami uruchamianymi przez sudo
musi byc dopisany w pliku /etc/sudoers */
echo "Reboot in progress.<br>\r\n";
echo "Wait!<br>\r\n";
echo "<script>\r\n";
echo "// redirect to main after 30 seconds\r\n";
echo "window.setTimeout(function() {\r\n";
echo " window.location.href = 'index.html';\r\n";
echo "}, 30000);\r\n";
echo "</script>\r\n";
} elseif ($msg == "audio") {
echo "Not implemented...";
} elseif ($msg == "stations") {
echo "Not implemented...";
} elseif ($msg == "network") {
echo "Not implemented...";
} elseif ($msg == "update") {
$confirmation = $_POST["submit"];
if ($confirmation == "yes") {
echo "Update from github in progress.<br>";
$end = shell_exec('sudo ./scripts/make_tmp.sh');
$end = shell_exec('sudo ./scripts/tmp_upd.sh');
echo "Wait!<br>\r\n";
echo "<script>\r\n";
echo "// redirect to main after 30 seconds\r\n";
echo "window.setTimeout(function() {\r\n";
echo " window.location.href = 'index.html';\r\n";
echo "}, 30000);\r\n";
echo "</script>\r\n";
} else {
echo "Update from github canceled.<br>\r\n";
echo "<script>\r\n";
echo "// redirect to main after 2 seconds\r\n";
echo "window.setTimeout(function() {\r\n";
echo " window.location.href = 'index.html';\r\n";
echo "}, 2000);\r\n";
echo "</script>\r\n";
}
} elseif ($msg == "rss") {
$rss_link = $_POST["rss_link"];
file_put_contents('/var/lib/radiod/rss', $rss_link);
@@ -70,6 +113,6 @@ if (isset($msg)) {
}
?>
<hr>
<a href="config.php?command=restart"><button>PiRadio restart</button></a>
<a href="config.php?command=reboot"><button>System reboot</button></a>
<a href="changeconf.php?file=restart"><button>PiRadio restart</button></a>
<a href="changeconf.php?file=reboot"><button>System reboot</button></a>
</body>
+3 -14
View File
@@ -1,15 +1,3 @@
<?php
$msg = $_GET['command'];
if (isset($msg)) {
if ($msg == "restart") {
$end = shell_exec('sudo ./scripts/restart.sh');
} elseif ($msg == "reboot") {
$end = shell_exec('sudo ./scripts/reboot.sh');
/* UWAGA! Kazdy skrypt uruchamiany przez sudo
musi byc dopisany w pliku /etc/sudoers */
}
}
?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -61,6 +49,7 @@ echo '</b><br>';
<button type="submit" name="submit">Save Global PiRadio config</button>
</pre>
</form>
<a href="hconfig.php"><button>Hardware Configuration & Update</button></a>
<hr>
Media network folder config
<form action="changeconf.php?file=network" method="post">
@@ -117,6 +106,6 @@ echo '</textarea>';
<br><button type="submit" name="submit">Save radio stations list</button>
</form>
<hr>
<a href="config.php?command=restart"><button>PiRadio restart</button></a>
<a href="config.php?command=reboot"><button>System reboot</button></a>
<a href="changeconf.php?file=restart"><button>PiRadio restart</button></a>
<a href="changeconf.php?file=reboot"><button>System reboot</button></a>
</body>
+26
View File
@@ -0,0 +1,26 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="/PiRadio16.gif" />
<link rel="stylesheet" href="styles.css">
<title>PiRadio mini web interface - hardware config page</title>
</head>
<body>
<b>PiRadio</b><div id="config"><a href="config.php">config</a></div></br>
<hr>
Audio device config<br>
<form action="changeconf.php?file=audio" method="post">
<pre>
<input type="radio" name="output" value="internal" checked> internal audio
<input type="radio" name="output" value="USB"> USB audio card<br>
<button type="submit" name="submit">Save audio device config</button>
</pre>
</form>
<hr>
Update to last build from github
<a href="update.html"><button>PiRadio update</button></a>
<hr>
<a href="changeconf.php?file=restart"><button>PiRadio restart</button></a>
<a href="changeconf.php?file=reboot"><button>System reboot</button></a>
</body>
+19
View File
@@ -0,0 +1,19 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="shortcut icon" href="/PiRadio16.gif" />
<link rel="stylesheet" href="styles.css">
<title>PiRadio mini web interface - update confirm</title>
</head>
<body>
<b>PiRadio</b><div id="config"><a href="config.php">config</a></div></br>
<hr>
Update to last build from github<br><br>
Do you really want to update your PiRadio from github repository.<br>
After update your PiRadio will be rebooted!
<form action="changeconf.php?file=update" method="post">
<button type="submit" name="submit" value="yes">Yes - update and reboot</button>
<button type="submit" name="submit" value="no">No - no update</button>
<hr>
</body>