summaryrefslogtreecommitdiff
path: root/modules/mod_recent_posts.php
blob: 99af12078ec5453c8da13aea1bd327f79e35bc04 (plain)
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
<?php
/**
 * Params: 
 * - title : if is "title", show the title of the post, else show the date of creation
 * - b : numeric id of board to show posts from
 * - all_boards : display posts from all boards. Default behavior is to auto-track to board you are in.
 *
 * @version $Header$
 * @package boards
 * @subpackage modules
 */

/**
 * required setup
 */

include_once( BOARDS_PKG_CLASS_PATH.'BitBoardPost.php' );

global $gBitSmarty, $gQueryUserId, $gBitSystem, $moduleParams;
if( !empty( $moduleParams ) ) {
	extract( $moduleParams );
}

$listHash = array( 'user_id' => $gQueryUserId, 'sort_mode' => 'created_desc' );

if( !empty( $moduleParams['module_rows'] ) ) {
	$listHash['max_records'] = $moduleParams['module_rows'];
}

if( !empty( $module_params['b'] ) ) {
	$listHash['board_id'] = $module_params['b'];
} elseif( !empty( $_REQUEST['b'] ) && empty( $module_params['all_boards'] ) ) {
	$listHash['board_id'] = $_REQUEST['b'];
}
$gBitSmarty->assign( 'modRecentPostsBoardId', !empty( $listHash['board_id'] ) );

if( BitBase::verifyId( $gQueryUserId ) ) {
	$listHash['user_id'] = $gQueryUserId;
}

$post = new BitBoardPost();
if( $postList = $post->getList( $listHash ) ) {
	$gBitSmarty->assign( 'modLastBoardPosts', $postList );
}

?>