-
Notifications
You must be signed in to change notification settings - Fork 13
/
postsbyforum.php
79 lines (66 loc) · 2 KB
/
postsbyforum.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
<?php
require 'lib/function.php';
require 'lib/layout.php';
$qstrings = array();
if ($id) {
$qstrings[] = "posts.user={$id}";
$by = 'by '.$sql->resultq("SELECT name FROM users WHERE id={$id}");
}
if (!isset($_GET['posttime'])) $posttime = 86400;
else $posttime = intval($_GET['posttime']);
if (($posttime === 0 || $posttime > 2592000) && !$id)
$posttime = 2592000;
if ($posttime !== 0) {
$qstrings[] = "posts.date > ".(ctime()-$posttime);
$during = ' during the last '.timeunits2($posttime);
}
if (empty($qstrings)) $qwhere = '1';
else $qwhere = implode(' AND ', $qstrings);
$posters = $sql->query(
"SELECT forums.*,COUNT(posts.id) AS cnt ".
"FROM forums,threads,posts ".
"WHERE posts.thread=threads.id ".
"AND threads.forum=forums.id ".
"AND {$qwhere} ".
"GROUP BY forums.id ORDER BY cnt DESC");
$userposts = $sql->resultq("SELECT COUNT(*) FROM posts WHERE $qwhere");
$lnk="<a href=postsbyforum.php?id=$id&posttime";
print "$header
$smallfont
$lnk=3600>During last hour</a> |
$lnk=86400>During last day</a> |
$lnk=604800>During last week</a> |
$lnk=2592000>During last 30 days</a>".
((!$id) ? "" : " | $lnk=0>Total</a>").
"<br>
$fonttag Posts $by in forums$during:
$tblstart<tr>
$tccellh width=20> </td>
$tccellh width=100> </td>
$tccellh>Forum</td>
$tccellh width=60>Posts</td>
$tccellh width=80>Forum total</td></tr>
";
for ($i=1;$f=$sql->fetch($posters);$i++) {
print '<tr>';
if($f['minpower']>$power) {
$link="(restricted)";
$viewall="(<s><b>view</b></s>)";
}
else {
$link="<a href='forum.php?id=$f[id]'>$f[title]</a>";
$timeid = (($posttime !== 0) ? "&time={$posttime}" : '');
$viewall="(<a href='postsbyuser.php?id={$id}&forum={$f['id']}{$timeid}'>View</a>)";
}
if (!$id) $viewall = '';
print "
$tccell2>$i</td>
$tccell2>$viewall</td>
$tccell1l>$link</td>
$tccell1><b>$f[cnt]</td>
$tccell1>$f[numposts]</td></tr>
";
}
print "$tblend Total: $userposts posts$footer";
printtimedif($startingtime);
?>