use SORT_ASC/DESC directly in config. simplifies array_multisort.

This commit is contained in:
Piotr KUCHARSKI 2014-11-24 17:01:54 +01:00
parent 51bb66b4c9
commit dc109fda31
2 changed files with 12 additions and 8 deletions

View File

@ -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)

View File

@ -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);
}
//-----------------------