forked from fgrardi/smash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmashedProjects.php
124 lines (109 loc) · 6.02 KB
/
smashedProjects.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
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("bootstrap.php");
session_start();
$conn = Db::getInstance();
if (isset($_SESSION['id'])) {
$sessionId = $_SESSION['id'];
$userDataFromId = User::getUserDataFromId($sessionId);
}
$user = new User();
$key = $_GET['p'];
$userData = User::getUserDataFromId($key);
$userPosts = $user->getUserPostsFromId($key);
$posts = Post::showSmashedProjects($key);
if (empty($key)) {
header('Location: index.php');
}
if (empty($posts)) {
$emptyState = true;
}
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php include_once('style.php'); ?>
<link rel="stylesheet" href="styles/custom.css">
<title>Smash - Showcase <?php echo htmlspecialchars($userData['username']); ?></title>
</head>
<body>
<?php include_once('header.php'); ?>
<div class="container">
<?php if (isset($_SESSION['id'])): ?>
<?php if ($_SESSION['id'] == $key): ?>
<div class="alert alert-info mt-4" role="alert"><strong>Smash your projects and show them to the world!</strong> Copy the url of this page and send it to possible internships, businesses or even your friends. FYI, this message is only visible to you.</div>
<?php endif; ?>
<?php endif; ?>
<div class="row d-flex align-items-center justify-content-center">
<div class="col-sm-12 col-md-12 col-lg-6 text-center">
<img src="<?php echo htmlspecialchars($userData['profile_pic']); ?>" class="img-thumbnail rounded-circle mt-5" alt="profile picture">
<p class="username mt-3 mb-1"><?php echo htmlspecialchars($userData['username']); ?></p>
<p class="biography mb-1"><?php echo htmlspecialchars($userData['bio']); ?></p>
<p class="education"><?php echo htmlspecialchars($userData['education']); ?></p>
<form action="" method="post">
<div class="my-4">
<div class="profile-btn">
<?php if (!empty($userPosts[0]['social_linkedin'])) : ?>
<a href="<?php echo htmlspecialchars($userPosts[0]['social_linkedin']); ?>"
class="btn btn-outline-primary btn-icon mb-2"><img src="assets/icons/icon_linkedin.png"
alt="linkedin"></a>
<?php endif; ?>
<?php if (!empty($userPosts[0]['social_github'])) : ?>
<a href="<?php echo htmlspecialchars($userPosts[0]['social_github']); ?>"
class="btn btn-outline-primary btn-icon mb-2"><img src="assets/icons/icon_github.png"
alt="github"></a>
<?php endif; ?>
<?php if (!empty($userPosts[0]['social_instagram'])) : ?>
<a href="<?php echo htmlspecialchars($userPosts[0]['social_instagram']); ?>"
class="btn btn-outline-primary btn-icon mb-2"><img src="assets/icons/icon_instagram.png"
alt="instagram"></a>
<?php endif; ?>
<?php if (!empty($userPosts[0]['social_portfolio'])) : ?>
<a href="<?php echo htmlspecialchars($userPosts[0]['social_portfolio']); ?>" target="_blank"
class="btn btn-outline-primary btn-icon mb-2"><img src="assets/icons/icon_portfolio.png"
alt="portfolio"></a>
<?php endif; ?>
</div>
</div>
</form>
</div>
</div>
<div>
<?php if (!empty($emptyState)) : ?>
<div class="empty-state">
<img class="d-block mx-auto" src="assets/images/empty-state-weareimd.png" alt="empty state">
</div>
<?php else : ?>
<div class="row justify-content-start">
<?php foreach ($posts as $key => $p) : ?>
<?php $tags = Post::getTagsFromPost($p[0]); ?>
<div class="d-flex align-items-center py-0">
<img src="<?php echo htmlspecialchars($p['profile_pic']); ?>" class="img-profile-post">
<h4 class="pt-2 ps-2"><?php echo htmlspecialchars($p['username']);?></h4>
</div>
<div class="pt-2">
<h2 class="mb-1"><?php echo htmlspecialchars($p['title']); ?></h2>
<div class="col-sm-12 col-md-12 col-lg-9">
<p class=""><?php echo htmlspecialchars($p['description']); ?>
<?php foreach ($tags as $tag): ?>
<span class="link-primary"><?php echo htmlspecialchars($tag['tag']); ?></span>
<?php endforeach; ?>
</p>
</div>
<img src="<?php echo htmlspecialchars($p['image']); ?>" width="100%" height="" class="img-project-post"
style="object-fit:cover">
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div>
<?php include_once('footer.php'); ?>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="javascript/follow.js"></script>
<script src="javascript/report-user.js"></script>
<script src="javascript/smashed.js"></script>
</body>
</html>