diff --git a/admin.php b/admin.php index 5637d96..ebca5ff 100644 --- a/admin.php +++ b/admin.php @@ -129,10 +129,21 @@ function showAdminInterface() {
+ + + + +Album | +URL de partage | +Créée le | +Expire le | +Commentaire | +Actions | +
---|---|---|---|---|---|
+ + + 🔞 + + | ++ + Expirée + + | + + ++ | + | + | + + | +
Aucune clé trouvée | +
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; +} +?> + + +
+ + +
+ + + + +
+