-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathprivate.php
89 lines (78 loc) · 2.35 KB
/
private.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
<?php
require 'lib/function.php';
$windowtitle = "$boardname -- Private Messages";
require 'lib/layout.php';
if (!$log)
errorpage("You need to be logged in to read your private messages.", 'log in (then try again)', 'login.php');
// Viewing someone else?
$u = $loguserid;
if ($isadmin && $id) {
$u = $id;
$idparam = "id=$id&";
}
// Viewing sent messages?
$to = 'to';
$from = 'from';
if ($view == 'sent') {
$to = 'from';
$from = 'to';
$viewparam = 'view=sent&';
}
if(!$ppp)
$ppp=50;
if(!$page)
$page=1;
$pmin=($page-1)*$ppp;
$msgtotal=$sql->resultq("SELECT count(*) FROM pmsgs WHERE user$to=$u");
$pagelinks='Pages:';
$p=0;
for($i=0; $i<$msgtotal; $i+=$ppp) {
$p++;
if($p==$page)
$pagelinks.=" $p";
else
$pagelinks.=" <a href=private.php?{$idparam}{$viewparam}page={$p}>{$p}</a>";
}
// 1252378129
$pmsgs = $sql->query("SELECT p.id,user$from uid,date,t.title,msgread,name,sex,powerlevel,aka
FROM pmsgs p,pmsgs_text t,users u
WHERE user$to=$u
AND p.id=pid
AND user$from=u.id "
.($loguser['id'] == 175 ? "AND p.id > 8387 " : "")
."ORDER BY " .($loguser['id'] == 175 ? "user$from DESC, " : "msgread ASC, ")
."p.id DESC
LIMIT $pmin,$ppp
");
$from[0] = strtoupper($from[0]);
if(!$view)
$viewlink="<a href=private.php?{$idparam}view=sent>View sent messages</a>";
else
$viewlink="<a href=private.php?{$idparam}>View received messages</a>";
print "$header
<table width=100%><td>$fonttag<a href=index.php>$boardname</a> - "
.(($u != $loguserid) ? $sql->resultq("SELECT `name` FROM `users` WHERE `id` = '$u'")."'s private messages" : "Private messages")
." - "
.((!$view) ? 'Inbox' : 'Outbox').": $msgtotal</td>
<td align=right>$smallfont$viewlink | <a href=sendprivate.php>Send new message</a></table>
$tblstart<tr>
$tccellh width=50> </td>
$tccellh>Subject</td>
$tccellh width=15%>$from</td>
$tccellh width=180>Sent on</td></tr>
";
while($pmsg = $sql->fetch($pmsgs)) {
$new = ($pmsg['msgread']?' ':$statusicons['new']);
$namecolor = getuserlink($pmsg, array('id'=>'uid'));
print "
<tr style='height:20px;'>
$tccell1>$new</td>
$tccell2l><a href=showprivate.php?id=$pmsg[id]>$pmsg[title]</td>
$tccell2>$namecolor</td>
$tccell2>".date($dateformat,$pmsg['date']+$tzoff)."
</tr>
";
}
print "$tblend$smallfont$pagelinks$footer";
printtimedif($startingtime);
?>