summaryrefslogtreecommitdiff
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/index.php b/index.php
index 8a56c8d..dd5026c 100644
--- a/index.php
+++ b/index.php
@@ -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)) {