diff --git a/admin.php b/admin.php index 5637d96..ebca5ff 100644 --- a/admin.php +++ b/admin.php @@ -129,10 +129,21 @@ function showAdminInterface() { + + + + diff --git a/clefs.php b/clefs.php new file mode 100644 index 0000000..ea4b108 --- /dev/null +++ b/clefs.php @@ -0,0 +1,244 @@ +prepare('DELETE FROM share_keys WHERE id = :id'); + $stmt->bindValue(':id', $keyId, SQLITE3_INTEGER); + + if ($stmt->execute()) { + $successMessage = "Clé supprimée avec succès."; + } else { + $errorMessage = "Erreur lors de la suppression de la clé."; + } + } + break; + + case 'clean_expired': + $deletedCount = cleanExpiredShareKeys(); + if ($deletedCount > 0) { + $successMessage = "$deletedCount clé(s) expirée(s) supprimée(s)."; + } else { + $successMessage = "Aucune clé expirée à supprimer."; + } + break; + } +} + +// Construire la requête SQL en fonction des filtres +$query = 'SELECT s.*, a.path, a.identifier as album_identifier + FROM share_keys s + JOIN album_identifiers a ON s.album_identifier = a.identifier + WHERE 1=1'; + +if ($filter === 'active') { + $query .= ' AND s.expires_at > datetime("now")'; +} elseif ($filter === 'expired') { + $query .= ' AND s.expires_at <= datetime("now")'; +} + +if (!empty($albumFilter)) { + $query .= ' AND a.identifier = :album_identifier'; +} + +$query .= ' ORDER BY s.created_at DESC'; + +$stmt = $db->prepare($query); +if (!empty($albumFilter)) { + $stmt->bindValue(':album_identifier', $albumFilter, SQLITE3_TEXT); +} + +$result = $stmt->execute(); +while ($row = $result->fetchArray(SQLITE3_ASSOC)) { + $keys[] = $row; +} + +// Récupérer la liste des albums pour le filtre +$albumsQuery = 'SELECT DISTINCT a.identifier, a.path + FROM album_identifiers a + ORDER BY a.path'; +$albumsResult = $db->query($albumsQuery); +while ($row = $albumsResult->fetchArray(SQLITE3_ASSOC)) { + $albums[] = $row; +} +?> + + + + + + Gestion des clés de partage - ICO + + + + + +
+

Gestion des clés de partage

+
+ + Retour +
+
+ +
+ +
+ + + +
+ + +
+
+ + +
+ +
+ + +
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AlbumURL de partageCréée leExpire leCommentaireActions
+ + + 🔞 + + + + + + Expirée + + +
+ + + +
+
Aucune clé trouvée
+
+
+ + + + \ No newline at end of file diff --git a/styles-admin.css b/styles-admin.css index 5545d3d..be6023b 100644 --- a/styles-admin.css +++ b/styles-admin.css @@ -780,6 +780,67 @@ body { border-left: 4px solid #2196f3; } +/* Styles pour la page de gestion des clefs de partage */ +.filters { + display: flex; + gap: 1rem; + margin-bottom: 2rem; + background: #2a2a2a; + padding: 1rem; + border-radius: 0.5rem; +} + +.filter-group { + display: flex; + align-items: center; + gap: 0.5rem; +} + +.share-url { + display: flex; + gap: 0.5rem; + align-items: center; +} + +.share-url-input { + background: #2a2a2a; + border: none; + padding: 0.5rem; + border-radius: 0.25rem; + color: white; + width: 300px; + font-size: 0.9rem; +} + +.expired-text { + color: #dc3545; + font-style: italic; +} + +.expired-key { + opacity: 0.7; +} + +.no-data { + text-align: center; + padding: 2rem; + color: #666; +} + +.tree-button.copied { + background-color: #28a745 !important; +} + +@media (max-width: 768px) { + .filters { + flex-direction: column; + } + + .share-url-input { + width: 200px; + } +} + /* Styles spécifiques pour la page de gestion du carrousel */ body[data-page="carrousel"] .upload-zone { border-color: #ff8c00;