-
Notifications
You must be signed in to change notification settings - Fork 0
/
lastposts.php
70 lines (64 loc) · 1.56 KB
/
lastposts.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
<?php
include("lib/common.php");
$hours = $lastPostsTimeLimit;
$qPosts = "select ";
$qPosts .=
"posts.id, posts.date, users.id as uid, users.name, users.displayname, users.powerlevel, users.sex, threads.title as ttit, forums.title as ftit";
$qPosts .=
" from posts
left join users on users.id = posts.user
left join threads on threads.id = posts.thread
left join forums on threads.forum = forums.id
left join categories on categories.id = forums.catid";
$qPosts .= " where forums.minpower <= ".$loguser['powerlevel']." and categories.minpower <= ".$loguser['powerlevel']." and posts.date >= ".(time() - ($hours * 60*60))." order by date desc limit 0, 100";
$rPosts = Query($qPosts);
while($post = Fetch($rPosts))
{
$c = ($c+1) % 2;
$theList .= format(
"
<tr class=\"cell{5}\">
<td>
{3}
</td>
<td>
{4}
</td>
<td>
{2}
</td>
<td>
{1}
</td>
<td>
» <a href=\"thread.php?pid={0}#{0}\">{0}</a>
</td>
</tr>
", $post['id'], cdate($dateformat,$post['date']), UserLink($post, "uid"), $post['ftit'], strip_tags($post['ttit']), $c);
}
if($theList == "")
$theList = format(
"
<tr class=\"cell1\">
<td colspan=\"5\" style=\"text-align: center\">
".__("Nothing has been posted in the last {0}.")."
</td>
</tr>
", Plural($hours, __("hour")));
write(
"
<table class=\"margin outline\">
<tr class=\"header0\">
<th colspan=\"5\">".__("Last posts")."</th>
</tr>
<tr class=\"header1\">
<th>".__("Forum")."</th>
<th>".__("Thread")."</th>
<th>".__("User")."</th>
<th>".__("Date")."</th>
<th></th>
</tr>
{0}
</table>
", $theList);
?>