Update meme voting

This commit is contained in:
Bruno Rybársky 2024-04-27 11:57:07 +02:00
parent 8af1b6f073
commit d6b8057053

@ -106,7 +106,7 @@ function doImageUpload($inFile, $outFile): bool
function listFiles($onlyMine = true): array function listFiles($onlyMine = true): array
{ {
$output = ["Status" => "Fail"]; $output = ["Status" => "Success"];
require_once "lib/account.php"; require_once "lib/account.php";
if (isLoggedIn()) { if (isLoggedIn()) {
global $mysqli; global $mysqli;
@ -134,7 +134,7 @@ function listFiles($onlyMine = true): array
$stmt->bind_result($id, $path, $type, $uploadedAt, $uploadedByID, $uploadedBy); $stmt->bind_result($id, $path, $type, $uploadedAt, $uploadedByID, $uploadedBy);
$stmt->execute(); $stmt->execute();
$files = array();
// Fetch the results into the bound variables // Fetch the results into the bound variables
while ($stmt->fetch()) { while ($stmt->fetch()) {
$files[] = [ $files[] = [
@ -148,10 +148,7 @@ function listFiles($onlyMine = true): array
} }
// Check if any results were fetched // Check if any results were fetched
if (!empty($files)) { $output["Files"] = $files;
$output["Status"] = "Success";
$output["Files"] = $files;
}
$stmt->close(); $stmt->close();
} }