-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathpostsbythread.php
71 lines (59 loc) · 1.96 KB
/
postsbythread.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
<?php
require 'lib/function.php';
require 'lib/layout.php';
$qstrings = array();
if ($id) {
$qstrings[] = "p.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[] = "p.date > ".(ctime()-$posttime);
$during = ' during the last '.timeunits2($posttime);
}
if (empty($qstrings)) $qwhere = '1';
else $qwhere = implode(' AND ', $qstrings);
$posters = $sql->query(
"SELECT t.id,t.replies,t.title,t.forum,f.minpower,f.title ftitle,COUNT(p.id) cnt " .
"FROM threads t,posts p,forums f " .
"WHERE p.thread=t.id AND t.forum=f.id AND $qwhere " .
"GROUP BY t.id ORDER BY cnt DESC,t.firstpostdate DESC LIMIT 1000");
$lnk="<a href=postsbythread.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 threads$during:
$tblstart
$tccellh width=30> </td>
$tccellh width=300>Forum</td>
$tccellh>Thread</td>
$tccellh width=70>Posts</td>
$tccellh width=90>Thread total
";
for($i=1;$t=$sql->fetch($posters);$i++) {
$t['title'] = str_replace(array('<', '>'), array('<', '>'), $t['title']);
if($t['minpower']>$power && $t['minpower']>0) {
$forum = '(restricted forum)';
$thread = '(private thread)';
}
else {
$forum = "<a href='forum.php?id={$t['forum']}'>{$t['ftitle']}</a>";
$thread = "<a href='thread.php?id={$t['id']}'>{$t['title']}</a>";
}
print "<tr>
$tccell2>$i</td>
$tccell2>{$forum}</td>
$tccell1l>{$thread}</td>
$tccell1 style='font-weight:bold;'>$t[cnt]</td>
$tccell1>".($t['replies']+1)."</td></tr>";
}
print $tblend.$footer;
printtimedif($startingtime);
?>