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
|
$bonthreads = '';
$altbg = alt_trow();
$bonlist = '';
$fid = '10';
$threadfield_cache = xthreads_gettfcache($fid);
if(!empty($threadfield_cache)){
$xtfields = '';
foreach($threadfield_cache as &$tf){
$xtfields .= ', tf.'.$tf['field'].' AS xthreads_'.$tf['field'];
}
}
$query = $db->query("
SELECT t.tid, t.fid, t.uid, t.lastpost, t.lastposteruid, t.lastposter, t.subject, t.replies, t.views, u.username $xtfields
FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."threadfields_data tf ON (tf.tid = t.tid)
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=t.uid)
WHERE fid=10 AND t.visible='1' AND t.closed NOT LIKE 'moved|%'
ORDER BY t.lastpost DESC
LIMIT 0, 10"
);
while($thread = $db->fetch_array($query))
{
$lastpostdate = my_date('relative', $thread['lastpost']);
if(!$thread['lastposteruid'] && !$thread['lastposter'])
{
$lastposter = htmlspecialchars_uni($lang->guest);
}
else
{
$lastposter = htmlspecialchars_uni($thread['lastposter']);
}
$thread['replies'] = my_number_format($thread['replies']);
$thread['views'] = my_number_format($thread['views']);
// Don't link to guest's profiles (they have no profile).
if($thread['lastposteruid'] == 0)
{
$lastposterlink = $lastposter;
}
else
{
$lastposterlink = build_profile_link($lastposter, $thread['lastposteruid']);
}
$thread['subject'] = $thread['fullsubject'] = $parser->parse_badwords($thread['subject']);
if(my_strlen($thread['subject']) > 25)
{
$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
}
$thread['subject'] = htmlspecialchars_uni($thread['subject']);
$thread['fullsubject'] = htmlspecialchars_uni($thread['fullsubject']);
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
$thread['forumlink'] = get_forum_link($thread['fid']);
$thread['forumname'] = $forum_cache[$thread['fid']]['name'];
$threadfields = array();
foreach($threadfield_cache as $k => &$v) {
xthreads_get_xta_cache($v,$tids);
$threadfields[$k] =& $thread['xthreads_'.$k];
xthreads_sanitize_disp($threadfields[$k],$v,(!xthreads_empty($thread['username']) ? $thread['username'] : $thread['threadusername']));
}
eval("\$bonlist .= \"".$templates->get("portal_bonthreads_thread")."\";");
$altbg = alt_trow();
}
if($bonlist)
{
eval("\$bonthreads = \"".$templates->get("portal_bonthreads")."\";");
}
|