diff --git a/albums.php b/albums.php index ff65a9e..2f8e287 100644 --- a/albums.php +++ b/albums.php @@ -17,6 +17,7 @@ $currentAlbumInfo = getAlbumInfo($currentPath); // Récupérer tous les sous-dossiers $albums = []; +$tempAlbums = []; foreach (new DirectoryIterator($currentPath) as $item) { if ($item->isDot()) continue; if ($item->isDir()) { @@ -27,7 +28,7 @@ foreach (new DirectoryIterator($currentPath) as $item) { getImagesRecursively($albumPath) : getLatestImages($albumPath); - $albums[] = [ + $tempAlbums[] = [ 'path' => str_replace('\\', '/', $albumPath), 'title' => $info['title'], 'description' => $info['description'], @@ -39,6 +40,13 @@ foreach (new DirectoryIterator($currentPath) as $item) { } } +// Tri alphabétique des albums par titre +usort($tempAlbums, function($a, $b) { + return strcasecmp($a['title'], $b['title']); +}); + +$albums = $tempAlbums; + // Déterminer le chemin parent pour le bouton retour $parentPath = dirname($currentPath); if (!isSecurePath($parentPath)) { diff --git a/arbre-prive.php b/arbre-prive.php index b0f2f1a..8f4032c 100644 --- a/arbre-prive.php +++ b/arbre-prive.php @@ -141,60 +141,69 @@ function generatePrivateTree($path, $currentPath) { $output .= ''; } - // Parcourir tous les sous-dossiers + // Récupérer et trier les sous-dossiers + $dirs = array(); foreach (new DirectoryIterator($path) as $item) { if ($item->isDot()) continue; if ($item->isDir()) { $fullPath = $item->getPathname(); $info = getAlbumInfo($fullPath); - $isCurrentPath = realpath($fullPath) === $currentPath; - $hasSubfolders = hasSubfolders($fullPath); - $hasImages = hasImages($fullPath); - - $output .= '