diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-18 18:03:08 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-18 18:03:08 +0100 |
commit | cc273d76c088d5f787d27ec36c0a1d2687e65fe2 (patch) | |
tree | 1697a66e9bbd4f0c9e447b0313dbddf0ab822db2 | |
parent | 405e5e51850623b46fadfbd09837cf218ff33de5 (diff) | |
download | istreamdev-cc273d76c088d5f787d27ec36c0a1d2687e65fe2.tar.gz istreamdev-cc273d76c088d5f787d27ec36c0a1d2687e65fe2.tar.bz2 |
List folders in first position
-rwxr-xr-x | bin/files.php | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/bin/files.php b/bin/files.php index 7afe9e1..34db5bf 100755 --- a/bin/files.php +++ b/bin/files.php @@ -178,17 +178,38 @@ function filesgetlisting($dir) // Alphabetical sorting sort($medianame_array); - $number = 1; - + // List folders foreach($medianame_array as $value) { - $newentry = array(); + $type = filegettype($dir ."/" .$value); + + if ($type != 'folder') + continue; + $newentry = array(); $newentry['name'] = $value; - $newentry['path'] = $dir ."/" .$value; + $newentry['path'] = $dir ."/" .$value .'/'; + $newentry['type'] = 'folder'; + + $listing[] = $newentry; + } + + $number = 1; + + // List files + foreach($medianame_array as $value) + { $type = filegettype($dir ."/" .$value); + if ($type == 'folder') + continue; + + $newentry = array(); + $newentry['name'] = $value; + $newentry['path'] = $dir ."/" .$value; + $newentry['type'] = $type; + switch ($type) { case 'audio': @@ -197,10 +218,6 @@ function filesgetlisting($dir) $number++; case 'video': case 'rec': - case 'folder': - $newentry['type'] = $type; - if ($type == 'folder') - $newentry['path'] = $newentry['path'] .'/'; $listing[] = $newentry; break; default: |