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:
|
<?
if(!(@hmp_check())) exit();
//
// HM-Portal 3.1
// box_boardlastthread.php
// Most current X threads in selected forums only
//
// Enhanced for 3.1.2 to show folder icons
// Enhanced for 3.1.4 (better performance when f_showown is on)
//
// configuration
$f_showfoldericon = $hmpopt['a_nb3']; // show folder icon ("envelope")?
$f_showicon = $hmpopt['a_nb4']; // show thread icon?
$f_showown = $hmpopt['a_nb5']; // show dot in folder icon for own posts in thread?
eval("print(\"".$hm_boxhead_tpl."\");");
// collect threads
if ($wbbuserdata['userid']) {
// registered users
$result=$db->query("SELECT t.*, b.title, b.hotthread_reply, b.hotthread_view, tv.lastvisit, bv.lastvisit AS blastvisit
FROM bb".$n."_threads t
LEFT JOIN bb".$n."_boards b
ON (b.boardid = t.boardid)
LEFT JOIN bb".$n."_threadvisit tv
ON ((tv.threadid = t.threadid) AND (tv.userid = ".$wbbuserdata['userid']."))
LEFT JOIN bb".$n."_boardvisit bv
ON ((bv.boardid = t.boardid) AND (bv.userid = ".$wbbuserdata['userid']."))
WHERE (t.visible <> 0)
AND (b.boardid IN (".$boards_enter_list.")
AND (b.boardid IN (".$hmpopt['boardlist'].")))
AND (t.closed < 3)
ORDER BY t.lastposttime DESC LIMIT ".$hmpopt['a_blt']);
} else {
// guests
$result=$db->query("SELECT t.*, b.title, b.hotthread_reply, b.hotthread_view
FROM bb".$n."_threads t, bb".$n."_boards b
WHERE (b.boardid IN (".$boards_enter_list.")
AND (b.boardid IN (".$hmpopt['boardlist'].")))
AND (b.boardid = t.boardid)
AND (t.visible <> 0)
AND (t.closed < 3)
ORDER BY t.lastposttime DESC LIMIT ".$hmpopt['a_blt']);
}
// copy results to an array
$threadlist = '-1';
$threadarray = array();
while ($row = $db->fetch_array($result)) {
$threadid = intval($row['threadid']);
$threadlist .= ','.$threadid;
$row['userid']=0;
$threadarray[$threadid]=$row;
}
// for "ownpost" dots in folder icons
if ($f_showown && $wbbuserdata['userid']) {
$result=$db->query("SELECT threadid, MAX(userid) AS userid
FROM bb".$n."_posts
WHERE threadid IN (".$threadlist.")
AND userid = '".$wbbuserdata['userid']."'
GROUP BY threadid");
while ($row = $db->fetch_array($result)) {
$threadarray[$row['threadid']]['userid'] = $row['userid'];
}
}
//print('<tr><td class="tablea" colspan="10"><pre>');
//print_r($threadarray);
//print('</pre></td></tr>');
$lines = '';
foreach ($threadarray AS $postzeile) {
// has this thread been read?
$lastposttime = $postzeile['lastposttime'];
$lastvisit = ($wbbuserdata['userid']) ? $postzeile['lastvisit'] : 0;
if (($postzeile['blastvisit']) && ($postzeile['blastvisit'] > $lastvisit))
$lastvisit = $postzeile['blastvisit'];
$tnewflag = (($wbbuserdata['lastvisit'] < $lastposttime) && ($lastvisit < $lastposttime));
$postdate1=formatdate($wbbuserdata['dateformat'],$postzeile['lastposttime'],1);
$posttime1=formatdate($wbbuserdata['timeformat'],$postzeile['lastposttime']);
$icon = $postzeile['iconid'] ? $iconpaths[$postzeile['iconid']] : '';
$postzeile['title'] = getlangvar($postzeile['title'], $lang);
$postzeile['topic'] = htmlconverter(textwrap($postzeile['topic']));
$postzeile['starter'] = htmlconverter(textwrap($postzeile['starter'],25));
$postzeile['lastposter']= htmlconverter(textwrap($postzeile['lastposter'],25));
$postzeile['prefix'] = htmlconverter($postzeile['prefix']);
// thread status for folder icon
$foldericon = ' ';
if ($f_showfoldericon) {
if($postzeile['hotthread_reply']==0) $postzeile['hotthread_reply']=$default_hotthread_reply;
if($postzeile['hotthread_view']==0) $postzeile['hotthread_view'] =$default_hotthread_view;
if($postzeile['important']==2) $foldericon="announce";
else $foldericon = ((isset($postzeile['userid']) && $postzeile['userid']) ? ('dot') : (''))
.($tnewflag ? ('new') : (''))
.(($postzeile['replycount']>=$postzeile['hotthread_reply'] || $postzeile['views']>=$postzeile['hotthread_view']) ? ('hot') : (''))
.(($postzeile['closed']!=0) ? ('lock') : (''))
.'folder';
}
eval ("\$lines .= \"".$tpl->get("hm_box_boardlastthreadbit")."\";");
}
eval("print(\"".$tpl->get("hm_box_boardlastthread")."\");");
eval("print(\"".$hm_boxtail_tpl."\");");
$foldericon = '';
$icon = '';
unset($f_showfoldericon);
unset($f_showicon);
unset($f_showown);
?> |