summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheTroll <trolldev@gmail.com>2010-03-18 18:03:08 +0100
committerTheTroll <trolldev@gmail.com>2010-03-18 18:03:08 +0100
commitcc273d76c088d5f787d27ec36c0a1d2687e65fe2 (patch)
tree1697a66e9bbd4f0c9e447b0313dbddf0ab822db2
parent405e5e51850623b46fadfbd09837cf218ff33de5 (diff)
downloadistreamdev-cc273d76c088d5f787d27ec36c0a1d2687e65fe2.tar.gz
istreamdev-cc273d76c088d5f787d27ec36c0a1d2687e65fe2.tar.bz2
List folders in first position
-rwxr-xr-xbin/files.php33
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: