Sources/
Boardindex.phpPesquisar
loadTemplate('BoardIndex');
Adicionar
TopStats();
?>
// TopStats by ilker
function TopStats()
{
global $context, $smcFunc, $txt, $db_prefix, $scripturl, $modSettings;
// Newest members top 10
$members_result = $smcFunc['db_query']('', '
SELECT id_member, real_name, posts
FROM {db_prefix}members
ORDER BY id_member DESC
LIMIT 10',
array(
)
);
$context['new_members'] = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
$context['new_members'][] = array(
'name' => $row_members['real_name'],
'id' => $row_members['id_member'],
'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
);
}
$smcFunc['db_free_result']($members_result);
//// Newest members top 10 Finish
// Top 10 karma
$members_result = $smcFunc['db_query']('', '
SELECT id_member, real_name, karma_good
FROM {db_prefix}members
ORDER BY karma_good DESC
LIMIT 10');
$context['karma'] = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
$context['karma'][] = array(
'name' => $row_members['real_name'],
'id' => $row_members['id_member'],
'karma' => $row_members['karma_good'],
'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
);
}
$smcFunc['db_free_result']($members_result);
if (empty($context['karma']))
return;
// Top 10 karma
// Poster top 10.
$members_result = $smcFunc['db_query']('', '
SELECT id_member, real_name, posts
FROM {db_prefix}members
WHERE posts > {int:no_posts}
ORDER BY posts DESC
LIMIT 10',
array(
'no_posts' => 0,
)
);
$context['top_posters'] = array();
$max_num_posts = 1;
$context['MemberColor_ID_MEMBER'] = array();
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
$context['top_posters'][] = array(
'name' => $row_members['real_name'],
'id' => $row_members['id_member'],
'num_posts' => $row_members['posts'],
'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
);
if ($max_num_posts < $row_members['posts'])
$max_num_posts = $row_members['posts'];
if (!empty($modSettings['MemberColorStats']) && !empty($row_members['id_member']))
$context['MemberColor_ID_MEMBER'][$row_members['id_member']] = $row_members['id_member'];
}
$smcFunc['db_free_result']($members_result);
foreach ($context['top_posters'] as $i => $poster)
{
$context['top_posters'][$i]['post_percent'] = round(($poster['num_posts'] * 100) / $max_num_posts);
$context['top_posters'][$i]['num_posts'] = comma_format($context['top_posters'][$i]['num_posts']);
}
// Board top 10.
$boards_result = $smcFunc['db_query']('', '
SELECT id_board, name, num_posts
FROM {db_prefix}boards AS b
WHERE {query_see_board}' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . '
AND b.redirect = {string:blank_redirect}
ORDER BY num_posts DESC
LIMIT 10',
array(
'recycle_board' => $modSettings['recycle_board'],
'blank_redirect' => '',
)
);
$context['top_boards'] = array();
$max_num_posts = 1;
while ($row_board = $smcFunc['db_fetch_assoc']($boards_result))
{
$context['top_boards'][] = array(
'id' => $row_board['id_board'],
'name' => $row_board['name'],
'num_posts' => $row_board['num_posts'],
'href' => $scripturl . '?board=' . $row_board['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['name'] . '</a>'
);
if ($max_num_posts < $row_board['num_posts'])
$max_num_posts = $row_board['num_posts'];
}
$smcFunc['db_free_result']($boards_result);
foreach ($context['top_boards'] as $i => $board)
{
$context['top_boards'][$i]['post_percent'] = round(($board['num_posts'] * 100) / $max_num_posts);
$context['top_boards'][$i]['num_posts'] = comma_format($context['top_boards'][$i]['num_posts']);
}
// Are you on a larger forum? If so, let's try to limit the number of topics we search through.
if ($modSettings['totalMessages'] > 100000)
{
$request = $smcFunc['db_query']('', '
SELECT id_topic
FROM {db_prefix}topics
WHERE num_replies != {int:no_replies}' . ($modSettings['postmod_active'] ? '
AND approved = {int:is_approved}' : '') . '
ORDER BY num_replies DESC
LIMIT 100',
array(
'no_replies' => 0,
'is_approved' => 1,
)
);
$topic_ids = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$topic_ids[] = $row['id_topic'];
$smcFunc['db_free_result']($request);
}
else
$topic_ids = array();
// Topic views top 10.
$topic_view_result = $smcFunc['db_query']('', '
SELECT m.subject, t.num_views, t.id_board, t.id_topic, b.name
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_first_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
AND b.id_board != {int:recycle_board}' : '') . ')
WHERE {query_see_board}' . (!empty($topic_ids) ? '
AND t.id_topic IN ({array_int:topic_list})' : ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}' : '')) . '
ORDER BY t.num_views DESC
LIMIT 10',
array(
'topic_list' => $topic_ids,
'recycle_board' => $modSettings['recycle_board'],
'is_approved' => 1,
)
);
$context['top_topics_views'] = array();
$max_num_views = 1;
while ($row_topic_views = $smcFunc['db_fetch_assoc']($topic_view_result))
{
censorText($row_topic_views['subject']);
$row_topic_views['subject'] = shorten_subject($row_topic_views['subject'], 18);
$context['top_topics_views'][] = array(
'id' => $row_topic_views['id_topic'],
'board' => array(
'id' => $row_topic_views['id_board'],
'name' => $row_topic_views['name'],
'href' => $scripturl . '?board=' . $row_topic_views['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row_topic_views['id_board'] . '.0">' . $row_topic_views['name'] . '</a>'
),
'subject' => $row_topic_views['subject'],
'num_views' => $row_topic_views['num_views'],
'href' => $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0',
'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_views['id_topic'] . '.0">' . $row_topic_views['subject'] . '</a>'
);
if ($max_num_views < $row_topic_views['num_views'])
$max_num_views = $row_topic_views['num_views'];
}
$smcFunc['db_free_result']($topic_view_result);
foreach ($context['top_topics_views'] as $i => $topic)
{
$context['top_topics_views'][$i]['post_percent'] = round(($topic['num_views'] * 100) / $max_num_views);
$context['top_topics_views'][$i]['num_views'] = comma_format($context['top_topics_views'][$i]['num_views']);
}
// Try to cache this when possible, because it's a little unavoidably slow.
if (($members = cache_get_data('stats_top_starters', 360)) == null)
{
$request = $smcFunc['db_query']('', '
SELECT id_member_started, COUNT(*) AS hits
FROM {db_prefix}topics' . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? '
WHERE id_board != {int:recycle_board}' : '') . '
GROUP BY id_member_started
ORDER BY hits DESC
LIMIT 10',
array(
'recycle_board' => $modSettings['recycle_board'],
)
);
$members = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
$members[$row['id_member_started']] = $row['hits'];
$smcFunc['db_free_result']($request);
cache_put_data('stats_top_starters', $members, 360);
}
if (empty($members))
$members = array(0 => 0);
// Topic poster top 10.
$members_result = $smcFunc['db_query']('', '
SELECT id_member, real_name
FROM {db_prefix}members
WHERE id_member IN ({array_int:member_list})
ORDER BY FIND_IN_SET(id_member, {string:top_topic_posters})
LIMIT 10',
array(
'member_list' => array_keys($members),
'top_topic_posters' => implode(',', array_keys($members)),
)
);
$context['top_starters'] = array();
$max_num_topics = 1;
while ($row_members = $smcFunc['db_fetch_assoc']($members_result))
{
$context['top_starters'][] = array(
'name' => $row_members['real_name'],
'id' => $row_members['id_member'],
'num_topics' => $members[$row_members['id_member']],
'href' => $scripturl . '?action=profile;u=' . $row_members['id_member'],
'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['id_member'] . '">' . $row_members['real_name'] . '</a>'
);
if ($max_num_topics < $members[$row_members['id_member']])
$max_num_topics = $members[$row_members['id_member']];
if (!empty($modSettings['MemberColorStats']))
$context['MemberColor_ID_MEMBER'][$row_members['id_member']] = $row_members['id_member'];
}
$smcFunc['db_free_result']($members_result);
foreach ($context['top_starters'] as $i => $topic)
{
$context['top_starters'][$i]['post_percent'] = round(($topic['num_topics'] * 100) / $max_num_topics);
$context['top_starters'][$i]['num_topics'] = comma_format($context['top_starters'][$i]['num_topics']);
}
//Yeah baby give me some colors =).
if (!empty($modSettings['MemberColorLinkInstalled']) && !empty($context['MemberColor_ID_MEMBER'])) {
$colorDatas = load_onlineColors($context['MemberColor_ID_MEMBER']);
$cmemcolid = null;
if (!empty($modSettings['MemberColorStats'])) {
// First the Top Posters =)
foreach($context['top_posters'] as $key => $value) {
$cmemcolid = $context['top_posters'][$key]['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['top_posters'][$key]['link'] = $colorDatas[$cmemcolid]['colored_link'];
}
// First the Top Starter =)
foreach($context['top_starters'] as $key => $value) {
$cmemcolid = $context['top_starters'][$key]['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['top_starters'][$key]['link'] = $colorDatas[$cmemcolid]['colored_link'];
}
// First the New Members =)
foreach($context['new_members'] as $key => $value) {
$cmemcolid = $context['new_members'][$key]['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['new_members'][$key]['link'] = $colorDatas[$cmemcolid]['colored_link'];
}
// First the Top Karma =)
foreach($context['karma'] as $key => $value) {
$cmemcolid = $context['karma'][$key]['id'];
if(!empty($colorDatas[$cmemcolid]['colored_link']))
$context['karma'][$key]['link'] = $colorDatas[$cmemcolid]['colored_link'];
}
}
if (!empty($modSettings['latestMember']) && !empty($modSettings['MemberColorLatestMember'])) {
if(!empty($colorDatas[$modSettings['latestMember']]['colored_link']))
$context['latest_member']['link'] = $colorDatas[$modSettings['latestMember']]['colored_link'];
}
}
}
Boardindex.template.php// This is the "Recent Posts" bar.
if (!empty($settings['number_recent_posts']))
{
echo '
<h4 class="titlebg"><span class="left"></span>
<a href="', $scripturl, '?action=recent"><img class="icon" src="', $settings['images_url'], '/post/xx.gif" alt="', $txt['recent_posts'], '" /></a>
<span>', $txt['recent_posts'], '</span>
</h4>
<div class="hslice" id="recent_posts_content">
<div class="entry-title" style="display: none;">', $context['forum_name_html_safe'], ' - ', $txt['recent_posts'], '</div>
<div class="entry-content" style="display: none;">
<a rel="feedurl" href="', $scripturl, '?action=.xml;type=webslice">', $txt['subscribe_webslice'], '</a>
</div>';
// Only show one post.
if ($settings['number_recent_posts'] == 1)
{
// latest_post has link, href, time, subject, short_subject (shortened with...), and topic. (its id.)
echo '
<strong><a href="', $scripturl, '?action=recent">', $txt['recent_posts'], '</a></strong>
<p id="infocenter_onepost" class="middletext">
', $txt['recent_view'], ' "', $context['latest_post']['link'], '" ', $txt['recent_updated'], ' (', $context['latest_post']['time'], ')<br />
</p>';
}
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<dl id="ic_recentposts" class="middletext">';
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<dt><strong>', $post['link'], '</strong> ', $txt['by'], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</dt>
<dd>', $post['time'], '</dd>';
echo '
</dl>';
}
echo '
</div>';
}
Pesquisar
// Here's where the "Info Center" starts...
Adicionar acima do pesquisado
// full istatistikler ivan_ . . .Update smfpt
echo '<br />
<span class="clear upperframe"><span></span></span>
<div class="roundframe"><div class="innerframe">
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
<table border="0" width="100%" cellspacing="1" cellpadding="2" class="bordercolor">
<tr><td width="100%" colspan="5" class="catbg" height="24"><a href="http://www.smfpt.net">Full - Top 10</a></td></tr>
<tr class="titlebg">
<td width="20%"><span class="smalltext">Top 10 Mensagem</span></td>
<td width="17%"><span class="smalltext">Top 10 Karma</span></td>
<td width="17%"><span class="smalltext">Top 10 Tópico</span></td>
<td width="29%"><span class="smalltext">Top 10 Tópico Popular</span></td>
<td width="17%"><span class="smalltext">Novos Membros</span></td></tr>
<tr class="windowbg">
<td width="20%" valign="top"><table><tr>
<td width="50%" class="windowbg2">
<span class="smalltext"><b>membros</b></span></td>
<td width="30%" class="windowbg2" align="right"><span class="smalltext"><b>Mensagem</b></span></td></tr>';
foreach ($context['top_posters'] as $poster)
{echo '
<tr><td width="75%" class="windowbg2"><img alt="" src="', $settings['default_theme_url'], '/images/t10/1top10.gif" /><span class="smalltext">', $poster['link'], '</span></td>
<td width="25%" class="windowbg2" align="right"><span class="smalltext">', $poster['num_posts'], '</span></td></tr>';
}echo '</table></td>
<td width="17%" valign="top"><table class="windowbg"><tr>
<td width="75%" class="windowbg2"><span class="smalltext"><b>membros</b></span></td>
<td width="25%" class="windowbg2" align="right"><span class="smalltext"><b>Karma</b></span></td></tr>';
foreach ($context['karma'] as $member)
{echo '
<tr><td width="75%" class="windowbg2" valign="top"><img alt="" src="', $settings['default_theme_url'], '/images/t10/2top10.gif" /><span class="smalltext">', $member['link'], '</span></td>
<td width="25%" class="windowbg2" align="right" valign="top"><span class="smalltext">', $member['karma'], '</span></td></tr>';
}echo '</table></td>
<td width="17%" valign="top"><table class="windowbg"><tr>
<td width="75%" class="windowbg2"><span class="smalltext"><b>Membro</b></span></td>
<td width="25%" class="windowbg2" align="right"><span class="smalltext"><b>tópico</b></span></td></tr>';
foreach ($context['top_starters'] as $poster)
{echo '
<tr><td width="75%" class="windowbg2" valign="top"><img alt="" src="', $settings['default_theme_url'], '/images/t10/3top10.gif" /><span class="smalltext">', $poster['link'], '</span></td>
<td width="25%" class="windowbg2" align="right" valign="top"><span class="smalltext">', $poster['num_topics'], '</span></td></tr>';
}echo '</table></td>
<td width="29%" valign="top"><table width="100%" class="windowbg"><tr>
<td width="80%" class="windowbg2"><span class="smalltext"><b>tópico</b></span></td>
<td width="20%" class="windowbg2" align="right"><span class="smalltext"><b>Hit</b></span></td></tr>';
foreach ($context['top_topics_views'] as $topic)
{echo '
<tr><td width="80%" class="windowbg2" valign="top"><img alt="" src="', $settings['default_theme_url'], '/images/t10/4top10.gif" /><span class="smalltext">', $topic['link'], '</span></td>
<td width="20%" class="windowbg2" align="right" valign="top"><span class="smalltext">', $topic['num_views'], '</span><img alt="" src="', $settings['default_theme_url'], '/images/t10/ivan_hit.gif" /></td></tr>';
}echo '</table></td>
<td width="17%" valign="top"><table width="100%" class="windowbg"><tr>
<td width="100%" class="windowbg2"><span class="smalltext"><b>membros</b></span></td></tr>';
foreach ($context['new_members'] as $poster)
{echo '
<tr><td width="100%" class="windowbg2" valign="top"><img alt="" src="', $settings['default_theme_url'], '/images/t10/5top10.gif" /><span class="smalltext">',$poster['link'], '</span></td> </tr>';
}echo '</table></td></tr>
<tr class="windowbg">
<td width="100%" colspan="5" height="0"><table width="100%">
<tr class="titlebg">
<td width="30%"><span class="smalltext"><b>Respondeu Categoria</b></span></td>
<td width="27%"><span class="smalltext"><b>Tópico Respondido</b></span></td>
<td width="18%"><span class="smalltext"><b>Remetente</b></span></td>
<td width="25%"><span class="smalltext"><b>Dia</b></span></td></tr></table>
<table cellspacing="1" width="100%" cellpadding="0" border="0">';
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td class="windowbg2" valign="top" width="30%"><img alt="" src="', $settings['default_theme_url'], '/images/t10/6top10.gif" /><span class="smalltext">', $post['board']['link'], '</span></td>
<td class="windowbg2" valign="top" width="27%"><img alt="" src="', $settings['default_theme_url'], '/images/t10/7top10.gif" /><span class="smalltext"><a href="',$post['href'],'">', $post['short_subject'], '</a></span></td>
<td class="windowbg2" valign="top" width="18%"><img alt="" src="', $settings['default_theme_url'], '/images/t10/8top10.gif" /><span class="smalltext">', $post['poster']['link'],'</span></td>
<td class="windowbg2" valign="top" width="25%"><img alt="" src="', $settings['default_theme_url'], '/images/t10/9top10.gif" /><span class="smalltext">', $post['time'], '</span></td></tr>';
echo '</table></td></tr></table></div></div>';
As imagens estao no anexo
Nao esqueca de colocar Admin-> Tema em uso-> Tema Configurações -> Geral para exibir a página principal da últimas mensagem: não se esqueça colocar 10 aqui.