<?php
/*
+--------------------------------------------------------------------------
| Project: Integration script for Joomla and vBulletin
+--------------------------------------------------------------------------
| For Joomla 1.0.x and vBulletin 3.6.x
| (C) 2005-2007 BBPIXEL
|
BBPixel.com - Integration scripts for your Xoops, Joomla, IPB, vBulletin, Vwar..
+---------------------------------------------------------------------------
| > Module: Latest vBulletin's Posts
+---------------------------------------------------------------------------
*/
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
//Params
$forumArray = trim( $params->get( 'forum_array' ));
$numberOfPost = intval($params->get( 'number_of_post', 5 ));
$compactMod = intval($params->get( 'compact_mod', 0 ));
$maxTitleLength = intval($params->get( 'title_length', 0 ));
$introText = $params->get( 'intro_text', '' );
$dateFormat = $params->get( 'date_format', 'm/d/y' );
//Load services for IPB
$content = "{$introText}";
global $bbpixelPPS;
//.. Get lasted topic
$whereForum = "";
if(strlen($forumArray) > 0){
$whereForum = "AND f.forumid NOT IN ({$forumArray})";
}
$query = "SELECT t.*, f.forumid as fid, f.title as fname
FROM {$bbpixelPPS->_vb_db_prefix}thread t,
{$bbpixelPPS->_vb_db_prefix}forum f
WHERE t.forumid = f.forumid {$whereForum}
ORDER BY t.lastpost DESC
LIMIT {$numberOfPost}";
$database->setQuery($query);
$topiclist = $database->loadObjectList();
$enum = 0;
if(is_array($topiclist)){
$row = "";
foreach ($topiclist as $topic){
$style = " class='sectiontableentry1' ";
if($enum%2 == 0){
$style = " class='sectiontableentry2' ";
}
//Title, does it need to cut
if(($maxTitleLength > 0) && strlen($topic->title)>$maxTitleLength){
$title = substr($topic->title, 0, $maxTitleLength)."..";
}else{
$title = $topic->title;
}
if (!$bbpixelPPS->wrapperID) {
$urlTopic = $bbpixelPPS->_vb_forum_url."/showthread.php?t={$topic->threadid}";
$urlLastPost = $bbpixelPPS->_vb_forum_url."/showthread.php?t={$topic->threadid}&goto=newpost";
$urlForum = $bbpixelPPS->_vb_forum_url."/forumdisplay.php?f={$topic->fid}";
$urlUser = $bbpixelPPS->_vb_forum_url."/member.php?u={$topic->postuserid}";
$urlBoard = $bbpixelPPS->_vb_forum_url;
} else {
$urlTopic = $mosConfig_live_site."/index.php?option=com_wrapper&Itemid=".$bbpixel PPS->wrapperID."&bbact=showthread.php?t-{$topic->threadid}";
$urlLastPost = $mosConfig_live_site."/index.php?option=com_wrapper&Itemid=".$bbpixel PPS->wrapperID."&bbact=showthread.php?t-{$topic->threadid}&goto=newpost";
$urlForum = $mosConfig_live_site."/index.php?option=com_wrapper&Itemid=".$bbpixel PPS->wrapperID."&bbact=forumdisplay.php?f-{$topic->fid}";
$urlUser = $mosConfig_live_site."/index.php?option=com_wrapper&Itemid=".$bbpixel PPS->wrapperID."&bbact=member.php?u-{$topic->postuserid}";
$urlBoard = $mosConfig_live_site."/index.php?option=com_wrapper&Itemid=".$bbpixel PPS->wrapperID."&bbact=";
}
$topic->lastpost = date($dateFormat, $topic->lastpost);
if($compactMod == 1){
$row .= "
<div {$style}>
<a href=\"$urlUser\">{$topic->postusername}</a>: <a href='{$urlTopic}' title='{$topic->fname}: {$topic->title}'>{$title}</a><br/>
@ {$topic->lastpost} by {$topic->lastposter}
</div>
";
}else {
$row .= "<tr {$style}>
<td>
<a href='{$urlTopic}' title='{$topic->title}'>{$title}</a><br/>
In: <a href='{$urlForum}'>{$topic->fname}</a>
</td>
<td><a href='{$urlUser}'>{$topic->postusername}</a></td>
<td>{$topic->views}</td>
<td>{$topic->replycount}</td>
<td>
<a href='{$urlLastPost}' title='get last comment..'>{$topic->lastpost}</a><br/>
by <b><i>{$topic->lastposter}</i></b>
</td>
</tr>";
}
$enum++;
}
if($enum>0){
if($compactMod == 1){
$content .= "{$row}";
}else{
$content .= "
<table width='100%'>
<tr>
<td class='sectiontableheader'><b>Thread</b></td>
<td class='sectiontableheader'><b>Author</b></td>
<td class='sectiontableheader'><b>Views</b></td>
<td class='sectiontableheader'><b>Posts</b></td>
<td class='sectiontableheader'><b>Last Comment</b></td>
</tr>
{$row}
<tr>
<td colspan='2'>
<a href='{$urlBoard}'>Visit our forum</a>
</td>
<td colspan='2' align='right'>
© <a href='http://bbpixel.com' title='Powered by BBPixel jvbPlugin - Integration script for your Joomla and vBulletin' target='_blank'>BBPixel.com</a>
</td>
</tr>
</table>";
}
}
}
?>