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
|
// Récupérer tous les sous-dossiers
|
||||||
$albums = [];
|
$albums = [];
|
||||||
|
$tempAlbums = [];
|
||||||
foreach (new DirectoryIterator($currentPath) as $item) {
|
foreach (new DirectoryIterator($currentPath) as $item) {
|
||||||
if ($item->isDot()) continue;
|
if ($item->isDot()) continue;
|
||||||
if ($item->isDir()) {
|
if ($item->isDir()) {
|
||||||
@ -27,7 +28,7 @@ foreach (new DirectoryIterator($currentPath) as $item) {
|
|||||||
getImagesRecursively($albumPath) :
|
getImagesRecursively($albumPath) :
|
||||||
getLatestImages($albumPath);
|
getLatestImages($albumPath);
|
||||||
|
|
||||||
$albums[] = [
|
$tempAlbums[] = [
|
||||||
'path' => str_replace('\\', '/', $albumPath),
|
'path' => str_replace('\\', '/', $albumPath),
|
||||||
'title' => $info['title'],
|
'title' => $info['title'],
|
||||||
'description' => $info['description'],
|
'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
|
// Déterminer le chemin parent pour le bouton retour
|
||||||
$parentPath = dirname($currentPath);
|
$parentPath = dirname($currentPath);
|
||||||
if (!isSecurePath($parentPath)) {
|
if (!isSecurePath($parentPath)) {
|
||||||
|
@ -141,11 +141,22 @@ function generatePrivateTree($path, $currentPath) {
|
|||||||
$output .= '</div></div>';
|
$output .= '</div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcourir tous les sous-dossiers
|
// Récupérer et trier les sous-dossiers
|
||||||
|
$dirs = array();
|
||||||
foreach (new DirectoryIterator($path) as $item) {
|
foreach (new DirectoryIterator($path) as $item) {
|
||||||
if ($item->isDot()) continue;
|
if ($item->isDot()) continue;
|
||||||
if ($item->isDir()) {
|
if ($item->isDir()) {
|
||||||
$fullPath = $item->getPathname();
|
$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);
|
$info = getAlbumInfo($fullPath);
|
||||||
$isCurrentPath = realpath($fullPath) === $currentPath;
|
$isCurrentPath = realpath($fullPath) === $currentPath;
|
||||||
$hasSubfolders = hasSubfolders($fullPath);
|
$hasSubfolders = hasSubfolders($fullPath);
|
||||||
@ -162,7 +173,6 @@ function generatePrivateTree($path, $currentPath) {
|
|||||||
$output .= '<div class="tree-actions">';
|
$output .= '<div class="tree-actions">';
|
||||||
if (!$hasSubfolders) {
|
if (!$hasSubfolders) {
|
||||||
$output .= '<a href="arbre-img-prive.php?path=' . urlencode($fullPath) . '&private=1" class="tree-button" style="text-decoration: none">🖼️</a>';
|
$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) {
|
if ($hasImages) {
|
||||||
$output .= '<button onclick="generateShareLink(\'' . htmlspecialchars($fullPath) . '\', \''
|
$output .= '<button onclick="generateShareLink(\'' . htmlspecialchars($fullPath) . '\', \''
|
||||||
. htmlspecialchars($info['title'])
|
. htmlspecialchars($info['title'])
|
||||||
@ -194,7 +204,6 @@ function generatePrivateTree($path, $currentPath) {
|
|||||||
$output .= generatePrivateTree($fullPath, $currentPath);
|
$output .= generatePrivateTree($fullPath, $currentPath);
|
||||||
$output .= '</li>';
|
$output .= '</li>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$output .= '</ul>';
|
$output .= '</ul>';
|
||||||
return $output;
|
return $output;
|
||||||
|
17
arbre.php
17
arbre.php
@ -112,11 +112,22 @@ function generateTree($path, $currentPath) {
|
|||||||
$output .= '</div></div>';
|
$output .= '</div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parcourir tous les sous-dossiers
|
// Récupérer et trier les sous-dossiers
|
||||||
|
$dirs = array();
|
||||||
foreach (new DirectoryIterator($path) as $item) {
|
foreach (new DirectoryIterator($path) as $item) {
|
||||||
if ($item->isDot()) continue;
|
if ($item->isDot()) continue;
|
||||||
if ($item->isDir()) {
|
if ($item->isDir()) {
|
||||||
$fullPath = $item->getPathname();
|
$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);
|
$info = getAlbumInfo($fullPath);
|
||||||
$isCurrentPath = realpath($fullPath) === $currentPath;
|
$isCurrentPath = realpath($fullPath) === $currentPath;
|
||||||
$hasSubfolders = hasSubfolders($fullPath);
|
$hasSubfolders = hasSubfolders($fullPath);
|
||||||
@ -133,7 +144,6 @@ function generateTree($path, $currentPath) {
|
|||||||
if (!$hasSubfolders) {
|
if (!$hasSubfolders) {
|
||||||
$output .= '<a href="arbre-img.php?path=' . urlencode($fullPath) . '" class="tree-button" style="text-decoration: none">🖼️</a>';
|
$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) {
|
if (!$hasSubfolders) {
|
||||||
$output .= '<button onclick="editFolder(\'' . htmlspecialchars($fullPath) . '\', \''
|
$output .= '<button onclick="editFolder(\'' . htmlspecialchars($fullPath) . '\', \''
|
||||||
. rawurlencode($info['title']) . '\', \''
|
. rawurlencode($info['title']) . '\', \''
|
||||||
@ -143,7 +153,6 @@ function generateTree($path, $currentPath) {
|
|||||||
. (hasImages($fullPath) ? 'true' : 'false')
|
. (hasImages($fullPath) ? 'true' : 'false')
|
||||||
. ')" class="tree-button">✏️</button>';
|
. ')" class="tree-button">✏️</button>';
|
||||||
} else {
|
} else {
|
||||||
// Pour les dossiers sans images
|
|
||||||
$output .= '<button onclick="editFolder(\'' . htmlspecialchars($fullPath) . '\', \''
|
$output .= '<button onclick="editFolder(\'' . htmlspecialchars($fullPath) . '\', \''
|
||||||
. rawurlencode($info['title']) . '\', \''
|
. rawurlencode($info['title']) . '\', \''
|
||||||
. rawurlencode($info['description']) . '\', '
|
. rawurlencode($info['description']) . '\', '
|
||||||
@ -160,7 +169,6 @@ function generateTree($path, $currentPath) {
|
|||||||
$output .= generateTree($fullPath, $currentPath);
|
$output .= generateTree($fullPath, $currentPath);
|
||||||
$output .= '</li>';
|
$output .= '</li>';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$output .= '</ul>';
|
$output .= '</ul>';
|
||||||
return $output;
|
return $output;
|
||||||
@ -168,7 +176,6 @@ function generateTree($path, $currentPath) {
|
|||||||
|
|
||||||
$config = getSiteConfig();
|
$config = getSiteConfig();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
<head>
|
<head>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user