From 460d12ab7bb93daa6b03300fefdfccefb6d32d01 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Tue, 22 Apr 2025 13:15:31 +0500 Subject: upd: combined single_page and multiple_page into one + updated emote url --- public/emotes/index.php | 209 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 196 insertions(+), 13 deletions(-) (limited to 'public/emotes/index.php') diff --git a/public/emotes/index.php b/public/emotes/index.php index b377430..5224433 100644 --- a/public/emotes/index.php +++ b/public/emotes/index.php @@ -2,6 +2,9 @@ include "../../src/emote.php"; include "../../src/accounts.php"; include_once "../../src/config.php"; +include "../../src/partials.php"; +include "../../src/utils.php"; +include "../../src/alert.php"; authorize_user(); @@ -85,27 +88,207 @@ function display_emote(int $id) return $emote; } -$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || - $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://"; -$current_url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; - -$id = parse_url($current_url, PHP_URL_PATH); -$id = substr($id, 8); -$id = str_replace("/", "", $id); - $emotes = null; $emote = null; -include "../../src/partials.php"; -include "../../src/utils.php"; -include "../../src/alert.php"; +$id = $_GET["id"] ?? ""; if ($id == "" || !is_numeric($id)) { $page = intval($_GET["p"] ?? "0"); $limit = 50; $emotes = display_list_emotes($page, $limit); - include "../../src/emotes/multiple_page.php"; } else { $emote = display_emote(intval($id)); - include "../../src/emotes/single_page.php"; } +?> + + + + + <?php + echo empty($emotes) ? "Emote " . $emote->get_code() : "Emotes" + ?> - alright.party + + + + +
+
+ + +
+ +
+ +
+ + +
+
+ <?php echo $emote->get_code() ?> + <?php echo $emote->get_code() ?> + <?php echo $emote->get_code() ?> +
+
+
+
+ +
+ prepare("SELECT id FROM emote_set_contents WHERE emote_set_id = ? AND emote_id = ?"); + $stmt->execute([$_SESSION["user_emote_set_id"], $emote->get_id()]); + $added = $stmt->rowCount() > 0; + } + + $db = null; + ?> +
+ + + + + + + + +
+
+
+
+ + + +
+
+ + + +
+ Report + emote +
+ +

Log in to get additional features...

+ +
+ +
+ + + + + + + + + +
Uploaderget_uploaded_by()) { + $db = new PDO(DB_URL, DB_USER, DB_PASS); + $stmt = $db->prepare("SELECT username FROM users WHERE id = ?"); + $stmt->execute([$emote->get_uploaded_by()]); + + if ($row = $stmt->fetch()) { + $username = $row["username"]; + $link = "/users.php?id=" . $emote->get_uploaded_by(); + } + + $db = null; + } + + echo ""; + echo $username; + echo ""; + + echo ', get_created_at()); + echo ' UTC">about ' . format_timestamp(time() - $emote->get_created_at()) . " ago"; + ?>
RatingNot rated
+
+ +
+
+ prepare("SELECT users.id, users.username + FROM users + INNER JOIN emote_sets AS es ON es.owner_id = users.id + INNER JOIN emote_set_contents AS ec ON ec.emote_set_id = es.id + WHERE ec.emote_id = ?"); + + $stmt->execute([$emote->get_id()]); + $count = $stmt->rowCount(); + + $db = null; + + if ($count > 0) { + echo "

Added in $count channels

"; + } else { + echo "No one has added this emote yet... :'("; + } + ?> +
+ fetch()) { + echo '' . $row["username"] . ''; + } + ?> +
+
+ +
+ get_id() . '">'; + + if ($e->is_added_by_user()) { + echo ''; + } + + echo '' . $e->get_code() . ''; + echo '

' . $e->get_code() . '

'; + echo ''; + } + ?> +
+ +
+
+
+
+
+ + + \ No newline at end of file -- cgit v1.2.3