}
function merge($bitfield)
{
$this->data = $this->data | $bitfield->get_blob();
}
}
//Display posts anywhere
function get_post_contents($post)
{
global $db, $phpbb_root_path, $phpEx;
$icons = $cache->obtain_icons();
$sql = 'SELECT p.*, u.*
FROM ' . POSTS_TABLE . ' p
LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = p.poster_id)
WHERE p.post_id = $post";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$flags = (($row['enable_bbcode']) ? 1 : 0) + (($row['enable_smilies']) ? 2 : 0) + (($row['enable_magic_url']) ? 4 : 0);
$row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags);
return (!empty($row['post_id'])) ? $row : false;
}
function get_last_posts($limit)
{
global $db, $phpbb_root_path, $phpEx, $template;
// Grab icons
$icons = $cache->obtain_icons();
$sql = 'SELECT p.*, u.*
FROM ' . POSTS_TABLE . ' p
LEFT JOIN ' . USERS_TABLE . " u ON (u.user_id = p.poster_id)
ORDER BY post_time DESC LIMIT $limit";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$flags = (($row['enable_bbcode']) ? 1 : 0) + (($row['enable_smilies']) ? 2 : 0) + (($row['enable_magic_url']) ? 4 : 0);
$row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags);
$template->assign_block_vars('posts', array(
'POST_AUTHOR_COLOUR'=> get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POSTER_JOINED' => $user->format_date($row['user_regdate']),
'POSTER_POSTS' => $row['user_posts'],
'POSTER_FROM' => $row['user_from'],
'POST_DATE' => $user->format_date($row['post_time']),
'POST_SUBJECT' => $row['post_subject'],
'MESSAGE' => $row['post_text'],
'SIGNATURE' => ($row['enable_sig']) ? $row['user_sig'] : '',
'MINI_POST_IMG' => $user->img('icon_post_target', 'POST'),
'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p={$row['post_id']}&f={$row['forum_id']}#p{$row['post_id']}"),
'POST_ICON_IMG' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '',
'POST_ICON_IMG_WIDTH' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '',
'POST_ICON_IMG_HEIGHT' => (!empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '',
'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $row['poster_id'] && $auth->acl_get('f_edit', $row['forum_id']) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $row['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f={$row['forum_id']}&p={$row['post_id']}") : ''),
'U_QUOTE' => ($auth->acl_get('f_reply', $row['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f={$row['forum_id']}&p={$row['post_id']}") : '',
'POST_ID' => $row['post_id'],
));
}
$db->sql_freeresult($result);
return;
}
//End Display posts anywhere
?>