diff --git a/config.php b/config.php index 73197f1..324edc5 100755 --- a/config.php +++ b/config.php @@ -23,8 +23,8 @@ $author = "John Doe"; $folder_color = "black"; // Color of folder icons: blue / black / vista / purple / green / grey $sorting_folders = "name"; // Sort folders by: [name][date] $sorting_files = "name"; // Sort files by: [name][date][size] -$sortdir_folders = "ASC"; // Sort direction of folders: [ASC][DESC] -$sortdir_files = "ASC"; // Sort direction of files: [ASC][DESC] +$sortdir_folders = SORT_ASC; // Sort direction of folders: SORT_ASC / SORT_DESC +$sortdir_files = SORT_ASC; // Sort direction of files: SORT_ASC / SORT_DESC $lazyload = 1; // 0 is pagination, 1 is display all pictures on one page $SkipObjects = array('aFolder', 'aFile.ext'); //Those files and folders will not be displayed (affects the page and the RSS feed) diff --git a/index.php b/index.php index 25e0ec8..9ab5c6c 100644 --- a/index.php +++ b/index.php @@ -344,24 +344,28 @@ if (sizeof($dirs) > 0) { foreach ($dirs as $key => $row) { - if($row["name"] == "") unset($dirs[$key]); //Delete empty array entries + if($row["name"] == "") { + unset($dirs[$key]); //Delete empty array entries + continue; + } $name[$key] = strtolower($row['name']); $date[$key] = strtolower($row['date']); } - if (strtoupper($sortdir_folders) == "DESC") array_multisort($$sorting_folders, SORT_DESC, $name, SORT_DESC, $dirs); - else array_multisort($$sorting_folders, SORT_ASC, $name, SORT_ASC, $dirs); + @array_multisort($$sorting_folders, $sortdir_folders, $name, $sortdir_folders, $dirs); } if (sizeof($files) > 0) { foreach ($files as $key => $row) { - if($row["name"] == "") unset($files[$key]); //Delete empty array entries + if($row["name"] == "") { + unset($files[$key]); //Delete empty array entries + continue; + } $name[$key] = strtolower($row['name']); $date[$key] = strtolower($row['date']); $size[$key] = strtolower($row['size']); } - if (strtoupper($sortdir_files) == "DESC") @array_multisort($$sorting_files, SORT_DESC, $name, SORT_ASC, $files); - else @array_multisort($$sorting_files, SORT_ASC, $name, SORT_ASC, $files); + @array_multisort($$sorting_files, $sortdir_files, $name, SORT_ASC, $files); } //-----------------------