diff --git a/html/changeconf.php b/html/changeconf.php index 1cf1385..0b9de44 100755 --- a/html/changeconf.php +++ b/html/changeconf.php @@ -149,23 +149,68 @@ if (isset($msg)) { echo "\r\n"; } } elseif ($msg == "stations") { - echo "New stations list:\r\n"; - $stations = $_POST['stations']; - if ($stations[0] == "#") { - $stations = "\r\n".$stations; + $option = $_POST['submit']; + if ($option == "new") { + echo "New stations list:\r\n"; + $stations = $_POST['stations']; + if ($stations[0] == "#") { + $stations = "\r\n".$stations; + } + $stations_tmp = preg_replace("/\n#.*/", "", $stations); + echo "
".htmlspecialchars($stations_tmp)."
"; + file_put_contents('/var/lib/radiod/stationlist_new', $stations); + chmod("/var/lib/radiod/stationlist_new", 0755); + echo "\r\n"; + echo '
'; + echo "\r\n"; + echo ''; + echo "\r\n"; + echo ''; + } elseif ($option == "old") { + if (file_exists( "/var/lib/radiod/stationlist_old" )) { + echo "New stations list:\r\n"; + $stations = file_get_contents( "/var/lib/radiod/stationlist_old" ); + if ($stations[0] == "#") { + $stations = "\r\n".$stations; + } + $stations_tmp = preg_replace("/\n#.*/", "", $stations); + echo "
".htmlspecialchars($stations_tmp)."
"; + file_put_contents('/var/lib/radiod/stationlist_new', $stations); + chmod("/var/lib/radiod/stationlist_new", 0755); + echo "\r\n"; + echo ''; + echo "\r\n"; + echo ''; + echo "\r\n"; + echo ''; + } else { + echo "No previous stations list.\r\n"; + echo "\r\n"; + } + } elseif ($option == "ok") { + echo "Update stations list in progress.
\r\n"; + echo "Wait!
\r\n"; + echo "\r\n"; + $end = shell_exec('sudo ./scripts/new_stationlist.sh'); + } elseif ($option == "no") { + echo "Stations list change canceled.\r\n"; + echo "\r\n"; } - $stations_tmp = preg_replace("/\n#.*/", "", $stations); - echo "
".htmlspecialchars($stations_tmp)."
"; - file_put_contents('/var/lib/radiod/stationlist_new', $stations); - echo "\r\nStill experimental :)
\r\n"; - echo "Generating new playlist...
\r\n"; - echo "\r\n"; - $end = shell_exec('sudo ./scripts/new_stationlist.sh'); } elseif ($msg == "network") { echo "Not implemented..."; } elseif ($msg == "update") { diff --git a/html/config.php b/html/config.php index 11820eb..a668d81 100755 --- a/html/config.php +++ b/html/config.php @@ -131,7 +131,8 @@ echo ''; ?> -
+
+