blob: e38414ad346d5ab3c06af5e11874d27895394f9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
<?php
include "moc-commands.php";
include "access-restriction.php";
$max_line_len = 50;
function crypt_status() {
return trim(shell_exec("cryptstatus"));
}
function print_redirect() {
?>
<html><head><meta http-equiv="refresh" content="0; url=/<?php attach_key('?'); ?>" /></head></html>
<?php
}
if (!array_key_exists('what',$_GET)) {
?>
<html>
<body>
<?php
print list_info() . "<br>\n";
print details() . "<br>\n";
?>
<a href="?what=all<?php attach_key(); ?>">all info</a><br>
<?php
print_known_commands();
?>
<a href="?what=lists<?php attach_key(); ?>">lists</a><br>
</body>
</html>
<?php
die();
}
switch ($_GET["what"]) {
case "all":
print list_info() . "<br>\n";
print details() . "<br>\n";
print crypt_status();
break;
case "info":
print list_info($max_line_len);
break;
case "details":
print details($max_line_len);
break;
case "crypt":
print crypt_status();
break;
case "playlist":
if (array_key_exists("list",$_GET)) {
$i = $_GET["list"];
if (preg_match("/^\d+$/", $i) == 1) {
shell_exec("playlist " . $i);
}
}
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"]]);
print_redirect();
}
die();
}
|