From 1f4fa8eb72bd7fb5bcfdaf3adda98b728096c26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Fri, 26 Apr 2024 15:09:45 +0200 Subject: [PATCH] Rewrite some stuff --- lib/upload.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/upload.php b/lib/upload.php index e3bfe58..24d3775 100644 --- a/lib/upload.php +++ b/lib/upload.php @@ -109,7 +109,7 @@ function listFiles($onlyMine = true): array if (!$onlyMine && !isModerator()) { $onlyMine = true; } - $query = "SELECT ID, Path, Type, UploadedAt, UploadedBy FROM Files ORDER BY UploadedAt DESC"; + $query = "SELECT Files.ID, Files.Path, Files.Type, Files.UploadedAt, Files.UploadedBy, Users.Nickname FROM Files INNER JOIN Users ON Files.UploadedBy = Users.ID ORDER BY UploadedAt DESC"; if ($onlyMine) { $query .= " WHERE UploadedBy = ?"; @@ -124,9 +124,10 @@ function listFiles($onlyMine = true): array $path = ""; $type = ""; $uploadedAt = ""; - $uploadedBy = 0; + $uploadedByID = 0; + $uploadedBy = ""; - $stmt->bind_result($id, $path, $type, $uploadedAt, $uploadedBy); + $stmt->bind_result($id, $path, $type, $uploadedAt, $uploadedByID, $uploadedBy); $stmt->execute(); @@ -137,6 +138,7 @@ function listFiles($onlyMine = true): array 'Path' => $path, 'Type' => $type, 'UploadedAt' => $uploadedAt, + 'UploadedByID' => $uploadedByID, 'UploadedBy' => $uploadedBy, ]; }