











// bloque últimos posts - mitch - phpBB-Es
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
function create_where_clauses($gen_id, $type)
{
global $db, $auth;
$size_gen_id = sizeof($gen_id);
switch($type)
{
case 'forum':
$type = 'forum_id';
break;
case 'topic':
$type = 'topic_id';
break;
default:
trigger_error('No type defined');
}
$out_where = '';
if ($size_gen_id > 0)
{
$auth_f_read = array_keys($auth->acl_getf('f_read', true));
if ($type == 'topic_id')
{
$sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', $gen_id) . '
AND ' . $db->sql_in_set('forum_id', $auth_f_read);
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$topic_id_list[] = $row['topic_id'];
}
unset($gen_id);
$gen_id = $topic_id_list;
$size_gen_id = sizeof($gen_id);
}
$j = 0;
for ($i = 0; $i < $size_gen_id; $i++)
{
$id_check = (int) $gen_id[$i]; // If the type is topic, all checks have been made and the query can start to be built if( $type == 'topic_id' ) { $out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' '; } // If the type is forum, do the check to make sure the user has read permissions else if( $type == 'forum_id' && $auth->acl_get('f_read', $id_check) )
{
$out_where .= ($j == 0) ? 'WHERE ' . $type . ' = ' . $id_check . ' ' : 'OR ' . $type . ' = ' . $id_check . ' ';
}
$j++;
}
}
if ($out_where == '' && $size_gen_id > 0)
{
trigger_error('A list of topics/forums has not been created');
}
return $out_where;
}
// Número de últimos posts a mostrar (editar el 5 si así lo deseas):
$search_limit = 5;
$posts_ary = array(
'SELECT' => 'p.*, t.*, u.username, u.user_colour',
'FROM' => array(
POSTS_TABLE => 'p',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 'u.user_id = p.poster_id'
),
array(
'FROM' => array(TOPICS_TABLE => 't'),
'ON' => 'p.topic_id = t.topic_id'
),
),
'WHERE' => $db->sql_in_set('t.forum_id', array_keys($auth->acl_getf('f_read', true))) . '
AND t.topic_status <> ' . ITEM_MOVED . '
AND t.topic_approved = 1',
'ORDER_BY' => 'p.post_id DESC',
);
$posts = $db->sql_build_query('SELECT', $posts_ary);
$posts_result = $db->sql_query_limit($posts, $search_limit);
while ($posts_row = $db->sql_fetchrow($posts_result))
{
$topic_title = $posts_row['topic_title'];
$topic_title = censor_text($topic_title);
$post_author = get_username_string('full', $posts_row['poster_id'], $posts_row['username'], $posts_row['user_colour']);
$post_date = $user->format_date($posts_row['post_time']);
$post_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "p=" . $posts_row['post_id'] . "#p" . $posts_row['post_id']);
$post_text = nl2br($posts_row['post_text']);
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
$bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);
$post_text = smiley_text($post_text);
$template->assign_block_vars('last_topics', array(
'TOPIC_TITLE' => censor_text($topic_title),
'POST_AUTHOR' => $post_author,
'POST_DATE' => $post_date,
'POST_LINK' => $post_link,
'POST_TEXT' => censor_text($post_text),
));
}
// Fin bloque últimos posts - mitch - phpBB-Es<div class="forabg">
<div class="inner"><span class="corners-top"><span></span></span>
<ul class="topiclist">
<li class="header">
<dl class="icon">
<dt>Últimos Posts</dt>
</dl>
</li>
</ul>
<ul class="topiclist forums">
<li class="row">
<dl>
<dt>
<!-- BEGIN last_topics -->
<a href="{last_topics.POST_LINK}">{LAST_POST_IMG}</a> <a href="{last_topics.POST_LINK}" class="forumtitle">{last_topics.TOPIC_TITLE}</a> por {last_topics.POST_AUTHOR} - {last_topics.POST_DATE}<br />
<!-- END last_topics -->
</dt>
</dl>
</li>
</ul>
<span class="corners-bottom"><span></span></span></div>
</div>


// bloque últimos posts - mitch - phpBB-Es
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
// Número de últimos posts a mostrar (editar el 5 si así lo deseas):
$search_limit = 5;
$forum_id = array(12);
$num_char = 500;
$posts_ary = array(
'SELECT' => 't.forum_id, t.topic_id, t.topic_title, t.topic_type, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_time, t.topic_poster, p.post_text, p.bbcode_uid, p.bbcode_bitfield',
'FROM' => array(
TOPICS_TABLE => 't',
),
'LEFT_JOIN' => array(
array(
'FROM' => array(POSTS_TABLE => 'p'),
'ON' => 't.topic_first_post_id = p.post_id')
),
'WHERE' => $db->sql_in_set('t.forum_id', $forum_id) . '
AND t.topic_status <> ' . ITEM_MOVED . '
AND t.topic_approved = 1
OR t.forum_id = 0', //OR t.forum_id = 0, esta linea es para que muestre tambien los globales ya que el id del foro de estos es 0
'ORDER_BY' => 't.topic_id DESC'
);
$posts = $db->sql_build_query('SELECT', $posts_ary);
$posts_result = $db->sql_query_limit($posts, $search_limit);
while ($posts_row = $db->sql_fetchrow($posts_result))
{
$topic_title = $posts_row['topic_title'];
$topic_title = censor_text($topic_title);
$post_author = get_username_string('full', $posts_row['topic_poster'], $posts_row['topic_first_poster_name'], $posts_row['topic_first_poster_colour']);
$post_date = $user->format_date($posts_row['topic_time']);
$post_link = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $posts_row['forum_id'] . '&t=' . $posts_row['topic_id'] . '#p' . $posts_row['topic_first_post_id']);
$post_text = nl2br($posts_row['post_text']);
$bbcode_bitfield = '';
// Define the global bbcode bitfield, will be used to load bbcodes
$bbcode_bitfield = $bbcode_bitfield | base64_decode($posts_row['bbcode_bitfield']);
// Instantiate BBCode if need be
if ($bbcode_bitfield !== '')
{
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
$bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);
$post_text = smiley_text($post_text);
$template->assign_block_vars('last_topics', array(
'TOPIC_TITLE' => censor_text($topic_title),
'POST_AUTHOR' => $post_author,
'POST_DATE' => $post_date,
'POST_LINK' => $post_link,
'POST_TEXT' => substr(censor_text($post_text), 0, $num_char),
));
}
// Fin bloque últimos posts - mitch - phpBB-Es
$forum_id = array(12); tiene el ID o los IDs de los foros que quieres que se muestre el contenido, cambiando el 12 por el ID del foro.$num_char = 500; Es el número de caracteres a mostrar <!-- BEGIN last_topics -->
<a href="{last_topics.POST_LINK}">{LAST_POST_IMG}</a> <a href="{last_topics.POST_LINK}" class="forumtitle">{last_topics.TOPIC_TITLE}</a> por {last_topics.POST_AUTHOR} - {last_topics.POST_DATE}<br />
<!-- END last_topics --> <!-- BEGIN last_topics -->
<a href="{last_topics.POST_LINK}">{LAST_POST_IMG}</a> <a href="{last_topics.POST_LINK}" class="forumtitle">{last_topics.TOPIC_TITLE}</a> por {last_topics.POST_AUTHOR} - {last_topics.POST_DATE}<br /><p>{last_topics.POST_TEXT}</p><hr />
<!-- END last_topics -->













Frogman Escribió:Adjunto el archivo php











$forum_id = array(4);


// Instantiate BBCode if need be
if ($bbcode_bitfield !== '')
{
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
$bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']); // Instantiate BBCode if need be
if ($bbcode_bitfield !== '')
{
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
$bbcode->bbcode_second_pass($post_text, $posts_row['bbcode_uid'], $posts_row['bbcode_bitfield']);
}










| Temas relacionados | Respuestas | Vistas | Último mensaje |
|---|
Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 1 invitado

