forked from Xkeeper0/jul
/
profile.php
240 lines (212 loc) · 10.8 KB
/
profile.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
require 'lib/function.php';
$user=@$sql->fetchq("SELECT * FROM users WHERE id=$id");
$windowtitle="$boardname -- Profile for $user[name]";
require 'lib/layout.php';
// if ($_GET['id'] == 1 && !$x_hacks['host']) {
// print "$header<br><center><img src='http://earthboundcentral.com/wp-content/uploads/2009/01/m3deletede.png'></center><br>$footer";
// printtimedif($startingtime);
// die();
// }
if (!$user) {
print "$header<br>$tblstart$tccell1>The specified user doesn't exist.$tblend$footer";
printtimedif($startingtime);
die();
}
$maxposts=$sql->resultq("SELECT posts FROM users ORDER BY posts DESC LIMIT 1");
/* User ratings (disabled)
$users1=$sql->query("SELECT id,posts,regdate FROM users");
while($u=$sql->fetch_array($users1)){
$u['level']=calclvl(calcexp($u['posts'],(ctime()-$u['regdate'])/86400));
if ($u['posts']<0 or $u['regdate']>ctime()) $u['level']=1;
$users[$u['id']]=$u;
}
$ratescore=0;
$ratetotal=0;
$ratings=$sql->query("SELECT userfrom,rating FROM userratings WHERE userrated=$id");
while($rating=@$sql->fetch($ratings)){
$ratescore+=$rating['rating']*$users[$rating['userfrom']]['level'];
$ratetotal+=$users[$rating['userfrom']]['level'];
}
$ratetotal*=10;
$numvotes=mysql_num_rows($ratings);
if($ratetotal) {
$ratingstatus=(floor($ratescore*1000/$ratetotal)/100)." ($ratescore/$ratetotal, $numvotes votes)";
} else {
$ratingstatus="None";
}
if($loguserid and $logpwenc and $loguserid!=$id)
$ratelink=" | <a href=rateuser.php?id=$id>Rate user</a>";
*/
$userrank=getrank($user['useranks'],$user['title'],$user['posts'],$user['powerlevel']);
$threadsposted=$sql->resultq("SELECT count(id) AS cnt FROM threads WHERE user=$id",0,"cnt");
$i=0;
$lastpostdate="None";
if($user['posts']) {
$lastpostdate=date($dateformat,$user['lastposttime']+$tzoff);
//$postsfound=$sql->resultq("SELECT count(id) AS cnt FROM posts WHERE user=$id",0,"cnt");
$post = @$sql->fetchq("SELECT id, thread FROM posts WHERE user=$id AND date=$user[lastposttime]");
if ($post && $thread = $sql->fetchq("SELECT title,forum FROM threads WHERE id=$post[1]")) {
$forum = $sql->fetchq("SELECT id,title,minpower FROM forums WHERE id=$thread[forum]");
$thread[0]=str_replace("<","<",$thread[0]);
if ($forum['minpower']>$loguser['powerlevel'] and $forum['minpower'])
$lastpostlink=", in a restricted forum";
else
$lastpostlink=", in <a href=thread.php?pid=$post[0]#$post[0]>$thread[0]</a> (<a href=forum.php?id=$forum[id]>$forum[title]</a>)";
}
}
if($log) {
$sendpmsg=" | <a href=sendprivate.php?userid=$id>Send private message</a>";
if($isadmin){
if($user['lastip'])
$lastip=" <br>with IP: <a href='ipsearch.php?ip={$user['lastip']}' style='font-style:italic;'>$user[lastip]</a>";
$sneek="<tr>$tccell1s colspan=2><a href='private.php?id={$id}' style='font-style:italic;'>View private messages</a> |"
." <a href='forum.php?fav=1&user={$id}' style='font-style:italic;'>View favorites</a> |"
//." <a href='rateuser.php?action=viewvotes&id={$id}' style='font-style:italic;'>View votes</a> |"
." <a href='edituser.php?id={$id}' style='font-style:italic;'>Edit user</a>";
}
}
$aim=str_replace(" ","+",$user[aim]);
$schname=$sql->resultq("SELECT name FROM schemes WHERE id=$user[scheme]");
$numdays=(ctime()-$user['regdate'])/86400;
$user['signature']=doreplace($user['signature'],$user['posts'],$numdays,$user['name']);
// $user['signature']=doreplace2($user['signature'],$user['posts'],$numdays,$user['name']);
$user['postheader']=doreplace($user['postheader'],$user['posts'],$numdays,$user['name']);
// $user['postheader']=doreplace2($user['postheader'],$user['posts'],$numdays,$user['name']);
if ($user['picture']) $picture = "<img src=\"$user[picture]\">";
if ($user['moodurl']) $moodavatar = " | <a href='avatar.php?id=$id' class=\"popout\" target=\"_blank\">Preview mood avatar</a>";
$icqicon="<a href=http://wwp.icq.com/$user[icq]#pager><img src=http://wwp.icq.com/scripts/online.dll?icq=$user[icq]&img=5 border=0></a>";
if(!$user['icq']){
$user['icq']="";
$icqicon="";
}
$tccellha="<td bgcolor=$tableheadbg";
$tccellhb="><center>$fonthead";
// Todo: This is a clear hack. Remove it.
$birthday = (date('m-d', $user['birthday']) == date('m-d',ctime() + $tzoff));
$rsex = (($birthday) ? 255 : $user['sex']);
$namecolor = getnamecolor($rsex,$user['powerlevel'], false);
$tzoffset=$user['timezone'];
$tzoffrel=$tzoffset-$loguser['timezone'];
$tzdate=date($dateformat,ctime()+$tzoffset*3600);
if($user[birthday]){
$birthday=date("l, F j, Y",$user[birthday]);
$age="(".floor((ctime()-$user[birthday])/86400/365.2425)." years old)";
}
// RPG fun shit
$exp=calcexp($user['posts'],(ctime()-$user['regdate'])/86400);
$lvl=calclvl($exp);
$expleft=calcexpleft($exp);
$expstatus="Level: $lvl<br>EXP: $exp (for next level: $expleft)";
if($user['posts'] > 0) $expstatus.="<br>Gain: ".calcexpgainpost($user['posts'],(ctime()-$user['regdate'])/86400)." EXP per post, ".calcexpgaintime($user[posts],(ctime()-$user[regdate])/86400)." seconds to gain 1 EXP when idle";
$postavg=sprintf("%01.2f",$user[posts]/(ctime()-$user[regdate])*86400);
$totalwidth=116;
$barwidth=@floor(($user[posts]/$maxposts)*$totalwidth);
if($barwidth<0) $barwidth=0;
if($barwidth) $baron="<img src=images/$numdir"."bar-on.gif width=$barwidth height=8>";
if($barwidth<$totalwidth) $baroff="<img src=images/$numdir"."bar-off.gif width=".($totalwidth-$barwidth)." height=8>";
$bar="<img src=images/$numdir"."barleft.gif>$baron$baroff<img src=images/$numdir"."barright.gif><br>";
if(!$topposts) $topposts=5000;
if($user['posts']) $projdate=ctime()+(ctime()-$user['regdate'])*($topposts-$user['posts'])/($user['posts']);
if(!$user['posts'] or $user['posts']>=$topposts or $projdate>2000000000 or $projdate<ctime()) $projdate="";
else $projdate=" -- Projected date for $topposts posts: ".date($dateformat,$projdate+$tzoff);
if($user['minipic']) $minipic="<img src=\"". htmlspecialchars($user[minipic]) ."\" width=16 height=16 align=absmiddle> ";
$homepagename=$user['homepageurl'];
if($user['homepagename']) $homepagename="$user[homepagename]</a> - $user[homepageurl]";
if($user['postbg']) $postbg="<div style='background:url($user[postbg]);' height=100%>";
loadtlayout();
$user['headtext']=$user['postheader'];
$user['signtext']=$user['signature'];
$user['text'] = "Sample text. [quote=fhqwhgads]A sample quote, with a <a href=about:blank>link</a>, for testing your layout.[/quote]This is how your post will appear.";
$user['uid'] = $_GET['id'];
$user['date'] = ctime();
// so that layouts show up regardless of setting (for obvious reasons)
$loguser['viewsig'] = 1;
// shop/rpg such
$shops=$sql->query('SELECT * FROM itemcateg ORDER BY corder');
$eq=$sql->fetchq("SELECT * FROM users_rpg WHERE uid=$id");
$itemids=array_unique(array($eq['eq1'], $eq['eq2'], $eq['eq3'], $eq['eq4'], $eq['eq5'], $eq['eq6'], $eq['eq7']));
$itemids=implode(',', $itemids);
$eqitems=$sql->query("SELECT * FROM items WHERE id IN ({$itemids})");
while($item=$sql->fetch($eqitems)) $items[$item['id']]=$item;
while($shop=$sql->fetch($shops))
$shoplist.="
<tr>
$tccell1s>$shop[name]</td>
$tccell2s width=100%>".$items[$eq['eq'.$shop['id']]]['name']." </td>
";
/* extra munging for whatever reason */
$user['email'] = urlencode($user['email']);
// AKA
if ($user['aka'] && $user['aka'] != $user['name'])
$aka = "$tccell1l width=150><b>Also known as</td> $tccell2l>$user[aka]<tr>";
else $aka='';
print "
$header
<div>$fonttag Profile for <b>$minipic<span style='color:#{$namecolor}'>$user[name]</span></b></div>
<table cellpadding=0 cellspacing=0 border=0>
<td width=100% valign=top>
$tblstart
$tccellh colspan=2><center>General information<tr>
<!-- $tccell1l width=150><b>Username</td> $tccell2l>$user[name]<tr> -->
$aka
$tccell1l width=150><b>Total posts</td> $tccell2l>$user[posts] ($postavg per day) $projdate<br>$bar<tr>
$tccell1l width=150><b>Total threads</td> $tccell2l>$threadsposted<tr>
$tccell1l width=150><b>EXP</td> $tccell2l>$expstatus<tr>
". (false ? " $tccell1l width=150><b>User rating</td> $tccell2l>$ratingstatus<tr>" : "") ."
$tccell1l width=150><b>Registered on</td> $tccell2l>".@date($dateformat,$user[regdate]+$tzoff)." (".floor((ctime()-$user[regdate])/86400)." days ago)<tr>
$tccell1l width=150><b>Last post</td> $tccell2l>$lastpostdate$lastpostlink<tr>
$tccell1l width=150><b>Last activity</td> $tccell2l>".date($dateformat,$user[lastactivity]+$tzoff)."$lastip<tr>
$tblend
<br>$tblstart
$tccellh colspan=2><center>Contact information<tr>
$tccell1l width=150><b>Email address</td> $tccell2l><a href='mailto:$user[email]'>$user[email]</a> <tr>
$tccell1l width=150><b>Homepage</td> $tccell2l><a href='$user[homepageurl]'>$homepagename</a> <tr>
$tccell1l width=150><b>ICQ number</td> $tccell2l>$user[icq] $icqicon <tr>
$tccell1l width=150><b>AIM screen name</td> $tccell2l><a href='aim:goim?screenname=$aim'>$user[aim]</a> <tr>
$tblend
<br>$tblstart
$tccellh colspan=2><center>User settings<tr>
$tccell1l width=150><b>Timezone offset</td> $tccell2l>$tzoffset hours from the server, $tzoffrel hours from you (current time: $tzdate)<tr>
$tccell1l width=150><b>Items per page</td> $tccell2l>". $user['threadsperpage'] ." threads, ". $user['postsperpage'] ." posts<tr>
$tccell1l width=150><b>Color scheme</td> $tccell2l>".$schname."<tr>
$tblend
</td><td> </td><td valign=top>
$tblstart
$tccellh><center>RPG status<tr>
$tccell1l><img src='status.php?u=$id'>
$tblend
<br>$tblstart
$tccellh colspan=2><center>Equipped Items<tr>
$shoplist
$tblend
</td></table>
<br>$tblstart
$tccellh colspan=2><center>Personal information<tr>
$tccell1l width=150><b>Real name</td> $tccell2l>$user[realname] <tr>
$tccell1l width=150><b>Location</td> $tccell2l>$user[location] <tr>
$tccell1l width=150><b>Birthday</td> $tccell2l>$birthday $age <tr>
$tccell1l width=150><b>User bio</td> $tccell2l>". dofilters(doreplace2(doreplace($user['bio'], $user['posts'], (ctime()-$user['regdate'])/86400, $user['name']))) ." <tr>
$tblend
<br>$tblstart
$tccellh colspan=2><center>Sample post<tr>
". threadpost($user, 1) ."
$tblend
<br>$tblstart
$tccellhs colspan=2><center>Options<tr>
$tccell2s colspan=2>
<a href=thread.php?user=$id>Show posts</a> |
<a href=forum.php?user=$id>View threads by this user</a>
$sendpmsg
$ratelink
$moodavatar
<tr>
$tccell2s colspan=2>
<a href=postsbyuser.php?id=$id>List posts by this user</a> |
<a href=postsbytime.php?id=$id>Posts by time of day</a> |
<a href=postsbythread.php?id=$id>Posts by thread</a> |
<a href=postsbyforum.php?id=$id>Posts by forum</td>$sneek
$tblend$footer
";
printtimedif($startingtime);
?>