diff --git a/assets/style.css b/assets/style.css index 78cfea1..97146b3 100644 --- a/assets/style.css +++ b/assets/style.css @@ -207,64 +207,6 @@ ul.navpage_list { height: 1.5rem; } -@media (max-width: 1050px) { - - div#articleslist { - width: 100vw !important; - left: 0 !important; - } - - #toggle_button { - display: flex; - } - - #navsite_list { - display: none; - position: fixed; - flex-direction: column; - width: 100%; - text-align: center; - } - - #navsite_list li { - text-align: center; - } - - .navsite_item { - width: inherit; - } - - ul.navpage_list { - border: 4px solid var(--pico-primary-hover) !important; - display: flex !important; - max-height: 200px !important; - width: inherit; - box-sizing: content-box; - transition-delay: .1s; - } - .navsite_item:not(:hover) .navpage_list { - transition-delay: .1s; - width: inherit; - } - - /*noinspection CssUnusedSymbol*/ - #navsite_list.active { - display: flex; - -moz-box-shadow: 0 20px 28px 0 var(--dimmer); - -webkit-box-shadow: 0 20px 28px 0 var(--dimmer); - background-color: var(--dimmer); - box-shadow: 0 20px 28px 0 var(--dimmer); - top: 80px; - text-align: center; - } - - nav { - flex-direction: column; - align-items: center; - background-color: var(--dimmer); - } -} - #statusMessageContainer { position: fixed; top: 80px; @@ -398,4 +340,76 @@ div#articleslist>article{ #dynmapa { width: 100%; height: 100%; +} + +form.form-content { + display: flex; + flex-direction: row; +} + +div.form-container { + display: flex; + flex-direction: column; +} + +@media (max-width: 1050px) { + + div#articleslist { + width: 100vw !important; + left: 0 !important; + } + + #toggle_button { + display: flex; + } + + #navsite_list { + display: none; + position: fixed; + flex-direction: column; + width: 100%; + text-align: center; + } + + #navsite_list li { + text-align: center; + } + + .navsite_item { + width: inherit; + } + + ul.navpage_list { + border: 4px solid var(--pico-primary-hover) !important; + display: flex !important; + max-height: 200px !important; + width: inherit; + box-sizing: content-box; + transition-delay: .1s; + } + .navsite_item:not(:hover) .navpage_list { + transition-delay: .1s; + width: inherit; + } + + /*noinspection CssUnusedSymbol*/ + #navsite_list.active { + display: flex; + -moz-box-shadow: 0 20px 28px 0 var(--dimmer); + -webkit-box-shadow: 0 20px 28px 0 var(--dimmer); + background-color: var(--dimmer); + box-shadow: 0 20px 28px 0 var(--dimmer); + top: 80px; + text-align: center; + } + + nav { + flex-direction: column; + align-items: center; + background-color: var(--dimmer); + } + + form.form-content { + flex-direction: column; + } } \ No newline at end of file diff --git a/endpoints/meme.php b/endpoints/meme.php new file mode 100644 index 0000000..3684fc7 --- /dev/null +++ b/endpoints/meme.php @@ -0,0 +1,12 @@ + addMeme($endpoint_data['memetext'], $endpoint_data['imageid']), + default => ["Status" => "Fail", "message" => "Invalid action"], + }; +} \ No newline at end of file diff --git a/lib/meme.php b/lib/meme.php index f74a4b4..25af11c 100644 --- a/lib/meme.php +++ b/lib/meme.php @@ -3,16 +3,39 @@ function addMeme(string $memeText, int $imageID): bool { global $mysqli; - if(fileExists($imageID)){ - $stmtMemeAdd = $mysqli->prepare('INSERT INTO Memes (AuthorID, TextContent, FileID) VALUES (?, ?, ?)'); - $stmtMemeAdd->bind_param('isi', $_SESSION['ID'], htmlspecialchars($memeText), $imageID); + + if (isLoggedIn() && fileExists($imageID)) { + $stmtMemeAdd = $mysqli->prepare('INSERT INTO Memes (AuthorID, Title, TextContent, FileID) VALUES (?, ?, ?)'); + $stmtMemeAdd->bind_param('issi', $_SESSION['ID'], htmlspecialchars($memeText), $imageID); $stmtMemeAdd->execute(); return true; } return false; } -function renderMemeGallery() :string +function renderMemeGallery(): string { + global $mysqli; + $stmtlist = $mysqli->prepare('SELECT Memes.ID, Memes.Title Memes.TextContent, Memes.CreatedAt, Files.Path, Files.Type, Users.Nickname FROM Memes INNER JOIN Users ON Memes.AuthorID = Users.ID INNER JOIN Files ON Memes.FileID = Files.ID'); + + // Execute the prepared statement + $stmtlist->execute(); + $memeID = 0; + $title = ""; + $textContent = ""; + $filePath = ""; + $fileType = ""; + $userNickname = ""; + $createdAt = ""; + // Bind the result variables + $stmtlist->bind_result($memeID, $title, $textContent, $createdAt, $filePath, $fileType, $userNickname); + +// Fetch the results + while ($stmtlist->fetch()) { + + } + +// Close the statement + $stmtlist->close(); return ""; } \ No newline at end of file diff --git a/lib/upload.php b/lib/upload.php index f18aa8b..a7ceed0 100644 --- a/lib/upload.php +++ b/lib/upload.php @@ -228,4 +228,17 @@ function addToGroup(int $groupId, int $fileId): bool } } return $output; +} + +function getImageURL(int $imageFileID) :string +{ + global $mysqli; + $path = ""; + $stmtget = $mysqli->prepare('SELECT Path FROM Files WHERE ID = ?'); + $stmtget->bind_param('i', $imageFileID); + $stmtget->execute(); + $stmtget->bind_result($path); + $stmtget->fetch(); + return $path; + } \ No newline at end of file diff --git a/templates/login.html b/templates/login.html index 4e8f956..f8ad280 100644 --- a/templates/login.html +++ b/templates/login.html @@ -3,20 +3,20 @@