blob: d0f94c18cac43c1e31c2aa0b987f9eaf27b3cfe5 (
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
<?php
global $videotypes;
$audiotypes='mp3 aac';
$subdir = $_REQUEST['subdir'];
$mediapath = $_REQUEST['mediapath'];
/* Add last slash to dirs */
if ($mediapath[strlen($mediapath)-1] != '/')
$mediapath = $mediapath .'/';
if ($subdir[strlen($subdir)-1] != '/')
$subdir = $subdir .'/';
print "<body onorientationchange=\"updateOrientation();\" onload=\"updateOrientation();\">\r\n";
print "<div id=\"topbar\" class=\"transparent\">\r\n";
print "<div id=\"leftnav\">\r\n";
if ($subdir == '/')
print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n";
else
{
print "<a href=\"javascript:sendForm('getback')\">Back</a></div>\r\n";
print "<div id=\"rightnav\">\r\n";
print "<a href=\"index.php\"><img alt=\"home\" src=\"images/home.png\" /></a></div>\r\n";
}
print "<div id=\"title\">iStreamdev</div>\r\n";
print "</div>\r\n";
print "<div id=\"content\">\r\n";
print " <span class=\"graytitle\">Media</span>\r\n";
print " <br>";
print " <ul class=\"pageitem\">";
print " <li class=\"textbox\"><span class=\"header\">Current path:</span><p>{$subdir}</p></li>";
// Option to play dir
$audioextarray = explode(' ', $audiotypes);
$playlist = 0;
foreach ($audioextarray as $num => $audioext)
{
if (glob($mediapath .$subdir .'*.' .$audioext))
$playlist = 1;
}
if ($playlist)
{
print " <li class=\"menu\">\r\n";
print " <a href=\"index.php?action=playdir&mediapath={$mediapath}&subdir={$subdir}\">\r\n";
print " <img src=\"images/pictos/playlist.png\" />\r\n";
print " <span class=\"name\">Play current dir</span>\r\n";
print " <span class=\"arrow\"></span>\r\n";
print " </a>\r\n";
print " </li>\r\n";
}
$dir_handle = @opendir($mediapath .$subdir);
if (!$dir_handle)
{
print "Unable to open $mediapath .$subdir";
}
else while ($medianame = readdir($dir_handle))
{
if($medianame == "." || $medianame == ".." || $medianame == 'lost+found')
continue;
$medianame_array[] = $medianame;
}
if ($medianame_array[0])
{
// Alphabetical sorting
sort($medianame_array);
$audiocnt=0;
foreach($medianame_array as $value)
{
$medianame2=addslashes($value);
// Directories
if (is_dir($mediapath .$subdir .$value))
{
print "<li class=\"menu\">\r\n";
print " <a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\">\r\n";
print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n";
print " </a>\r\n";
print "</li>\r\n";
print "<form name=\"$value\" id=\"$value\" method=\"post\" action=\"index.php\">";
print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/>";
print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />";
print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}{$value}\" />\r\n";
print "</form>\r\n";
}
else
{
// Get file extension
$fileext = end(explode(".", $value));
// Check if it is supported
if ( preg_match("/" .$fileext ." /", $videotypes) || preg_match("/" .$fileext ." $/", $videotypes) )
{
print "<li class=\"menu\">\r\n";
print " <a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\">\r\n";
print " <img src=\"images/pictos/video.png\" />\r\n";
print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n";
print " </a>\r\n";
print "</li>\r\n";
print "<form name=\"$value\" id=\"$value\" method=\"post\" action=\"index.php\">";
print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"stream\"/>";
print " <input name=\"type\" type=\"hidden\" id=\"type\" value=3 />";
print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />";
print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$subdir}\" />\r\n";
print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$mediapath}{$subdir}{$value}\" />";
print "</form>\r\n";
}
else if ( preg_match("/" .$fileext ." /", $audiotypes) || preg_match("/" .$fileext ."$/", $audiotypes) )
{
$audiocnt++;
print "<li class=\"menu\">\r\n";
print " <a href=\"index.php?action=playdir&mediapath={$mediapath}&subdir={$subdir}&play={$audiocnt}\">\r\n";
print " <img src=\"images/pictos/audio.png\" />\r\n";
print " <span class=\"name\">$value</span><span class=\"arrow\"></span>\r\n";
print " </a>\r\n";
print "</li>\r\n";
}
}
}
}
$upsubdir = dirname($subdir);
print "<form name=\"getback\" id=\"getback\" method=\"post\" action=\"index.php\">\r\n";
print " <input name=\"action\" type=\"hidden\" id=\"action\" value=\"media\"/>\r\n";
print " <input name=\"mediapath\" type=\"hidden\" id=\"mediapath\" value=\"{$mediapath}\" />\r\n";
print " <input name=\"subdir\" type=\"hidden\" id=\"subdir\" value=\"{$upsubdir}\" />\r\n";
print "</form>\r\n";
if ($dir_handle)
closedir($dir_handle);
print "</ul></div>\r\n";
?>
|