This commit is contained in:
Bruno Rybársky 2024-04-26 09:51:40 +02:00
parent 688a68042c
commit 72287e315d
2 changed files with 2 additions and 1 deletions

@ -7,6 +7,7 @@ function addMeme(string $title, string $memeText, int $imageID): array
{
global $mysqli;
$output = ["Status" => "Fail"];
$output["Permalink"] = "/" . fileExists($imageID, false);
if (isLoggedIn() && fileExists($imageID, false) && !empty($title) && !empty($memeText) && !empty($imageID) && $imageID > 0) {
$stmtMemeAdd = $mysqli->prepare('INSERT INTO Memes (AuthorID, Title, TextContent, FileID) VALUES (?, ?, ?, ?)');
$stmtMemeAdd->bind_param('issi', $_SESSION['ID'], htmlspecialchars($title), htmlspecialchars($memeText), $imageID);

@ -180,7 +180,7 @@ function fileExists(int $fileId, bool $onlyMine = true): bool|string
return false;
}
global $mysqli;
if (!$onlyMine && !isAdmin()) {
if (!$onlyMine && !isModerator()) {
$onlyMine = true;
}
$query = $onlyMine ? 'SELECT ID, Path FROM Files WHERE ID = ? AND UploadedBy = ?' : 'SELECT ID, Path FROM Files WHERE ID = ?';