[php]<?
define('IN_PHPBB', true);
$phpbb_root_path = './forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
if(!$userdata) {
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
}
$CFG['number_recent_topics'] = '10';
$CFG['exceptional_forums'] = '';
$sql = "SELECT * FROM ". FORUMS_TABLE . " ORDER BY forum_id";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql);
}
$forum_data = array();
while( $row = $db->sql_fetchrow($result) )
{
$forum_data[] = $row;
}
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forum_data);
if( $CFG['exceptional_forums'] == '' )
{
$except_forum_id = '\'start\'';
}
else
{
$except_forum_id = $CFG['exceptional_forums'];
}
for ($i = 0; $i < count($forum_data); $i++)
{
if ((!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_read']) or (!$is_auth_ary[$forum_data[$i]['forum_id']]['auth_view']))
{
if ($except_forum_id == '\'start\'')
{
$except_forum_id = $forum_data[$i]['forum_id'];
}
else
{
$except_forum_id .= ',' . $forum_data[$i]['forum_id'];
}
}
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, t.topic_views, t.topic_replies, p.post_id, p.poster_id, p.post_time, u.user_id, u.username, u.user_rank, u.user_posts
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forum_id . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
ORDER BY p.post_id DESC
LIMIT " . $CFG['number_recent_topics'];
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
}
$number_recent_topics = $db->sql_numrows($result);
$recent_topic_row = array();
while ($row = $db->sql_fetchrow($result))
{
$recent_topic_row[] = $row;
}
for($i=0; $i<$number_recent_topics; $i++)
{
echo '»<a href="'.append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#' .$recent_topic_row[$i]['post_id'].'">'.$recent_topic_row[$i]['topic_title'].'</a><b>Autor:</b> '.color_username($recent_topic_row[$i]['user_id'],$recent_topic_row[$i]['username'],$recent_topic_row[$i]['user_rank'],$recent_topic_row[$i]['user_posts']).'<br /><b>Data:</b> '.create_date($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone']).'<br /><b>Odpowiedzi:</b> '.$recent_topic_row[$i]['topic_replies'].'<br /><b>Wy¶wietleń:</b> '.$recent_topic_row[$i]['topic_views'].'';
}
?>[/php]
Tylko 'ubierz' to sobie kosmetycznie.
[url=http://www.link-vault.com/?ss=13287][color=#D70000][b]Wymiana linkami[/b][/color][/url]
[url=http://forum.wpc.net.pl]Warcraft Players Community[/url]