// forum permissions $forumpermissions = array(); foreach ($vbulletin->forumcache AS $forum) { $forumpermissions[$forum["forumid"]] = fetch_permissions($forum['forumid']); if ((!($forumpermissions[$forum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview'])) OR (!($forum['options'] & $vbulletin->bf_misc_forumoptions['active']) AND !$vbulletin->options['showprivateforums'] AND !in_array($vbulletin->userinfo['usergroupid'], array(5, 6, 7)))) { $pforumids .= ',' . $forum['forumid']; } } if ($vbulletin->options['latest_exclude'] != '') { $pforumids .= ',' . $vbulletin->options['latest_exclude']; } $pforumids = substr($pforumids, 1); if ($pforumids != '') { $platest_and = "thread.forumid NOT IN($pforumids)"; $platest_and_1 = "forum.forumid NOT IN($pforumids)"; }
// converts options to nice variables $limit = $vbulletin->options['latest_number'];
$sql = "SELECT post.postid, post.pagetext, post.userid, post.username, post.visible, post.dateline AS date, thread.forumid, thread.title as thread_title, thread.threadid, forum.forumid, forum.title as forum_title FROM post as post LEFT JOIN thread as thread on (post.threadid = thread.threadid) LEFT JOIN forum as forum on (thread.forumid = forum.forumid) WHERE post.visible = 1 ORDER BY postid DESC LIMIT 10";
$query = $vbulletin->db->query_read($sql);
$counter = 0; $latest_post_bits = '';
while ($row = $vbulletin->db->fetch_array($query)) { // allow to use alternate color in rows require_once(DIR . '/includes/functions.php'); exec_switch_bg();
// strips the bbcode out of the post $row['pagetext'] = strip_bbcode($row['pagetext'], $stripquotes = true, $fast_and_dirty = false, $showlinks = true);
// adds the cutoff ... with substr $row['pagetext'] = substr($row['pagetext'], 0, $vbulletin->options['latest_cut']) . '...';