les albums sont triés par ordre alphabétique
This commit is contained in:
parent
ca32d05ce6
commit
37207927bd
10
albums.php
10
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)) {
|
||||
|
@ -141,11 +141,22 @@ function generatePrivateTree($path, $currentPath) {
|
||||
$output .= '</div></div>';
|
||||
}
|
||||
|
||||
// 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);
|
||||
$dirs[$info['title']] = $fullPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Tri alphabétique par titre
|
||||
ksort($dirs, SORT_STRING | SORT_FLAG_CASE);
|
||||
|
||||
// Parcourir les dossiers triés
|
||||
foreach ($dirs as $title => $fullPath) {
|
||||
$info = getAlbumInfo($fullPath);
|
||||
$isCurrentPath = realpath($fullPath) === $currentPath;
|
||||
$hasSubfolders = hasSubfolders($fullPath);
|
||||
@ -162,7 +173,6 @@ function generatePrivateTree($path, $currentPath) {
|
||||
$output .= '<div class="tree-actions">';
|
||||
if (!$hasSubfolders) {
|
||||
$output .= '<a href="arbre-img-prive.php?path=' . urlencode($fullPath) . '&private=1" class="tree-button" style="text-decoration: none">🖼️</a>';
|
||||
// Ajout du bouton de génération de lien si le dossier contient des images
|
||||
if ($hasImages) {
|
||||
$output .= '<button onclick="generateShareLink(\'' . htmlspecialchars($fullPath) . '\', \''
|
||||
. htmlspecialchars($info['title'])
|
||||
@ -194,7 +204,6 @@ function generatePrivateTree($path, $currentPath) {
|
||||
$output .= generatePrivateTree($fullPath, $currentPath);
|
||||
$output .= '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
|
17
arbre.php
17
arbre.php
@ -112,11 +112,22 @@ function generateTree($path, $currentPath) {
|
||||
$output .= '</div></div>';
|
||||
}
|
||||
|
||||
// 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);
|
||||
$dirs[$info['title']] = $fullPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Tri alphabétique par titre
|
||||
ksort($dirs, SORT_STRING | SORT_FLAG_CASE);
|
||||
|
||||
// Parcourir les dossiers triés
|
||||
foreach ($dirs as $title => $fullPath) {
|
||||
$info = getAlbumInfo($fullPath);
|
||||
$isCurrentPath = realpath($fullPath) === $currentPath;
|
||||
$hasSubfolders = hasSubfolders($fullPath);
|
||||
@ -133,7 +144,6 @@ function generateTree($path, $currentPath) {
|
||||
if (!$hasSubfolders) {
|
||||
$output .= '<a href="arbre-img.php?path=' . urlencode($fullPath) . '" class="tree-button" style="text-decoration: none">🖼️</a>';
|
||||
}
|
||||
// Pour les dossiers avec des images
|
||||
if (!$hasSubfolders) {
|
||||
$output .= '<button onclick="editFolder(\'' . htmlspecialchars($fullPath) . '\', \''
|
||||
. rawurlencode($info['title']) . '\', \''
|
||||
@ -143,7 +153,6 @@ function generateTree($path, $currentPath) {
|
||||
. (hasImages($fullPath) ? 'true' : 'false')
|
||||
. ')" class="tree-button">✏️</button>';
|
||||
} else {
|
||||
// Pour les dossiers sans images
|
||||
$output .= '<button onclick="editFolder(\'' . htmlspecialchars($fullPath) . '\', \''
|
||||
. rawurlencode($info['title']) . '\', \''
|
||||
. rawurlencode($info['description']) . '\', '
|
||||
@ -160,7 +169,6 @@ function generateTree($path, $currentPath) {
|
||||
$output .= generateTree($fullPath, $currentPath);
|
||||
$output .= '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</ul>';
|
||||
return $output;
|
||||
@ -168,7 +176,6 @@ function generateTree($path, $currentPath) {
|
||||
|
||||
$config = getSiteConfig();
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
|
Loading…
x
Reference in New Issue
Block a user