diff options
author | TheTroll <trolldev@gmail.com> | 2010-03-18 18:12:03 +0100 |
---|---|---|
committer | TheTroll <trolldev@gmail.com> | 2010-03-18 18:12:03 +0100 |
commit | 394c0c1ce48314fc6d52f3b8d29e5d4f21c3bfdc (patch) | |
tree | 9079b218eb5284fab2d2b37daeb5635f34ed38de /bin/files.php | |
parent | 19f7bf5bbe473eb76b3089702986b92eb2235003 (diff) | |
download | istreamdev-394c0c1ce48314fc6d52f3b8d29e5d4f21c3bfdc.tar.gz istreamdev-394c0c1ce48314fc6d52f3b8d29e5d4f21c3bfdc.tar.bz2 |
Optimizing file browsing
Diffstat (limited to 'bin/files.php')
-rwxr-xr-x | bin/files.php | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/bin/files.php b/bin/files.php index 34db5bf..be2a364 100755 --- a/bin/files.php +++ b/bin/files.php @@ -158,11 +158,12 @@ function generatelogo($type, $name, $dest) function filesgetlisting($dir) { - $listing = array(); + $filelisting = array(); + $folderlisting = array(); $dir_handle = @opendir($dir); if (!$dir_handle) - return $listing; + return array(); while ($medianame = readdir($dir_handle)) { @@ -173,38 +174,19 @@ function filesgetlisting($dir) } if ($medianame_array[0] == NULL) - return $listing; + return array(); // Alphabetical sorting sort($medianame_array); - // List folders - foreach($medianame_array as $value) - { - $type = filegettype($dir ."/" .$value); - - if ($type != 'folder') - continue; - - $newentry = array(); - $newentry['name'] = $value; - $newentry['path'] = $dir ."/" .$value .'/'; - $newentry['type'] = 'folder'; - - $listing[] = $newentry; - } - $number = 1; - // List files + // List files and folders foreach($medianame_array as $value) { $type = filegettype($dir ."/" .$value); - if ($type == 'folder') - continue; - $newentry = array(); $newentry['name'] = $value; $newentry['path'] = $dir ."/" .$value; @@ -217,14 +199,21 @@ function filesgetlisting($dir) $newentry['number'] = $number; $number++; case 'video': + case 'folder': case 'rec': - $listing[] = $newentry; + if ($type == 'folder') + { + $newentry['path'] = $newentry['path'] .'/'; + $folderlisting[] = $newentry; + } + else + $filelisting[] = $newentry; break; default: } } - return $listing; + return array_merge($folderlisting, $filelisting); } ?> |