\r\n";
print "
\r\n";
$dir_handle = @opendir($mediapath .$subdir);
if (!$dir_handle)
print "Unable to open $mediapath .$subdir";
else while ($medianame = readdir($dir_handle))
{
// Add only mp3 files and dirs
if($medianame == "." || $medianame == ".." || $medianame == 'lost+found')
continue;
$type = mediagettype($mediapath .$subdir .$medianame);
if (($type != 2) && ($type != 3))
continue;
$medianame_array[] = $medianame;
}
if ($medianame_array[0])
{
// Alphabetical sorting
sort($medianame_array);
$count = count($medianame_array);
// Directories
for ($cnt=0; $cnt < $count; $cnt++)
{
if (mediagettype($mediapath .$subdir .$medianame_array[$cnt]) == 3)
{
$medianame2=addslashes($medianame_array[$cnt]);
print " - \r\n";
print " \r\n";
print " {$medianame_array[$cnt]}>\r\n";
print " \r\n";
print "
\r\n";
print "
\r\n";
}
}
// Music files
$idx = 1;
for ($cnt=0; $cnt < $count; $cnt++)
{
$medianame2=addslashes($medianame_array[$cnt]);
$mediapath2=addslashes($mediapath);
$subdir2=addslashes($subdir);
// Audio
if (mediagettype($mediapath .$subdir .$medianame_array[$cnt]) == 2)
{
print "
\r\n";
unset($track);
for ($cnt2=$cnt; $cnt2<$count; $cnt2++)
{
if (mediagettype($mediapath .$subdir .$medianame_array[$cnt2]) == 2)
$track[$cnt2-$cnt] = $httppath ."playlist/" .addslashes($medianame_array[$cnt2]);
}
$jsarray = php2js($track);
print " \r\n";
// Get song info
list($name, $duration) = mediagetmusicinfo($mediapath .$subdir .$medianame_array[$cnt]);
print " $idx{$name}{$duration}\r\n";
print " \r\n";
print " \r\n";
$idx++;
}
}
}
print "
\r\n";
$upsubdir = dirname($subdir);
print "