This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser.php
68 lines (68 loc) · 3.28 KB
/
user.php
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
<div class="card">
<div class="border px-3">
<div class="p-3 border">
<h4 class="d-flex mb-0">
<i class="fas fa-home ps-2"></i> Home
</h4>
</div>
<div>
<?php if (isset($_SESSION['user_id'])) { ?>
<div class="card border"> <!-- New post bar -->
<div class="card-body pb-2">
<div class="d-flex">
<img src="<?php echo $row["pfpURL"]; ?>" class="rounded-circle" height="50" alt="Avatar" loading="lazy" />
<div class="d-flex align-items-center ps-3">
<div class="w-100">
<input type="text" id="newPost" class="form-control border-0 py-1 px-2" placeholder="Ramble to your community" />
<input type="text" id="link" class="form-control border-0 py-1 px-2" placeholder="Attach a Spotify or Apple Music link" />
</div>
</div>
</div>
<button type="button" class="btn btn-primary">Ramble!</button>
</div>
</div>
</div>
<?php } ?>
<div>
<?php while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { ?>
<div class="d-flex p-3"> <!-- Post -->
<img src="<?php echo $row["pfpURL"]; ?>" class="rounded-circle" height="50" alt="Avatar" loading="lazy" />
<div class="d-flex ps-3">
<div>
<a href="<?php echo "/@" . $row['username']; ?>">
<h6 class="text-body">
<?php echo $row['displayName']; ?>
<span class="small text-muted font-weight-normal"><?php echo "@" . $row['username']; ?></span>
<span class="small text-muted font-weight-normal"> • </span>
<span class="small text-muted font-weight-normal"><?php echo $row["post_timestamp"]; ?></span>
<span><i class="fas fa-angle-down float-end"></i></span>
</h6>
</a>
<p>
<?php if (!isset($row['post_url'])) {
echo $row['post_body'];
} ?>
</p>
<?php if (isset($row['post_embed_link'])) {
$embed_link = $row['post_embed_link'];
if (str_contains($row['post_embed_link'], "open.spotify.com")) {
$embed_link = str_replace(".com/", ".com/embed/", $row['post_embed_link']);
} elseif (str_contains($row['post_embed_link'], "music.apple.com")) {
$embed_link = str_replace("https://music.apple.com", "https://embed.music.apple.com", $row['post_embed_link']);
}
?>
<iframe src="<?php echo $embed_link; ?>" width="100%" height="125" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>
<?php } ?>
<ul class="list-unstyled d-flex justify-content-between">
<li><i class="far fa-comment"></i><span class="small ps-2"><?php echo $row['post_comments'] ?></span></li>
<li><i class="far fa-heart"></i><span class="small ps-2"><?php echo $row['post_likes'] ?></span></li>
<li>
<a href="<?php echo $row['post_permalink'] ?>"></a><i class="far fa-share-square"></i>
</li>
</ul>
</div>
</div>
</div>
<?php } ?>
</div>
</div>