Rewrite some stuff

This commit is contained in:
Bruno Rybársky 2024-04-26 15:09:45 +02:00
parent 2949e59045
commit 1f4fa8eb72

@ -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,
];
}