From 94deb497165b4f8ad7b2bcea0901d7ce0d995778 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 19 Feb 2010 13:06:59 +0100 Subject: Sort Media directory & files by alphabetical order --- includes/inc_media.php | 27 ++++++++++++++++++--------- 1 file 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 "
  • $medianame
  • \r\n"; - print "
    "; + print "
  • $value
  • \r\n"; + print ""; print " "; - print " "; + print " "; print "
    \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 "
  • $medianame
  • \r\n"; - print "
    "; + print "
  • $value
  • \r\n"; + print ""; print " "; print " "; - print " "; + print " "; print "
    \r\n"; } } + } $updir = dirname($dir); -- cgit v1.2.3