-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.php
81 lines (63 loc) · 1.77 KB
/
index.php
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
72
73
74
75
76
77
78
79
80
81
<?php
if (isset($_REQUEST['watch'])) {
?><html>
<body>
<video width="100%" height="100%" controls>
<source src="Videos/<?=$_REQUEST['file']?>" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
<?php
exit;
}
?>
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
</head>
<body>
<div class="container">
<a href="?watch&file=<?=$entry?>"><?=$entry?></a><br/><?php
getDirContents("");
function getDirContents($dir = "") {
if ($dir == "") {
$openDir = "Videos";
$title = $openDir;
} else {
$openDir = "Videos/".$dir;
$title = substr($dir,1);
}
?><div class="panel panel-default"><div class="panel-heading"><?=$title?></div><ul class="list-group"><?
$folders = $files = array();
if ($handle = opendir($openDir)) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
if (is_file($openDir."/".$entry)) {
if (substr($entry,-4) == ".txt") { continue; }
if (substr($entry,-4) == ".nfo") { continue; }
if (substr($entry,-4) == ".srt") { continue; }
$files[] = $entry;
}
else if (is_dir($openDir."/".$entry)) { $folders[] = $entry; }
}
}
closedir($handle);
sort($folders);
sort($files);
foreach ($folders as $folder) {
?><li class="list-group-item"><?
getDirContents($dir."/".$folder);
print "</li>";
}
foreach ($files as $file) {
?><a href="?watch&file=<?=$dir?>/<?=$file?>"><li class="list-group-item"><span class="glyphicon glyphicon-file"></span> <?=$file?></li></a> <a href="/Videos/<?=$dir?>/<?=$file?>">Download</a><?php
}
}
?></ul></div><?
}
?>
</div>
</body>
</html>