From 285004b4c8a472fbb94e16c1c408303484aa8221 Mon Sep 17 00:00:00 2001 From: Pecusx Date: Thu, 12 Jan 2017 23:10:10 +0100 Subject: [PATCH] Edit network media folder from web interface. --- html/changeconf.php | 49 ++++++++++++++++++++++++++++++++++++++++++++- html/config.php | 20 +++++++++++++----- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/html/changeconf.php b/html/changeconf.php index 0b9de44..4778646 100755 --- a/html/changeconf.php +++ b/html/changeconf.php @@ -212,7 +212,54 @@ if (isset($msg)) { echo "\r\n"; } } 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 "
Network path: ".$media_link."\r\n";
+			echo "Login: ".$login."\r\n";
+			echo "Password: ".$password."\r\n";
+			echo "Shell command: ".$share_string."
\r\n"; + echo '
'; + echo "\r\n"; + echo "
\r\n"; + echo ""; + echo "\r\n"; + echo ""; + echo "\r\n"; + } elseif ($option == "ok") { + echo "Update network folder config.
\r\n"; + echo "Wait!
\r\n"; + echo "\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 "Network folder config change canceled.\r\n"; + echo "\r\n"; + } } elseif ($msg == "update") { $confirmation = $_POST["submit"]; if ($confirmation == "yes") { diff --git a/html/config.php b/html/config.php index b7a552e..4e17965 100755 --- a/html/config.php +++ b/html/config.php @@ -85,12 +85,22 @@ Media network folder config /* Folder /var/lib/radiod/ musi miec uprawnienia 755 inaczej nie da sie stad odczytac plik w nim umieszczony */ $netshare = file_get_contents( "/var/lib/radiod/share" ); -echo ""; +preg_match('/user=\".*\",pass/', $netshare, $matches); +preg_match('/\".*\"/', $matches[0], $matches); +$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 "
";
+echo "Network path: 
"; +echo "Login:
"; +echo "Password:

"; ?> -
- + +

RSS config