-
Notifications
You must be signed in to change notification settings - Fork 0
/
publicProfile.php
133 lines (111 loc) · 3.73 KB
/
publicProfile.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
125
126
127
128
129
130
131
132
133
<?php
require_once 'core/init.php';
//$user = new User();
if(!$username = Input::get('user')){
Redirect::to('index.php');
}else{
$public = new PublicInfo();
$data = $public->getUserProfile(Input::get('user'));
if($public->findUser(Input::get('user'))){
$account = $public->dataUser();
}else{
Redirect::to('index.php');
}
$countPost = $public->getCountPost() ? $public->getCountPost() : 0;
if(Session::exists(Config::get('session/session_name'))){
$user = new User();
}
}
include 'includes/header.php';
?>
<div class="header-wrapper">
<div class="header-container">
<h3>Profile</h3>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div class="row">
<div class="large-3 columns">
<div class="profile-card">
<div class="row">
<div class="large-12 columns">
<?php
if(empty($account->image)){
echo '<img class="profile-img" src="images/profile/default-profile-pic.jpg" alt="Profile Image">';
}else{
echo '<img class="profile-img" src="'.$account->image.'" alt="Profile Image">';
}
?>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<h5 class="profile-name">
<strong>
<?php
if(empty($account->firstname)){
echo display($account->username);
}else{
echo display($account->firstname).' '.display($account->lastname);
}
?>
</strong>
<?php
if(isset($user) && $user->isLoggedIn() && ($user->data()->username == Input::get('user'))){
echo '<a style="float: right; font-size: 23px;" href="settings.php"><i class="fa fa-gear"></i></a>';
}
?>
</h5>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<small><strong>Joined:</strong> <?= date("F j, Y", strtotime($account->joined)); ?></small><br>
<small><strong>Email:</strong> <a href="mailto:<?= display($account->email); ?>"><?= display($account->email); ?></a></small><br>
<small><strong>Location:</strong> <?= display($account->location); ?></small>
<hr class="profile-hr">
<small><?= display($account->description); ?></small>
</div>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<div class="profile-display">
<ul>
<li><span class="display-title">Posts</span><span class="badge"><?= $countPost; ?></span></li>
<li><span class="display-title">Comments</span><span class="alert badge">67</span></li>
<li><span class="display-title">Likes</span><span class="warning badge">124</span></li>
</ul>
</div>
</div>
</div>
</div>
<div class="large-9 columns">
<div class="profile-post-container">
<h3>Articles</h3>
<?php
if(empty($data)){
echo '<div class="post-container"><h4>User doesn\'t have any articles!</h4></div>';
}else{
foreach($data as $post): ?>
<div class="post-container">
<h4><a href="publicPost.php?id=<?= $post->id; ?>"><?= display($post->title); ?></a></h4>
<h6><a href="index.php?id=<?= $post->cat_id; ?>"><?= $post->cat_name; ?></a> /
<small style="color:#8A8989">by</small> <a href="<?= $post->username; ?>"><?= $post->username; ?></a> /
<span style="color:#8A8989"><?= date('M j, Y h:i a', strtotime($post->date_posted)); ?></span>
</h6>
<div><?= truncateHtml(display($post->contents), 300); ?></div>
</div>
<?php
endforeach;
}
?>
</div>
</div>
</div>
</div>
</div>
<?php
include 'includes/footer.php';
?>