\r\n";
print "
Media\r\n";
print "
";
print "
";
print " /{$subdir}
";
$dir_handle = @opendir($dir);
if (!$dir_handle)
{
print "Unable to open $dir";
}
else while ($medianame = readdir($dir_handle))
{
if($medianame == "." || $medianame == ".." || $medianame == 'lost+found')
continue;
$medianame_array[] = $medianame;
//}
}
//closedir?
//
if ($medianame_array[0] == NULL)
{
//do nothing
}
else
{
// Alphabetical sorting
sort($medianame_array);
foreach($medianame_array as $value)
{
$medianame2=addslashes($value);
// Directories
if (is_dir($dir ."/" .$value))
{
print "\r\n";
print "
\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 "\r\n";
print "
\r\n";
}
else if ( preg_match("'" .$fileext ." '", $audiotypes)
|| preg_match("'" .$fileext ." $'", $audiotypes)
)
{
print "\r\n";
}
}
}
}
$updir = dirname($dir);
print "
\r\n";
if ($dir_handle)
closedir($dir_handle);
print "
\r\n";
?>