mirror of
https://github.com/Pecusx/piradio-mini.git
synced 2026-05-20 22:33:44 +02:00
Edit network media folder from web interface.
This commit is contained in:
+48
-1
@@ -212,7 +212,54 @@ if (isset($msg)) {
|
|||||||
echo "</script>\r\n";
|
echo "</script>\r\n";
|
||||||
}
|
}
|
||||||
} elseif ($msg == "network") {
|
} elseif ($msg == "network") {
|
||||||
echo "Not implemented...";
|
$option = $_POST['submit'];
|
||||||
|
if ($option == "confirm") {
|
||||||
|
$login = $_POST["user"];
|
||||||
|
$password = $_POST["password"];
|
||||||
|
$media_link = $_POST["media_link"];
|
||||||
|
if ($media_link == "") {
|
||||||
|
$share_string = '';
|
||||||
|
} else {
|
||||||
|
if ($login == "") {
|
||||||
|
$share_string = 'mount.cifs -o ro "'.$media_link.'" /share';
|
||||||
|
} else {
|
||||||
|
$share_string = 'mount.cifs -o user="'.$login.'",password="'.$password.'",ro "'.$media_link.'" /share';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo $end;
|
||||||
|
echo "New network media folder configuration.\r\n";
|
||||||
|
echo "<pre>Network path: <b>".$media_link."</b>\r\n";
|
||||||
|
echo "Login: <b>".$login."</b>\r\n";
|
||||||
|
echo "Password: <b>".$password."</b>\r\n";
|
||||||
|
echo "Shell command: <b>".$share_string."</b></pre>\r\n";
|
||||||
|
echo '<form action="changeconf.php?file=network" method="post">';
|
||||||
|
echo "\r\n";
|
||||||
|
echo "<input type='hidden' name='share_string' value='".$share_string."'><br>\r\n";
|
||||||
|
echo "<button type='submit' name='submit' value='ok'>Confirm network folder config</button>";
|
||||||
|
echo "\r\n";
|
||||||
|
echo "<button type='submit' name='submit' value='no'>Cancel</button>";
|
||||||
|
echo "\r\n";
|
||||||
|
} elseif ($option == "ok") {
|
||||||
|
echo "<b>Update network folder config.</b><br>\r\n";
|
||||||
|
echo "Wait!<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";
|
||||||
|
$share_string = $_POST["share_string"];
|
||||||
|
file_put_contents('/var/lib/radiod/share', $share_string);
|
||||||
|
chmod("/var/lib/radiod/share", 0755);
|
||||||
|
} elseif ($option == "no") {
|
||||||
|
echo "<b>Network folder config change canceled.</b>\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 == "update") {
|
} elseif ($msg == "update") {
|
||||||
$confirmation = $_POST["submit"];
|
$confirmation = $_POST["submit"];
|
||||||
if ($confirmation == "yes") {
|
if ($confirmation == "yes") {
|
||||||
|
|||||||
+15
-5
@@ -85,12 +85,22 @@ Media network folder config
|
|||||||
/* Folder /var/lib/radiod/ musi miec uprawnienia 755
|
/* Folder /var/lib/radiod/ musi miec uprawnienia 755
|
||||||
inaczej nie da sie stad odczytac plik w nim umieszczony */
|
inaczej nie da sie stad odczytac plik w nim umieszczony */
|
||||||
$netshare = file_get_contents( "/var/lib/radiod/share" );
|
$netshare = file_get_contents( "/var/lib/radiod/share" );
|
||||||
echo "<input type='text' name='media' value='";
|
preg_match('/user=\".*\",pass/', $netshare, $matches);
|
||||||
echo $netshare;
|
preg_match('/\".*\"/', $matches[0], $matches);
|
||||||
echo "' style='width: 100%'>";
|
$share_user = substr($matches[0], 1 ,-1);
|
||||||
|
preg_match('/password=\".*\",ro/', $netshare, $matches);
|
||||||
|
preg_match('/\".*\"/', $matches[0], $matches);
|
||||||
|
$share_password = substr($matches[0], 1 ,-1);
|
||||||
|
preg_match('/ro \".*\"/', $netshare, $matches);
|
||||||
|
preg_match('/\".*\"/', $matches[0], $matches);
|
||||||
|
$share_link = substr($matches[0], 1 ,-1);
|
||||||
|
echo "<pre><b>";
|
||||||
|
echo "Network path: <input type='text' name='media_link' value='".$share_link."' style='width: 80%'><br>";
|
||||||
|
echo "Login: <input type='text' name='user' value='".$share_user."'><br>";
|
||||||
|
echo "Password: <input type='text' name='password' value='".$share_password."'></b><br>";
|
||||||
?>
|
?>
|
||||||
<br><button type="submit" name="submit">Save network folder config</button>
|
<button type="submit" name="submit" value="confirm">Save network folder config</button>
|
||||||
</form>
|
</pre></form>
|
||||||
<hr>
|
<hr>
|
||||||
RSS config
|
RSS config
|
||||||
<form action="changeconf.php?file=rss" method="post">
|
<form action="changeconf.php?file=rss" method="post">
|
||||||
|
|||||||
Reference in New Issue
Block a user