blob: 42cd2ac165f1a9e5254e67538d9ed6f8d3644873 (
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
|
<?php
class Emote
{
public string $id;
public string $code;
public string $ext;
public mixed $uploaded_by;
public int $created_at;
public mixed $rating;
public bool $is_in_user_set;
public int $visibility;
function __construct($id, $code, $ext, $created_at, $uploaded_by, $is_in_user_set, $rating, $visibility)
{
$this->id = $id;
$this->code = $code;
$this->ext = $ext;
$this->created_at = $created_at;
$this->uploaded_by = $uploaded_by;
$this->is_in_user_set = $is_in_user_set;
$this->rating = $rating;
$this->visibility = $visibility;
}
function get_id()
{
return $this->id;
}
function get_code()
{
return $this->code;
}
function get_ext()
{
return $this->ext;
}
function get_created_at()
{
return $this->created_at;
}
function get_uploaded_by()
{
return $this->uploaded_by;
}
function is_added_by_user()
{
return $this->is_in_user_set;
}
function get_rating()
{
return $this->rating;
}
function get_visibility()
{
return $this->visibility;
}
}
function html_random_emote(PDO &$db)
{
$stmt = $db->prepare("SELECT id, ext, code FROM emotes WHERE visibility = 1 ORDER BY RAND() LIMIT 1");
$stmt->execute();
if ($row = $stmt->fetch()) {
echo ''
?>
<section class="box" id="box-random-emote">
<div class="box navtab">
<p>Random emote</p>
</div>
<div class="box content center">
<a href="/emotes?id=<?php echo $row["id"] ?>">
<img src="/static/userdata/emotes/<?php echo $row["id"] . '/3x.' . $row["ext"] ?>"
alt="<?php echo $row["code"] ?>" width="192">
</a>
</div>
</section>
<?php
;
}
}
|