From 2c51a000a9f2f51f54b761e4975086f9db3780a4 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sat, 3 May 2025 16:50:50 +0500 Subject: upd: big changes in database.sql + .webp is now default image format --- public/users.php | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) (limited to 'public/users.php') diff --git a/public/users.php b/public/users.php index baebcb4..1fbc6de 100644 --- a/public/users.php +++ b/public/users.php @@ -124,13 +124,13 @@ $stmt = null; if ($id != "") { $stmt = $db->prepare("SELECT * FROM users WHERE id = ?"); - $stmt->execute([intval($id)]); + $stmt->execute([$id]); } else if ($alias_id != "") { $stmt = $db->prepare("SELECT u.* FROM users u INNER JOIN connections co ON (co.alias_id = ? AND co.platform = 'twitch') WHERE co.user_id = u.id "); - $stmt->execute([intval($alias_id)]); + $stmt->execute([$alias_id]); } $user = null; @@ -155,19 +155,19 @@ $stmt->execute([$user->id()]); while ($row = $stmt->fetch()) { // getting more info about set - $set_stmt = $db->prepare("SELECT id, name, size FROM emote_sets WHERE id = ?"); + $set_stmt = $db->prepare("SELECT id, name FROM emote_sets WHERE id = ?"); $set_stmt->execute([$row["emote_set_id"]]); $set = $set_stmt->fetch(); // getting info about emote set content $em_stmt = $db->prepare( - "SELECT e.id, e.mime, e.ext, e.created_at, e.uploaded_by, + "SELECT e.id, e.created_at, e.uploaded_by, CASE - WHEN esc.name IS NOT NULL THEN esc.name + WHEN esc.code IS NOT NULL THEN esc.code ELSE e.code END AS code, CASE - WHEN esc.name IS NOT NULL THEN e.code + WHEN esc.code IS NOT NULL THEN e.code ELSE NULL END AS original_code FROM emotes e @@ -190,7 +190,6 @@ while ($row = $stmt->fetch()) { $emote_set = [ "id" => $set["id"], "name" => $set["name"], - "size" => $set["size"], "emotes" => $emote_set_emotes ]; @@ -285,7 +284,7 @@ if ($is_json) { "status_code" => 200, "message" => null, "data" => [ - "id" => intval($user->id()), + "id" => $user->id(), "username" => $user->username(), "joined_at" => $user->joined_at(), "last_active_at" => $user->last_active_at(), @@ -378,7 +377,7 @@ if ($is_json) { } ?> prepare("SELECT code, ext FROM emotes WHERE id = ?"); + $stmt = $db->prepare("SELECT code FROM emotes WHERE id = ?"); $stmt->execute([$fav_emote]); if ($row = $stmt->fetch()) { @@ -386,7 +385,7 @@ if ($is_json) { echo ' Favorite emote'; echo ''; echo ""; - echo $row["code"] . ' '; + echo $row["code"] . ' '; echo ''; } ?> @@ -398,7 +397,7 @@ if ($is_json) { Send a message id() ?>">Report user'; + echo 'Report user'; } ?> @@ -415,14 +414,10 @@ if ($is_json) { - " class="box"> + " class="box">
' . $set_row["name"] . '

'; - - if ($set_row["size"]) { - echo '

' . $set_row["size"] . '

'; - } ?>
@@ -430,7 +425,7 @@ if ($is_json) { '; + echo ''; } ?> @@ -453,7 +448,7 @@ if ($is_json) { if (!empty($active_emote_set["emotes"])) { foreach ($active_emote_set["emotes"] as $emote_row) { echo '
'; - echo '' . $emote_row['; + echo '' . $emote_row['; echo '

' . $emote_row["code"] . '

'; echo '

' . ($emote_row["uploaded_by"] == null ? (ANONYMOUS_DEFAULT_NAME . "*") : $emote_row["uploaded_by"]["username"]) . '

'; echo '
'; @@ -480,7 +475,7 @@ if ($is_json) { '; - echo '' . $emote_row['; + echo '' . $emote_row['; echo '

' . $emote_row["code"] . '

'; echo ''; } -- cgit v1.2.3