summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--index.php10
-rw-r--r--lists.php16
-rw-r--r--moc-commands.php26
3 files changed, 34 insertions, 18 deletions
diff --git a/index.php b/index.php
index bf7ddb6..c9eef41 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,7 @@
<?php
+include "moc-commands.php";
+
$privKey = "f1869e6cb93500215f5e1ef1fe552dbc76d036088b56c45b1bc32c54211f1c88f4429e138684b0c1a270fd71d3808d77771e0dbb90a0318eaf27d3747cd57f04";
$pubKey = "f4429e138684b0c1a270fd71d3808d77771e0dbb90a0318eaf27d3747cd57f04";
@@ -85,7 +87,7 @@ function details($max_line_len = 0) {
$time = substr($line,10);
}
$max_file_len = $max_line_len - 4 - strlen($state) - strlen($time);
- if ($max_lin_len && (strlen($file) > $max_file_len))
+ if ($max_line_len && (strlen($file) > $max_file_len))
$file = "..." . substr($file,3-$max_file_len);
return $state . " " . $file . " (" . $time . ")";
}
@@ -121,7 +123,7 @@ if (!array_key_exists('what',$_GET)) {
print '">' . $key . '</a><br>' . "\n";
}
?>
- <a href="lists.php">lists</a><br>
+ <a href="?what=lists<?php attach_key(); ?>">lists</a><br>
</body>
</html>
<?php
@@ -152,6 +154,10 @@ switch ($_GET["what"]) {
}
print_redirect();
break;
+ case "lists":
+ print_neutral_back_link();
+ print_lists();
+ break;
default:
if (array_key_exists($_GET["what"], $commands)) {
shell_exec($commands[$_GET["what"]]);
diff --git a/lists.php b/lists.php
deleted file mode 100644
index 9e804a5..0000000
--- a/lists.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-
-$handle = popen("LC_ALL=C ls ~musix/.moc/Listen", "r");
-$i = 1;
-while (!feof($handle)) {
- $s = fgets($handle);
- if (substr($s,0,7) !== "_lokal_") {
- continue;
- }
- $lists[$i] = substr($s,7);
- $i++;
-}
-
-foreach ($lists as $i => $list) {
- print "<a href=/?what=playlist&list=" . $i . ">" . $list . "</a><br>\n";
-}
diff --git a/moc-commands.php b/moc-commands.php
new file mode 100644
index 0000000..4baddb2
--- /dev/null
+++ b/moc-commands.php
@@ -0,0 +1,26 @@
+<?php
+
+function print_neutral_back_link() {
+ print '<a href="/';
+ attach_key('?');
+ print '">back</a><br>' . "\n";
+}
+
+function print_lists() {
+ $handle = popen("LC_ALL=C ls ~musix/.moc/Listen", "r");
+ $i = 1;
+ while (!feof($handle)) {
+ $s = fgets($handle);
+ if (substr($s,0,7) !== "_lokal_") {
+ continue;
+ }
+ $lists[$i] = substr($s,7);
+ $i++;
+ }
+
+ foreach ($lists as $i => $list) {
+ print '<a href="/?what=playlist&list=' . $i;
+ attach_key();
+ print '">' . $list . "</a><br>\n";
+ }
+}