summaryrefslogtreecommitdiff
path: root/src/emotes/single_page.php
blob: 900003c2ca3b6ee2f4b2aef61936f1ade9494df4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
include_once "../../src/config.php";
?>
<html>

<head>
    <title>AlrightTV</title>
    <link rel="stylesheet" href="/static/style.css">
</head>

<body>
    <div class="container">
        <div class="wrapper">
            <?php html_navigation_bar(); ?>
            <main class="page">
                <section class="sidebar">
                    <?php html_navigation_search(); ?>
                </section>
                <section class="content">
                    <section class="box">
                        <div class="box navtab">
                            Emote - <?php echo $emote->get_code() ?>
                        </div>
                        <div class="box content">
                            <div class="emote-showcase">
                                <img src="<?php echo '/static/userdata/emotes/' . $emote->get_id() . '/' . '1x.' . $emote->get_ext() ?>"
                                    alt="<?php echo $emote->get_code() ?>">
                                <img src="<?php echo '/static/userdata/emotes/' . $emote->get_id() . '/' . '2x.' . $emote->get_ext() ?>"
                                    alt="<?php echo $emote->get_code() ?>">
                                <img src="<?php echo '/static/userdata/emotes/' . $emote->get_id() . '/' . '3x.' . $emote->get_ext() ?>"
                                    alt="<?php echo $emote->get_code() ?>">
                            </div>
                        </div>
                    </section>

                    <section class="box items row">
                        <?php if (isset($_SESSION["user_id"])) {
                            echo '' ?>
                            <div class="items row left full">
                                <form action="/emotes/add.php" method="POST">
                                    <input type="text" name="id" value="<?php echo $emote->get_id() ?>"
                                        style="display: none;">
                                    <button type="submit" class="green">Add to my channel</button>
                                </form>
                            </div>
                            <div class="items row right full">
                                <form action="/emotes/rate.php" method="POST">
                                    <input type="text" name="id" value="<?php echo $emote->get_id() ?>"
                                        style="display: none;">
                                    <input type="text" name="rate" value="5" style="display:none;">
                                    <button type="submit" class="transparent gem"><img src="/static/img/icons/gem.png"
                                            alt="GEM!" title="IT'S A GEM!"></button>
                                </form>
                                <form action="/emotes/rate.php" method="POST">
                                    <input type="text" name="id" value="<?php echo $emote->get_id() ?>"
                                        style="display: none;">
                                    <input type="text" name="rate" value="1" style="display:none;">
                                    <button type="submit" class="transparent coal"><img src="/static/img/icons/coal.png"
                                            alt="COAL!" title="IT'S A COAL!"></button>
                                </form>
                                <a class="button red" href="/emotes/report.php?id=<?php echo $emote->get_id() ?>">Report
                                    emote</a>
                            </div>
                            <?php
                        } else {
                            echo '' ?>
                            <p><a href="/account/login">Log in</a> to get additional features...</p>
                            <?php
                        }
                        ?>
                    </section>

                    <section class="box">
                        <table class="vertical">
                            <tr>
                                <th>Uploader</th>
                                <td><?php
                                $username = "anonymous";
                                $link = "#";

                                if ($emote->get_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/" . $emote->get_uploaded_by();
                                    }

                                    $db = null;
                                }

                                echo "<a href=\"$link\">";
                                echo $username;
                                echo "</a>";

                                echo ", " . date("d M Y", $emote->get_created_at());
                                ?></td>
                            </tr>
                            <tr>
                                <th>Rating</th>
                                <td>Not rated</td>
                            </tr>
                        </table>
                    </section>

                    <section class="box">
                        <div class="content">
                            <p>Added in <?php echo 20 ?> channels</p>
                            <div class="items row">
                                <a href="/users/1">forsen</a>
                                <a href="/users/2">not_forsen</a>
                                <a href="/users/3">lidl_forsen</a>
                            </div>
                        </div>
                    </section>
                </section>
            </main>
        </div>
    </div>
</body>

</html>