diff options
author | root <root@mediaserver.Belkin> | 2010-02-19 13:06:59 +0100 |
---|---|---|
committer | root <root@mediaserver.Belkin> | 2010-02-19 13:06:59 +0100 |
commit | 94deb497165b4f8ad7b2bcea0901d7ce0d995778 (patch) | |
tree | cd044573c1b5c7f7441df59bd942896225fb9f3b /includes | |
parent | 429c74537c02a1f7d4032d6478f184f4ca362d3b (diff) | |
download | istreamdev-94deb497165b4f8ad7b2bcea0901d7ce0d995778.tar.gz istreamdev-94deb497165b4f8ad7b2bcea0901d7ce0d995778.tar.bz2 |
Sort Media directory & files by alphabetical order
Diffstat (limited to 'includes')
-rwxr-xr-x | includes/inc_media.php | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/includes/inc_media.php b/includes/inc_media.php index 53788c2..2c71ff1 100755 --- a/includes/inc_media.php +++ b/includes/inc_media.php @@ -46,35 +46,44 @@ else while ($medianame = readdir($dir_handle)) if($medianame == "." || $medianame == ".." || $medianame == 'lost+found') continue; - $medianame2=addslashes($medianame); + $medianame_array[] = $medianame; + //} +} +//closedir? +// +sort($medianame_array); +foreach($medianame_array as $value) +{ + $medianame2=addslashes($value); // Directories - if (is_dir($dir ."/" .$medianame)) + if (is_dir($dir ."/" .$value)) { - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><span class=\"name\">$medianame</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$medianame\" id=\"$medianame\" method=\"post\" action=\"index.php\">"; + print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><span class=\"name\">$value</span><span class=\"arrow\"></span></a></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=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}{$medianame}/\" />"; + print " <input name=\"dir\" type=\"hidden\" id=\"dir\" value=\"{$dir}{$value}/\" />"; print "</form>\r\n"; } else { // Get file extension - $fileext = end(explode(".", $medianame)); + $fileext = end(explode(".", $value)); // Check if it is supported if ( preg_match("'" .$fileext ." '", $videotypes) || preg_match("'" .$fileext ." $'", $videotypes) ) { - print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><img src=\"images/pictos/media.png\" /><span class=\"name\">$medianame</span><span class=\"arrow\"></span></a></li>\r\n"; - print "<form name=\"$medianame\" id=\"$medianame\" method=\"post\" action=\"index.php\">"; + print "<li class=\"menu\"><a class=\"noeffect\" href=\"javascript:sendForm('$medianame2');\"><img src=\"images/pictos/media.png\" /><span class=\"name\">$value</span><span class=\"arrow\"></span></a></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=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}{$medianame}\" />"; + print " <input name=\"name\" type=\"hidden\" id=\"name\" value=\"{$dir}{$value}\" />"; print "</form>\r\n"; } } + } $updir = dirname($dir); |