diff options
-rw-r--r-- | index.php | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -124,28 +124,41 @@ foreach ($files as $key=> $file) { } if (isset($sort)) { + // Sort by modified date if ($sort[0] == "M") { if ($sort[1] == "A") { ksort($new_array); } else { krsort($new_array); } + $ordered_array = $new_array; + // Sort by name } else if ($sort[0] == "N") { if ($sort[1] == "A") { asort($new_array); } else { arsort($new_array); } + $ordered_array = $new_array; + // Sort by size + } else if ($sort[0] == "S") { + if ($sort[1] == "A") { + asort($size_array); + } else { + arsort($size_array); + } + $ordered_array = $size_array; } } else { krsort($new_array); + $ordered_array = $new_array; } $listsize = 0; -while ($this_array = each($new_array)){ - $value = $this_array['value']; +while ($this_array = each($ordered_array)) { $key = $this_array['key']; + $value = $new_array[$key]; // Only show last X entries if requested if (isset($_GET['last']) && ($listsize > $_GET['last'] - 1)) { |