Problema [TOP_FIVE]!
Scris: 02-Apr-2016, 20:03:47
Salut Phpbb am venit la voi cu o mica problema.
Am un forum pe tema we_clearblue care este adaptata la versiunea 2 daca nu ma insel.
dar nu asta este problema ci faptul ca am instalat un top five,dar cu /includes/top_five.php
al lui Anisor sau Anime, cum o avea nickul,deoarece el are ceea ce imi doresc, dar din pacate
index_top_five.html nu cred ca este compatibil oricum v-a las codurile.Dar mai intai o poza cum imi arata
dar si cum as vrea sa arate.Sper sa gasesc o rezolvare.
ASA ARATA!
CLICK!
DAR ASA DORESC SA ARATE!
CLICK2!
Si aici Aveti Codurile:
Forum/styles/we_clearblue/template/topfive_body.html
Forum/includes/top_five.php
Am un forum pe tema we_clearblue care este adaptata la versiunea 2 daca nu ma insel.
dar nu asta este problema ci faptul ca am instalat un top five,dar cu /includes/top_five.php
al lui Anisor sau Anime, cum o avea nickul,deoarece el are ceea ce imi doresc, dar din pacate
index_top_five.html nu cred ca este compatibil oricum v-a las codurile.Dar mai intai o poza cum imi arata
dar si cum as vrea sa arate.Sper sa gasesc o rezolvare.
ASA ARATA!
CLICK!
DAR ASA DORESC SA ARATE!
CLICK2!
Si aici Aveti Codurile:
Forum/styles/we_clearblue/template/topfive_body.html
Cod: Selectaţi tot
<div class="forabg" id="top_five">
<div class="inner">
<ul class="topiclist">
<li class="header">
<dl>
<dt><div class="list-inner">{L_NEWEST_TOPICS}</div></dt>
<dd class="topics tf-active-header">{L_TOP_FIVE_ACTIVE}</dd>
<dd class="lastpost"><span>{L_TOP_FIVE_NEWEST}</span></dd>
</dl>
</li>
</ul>
<ul class="topiclist topics">
<li class="row bg1">
<dl>
<dt>
<div class="list-inner">
<ul>
<!-- BEGIN top_five_topic -->
<li>
<!-- IF top_five_topic.NO_TOPIC_TITLE-->
{top_five_topic.NO_TOPIC_TITLE}
<!-- ELSE -->
<a href="{top_five_topic.U_TOPIC}" class="topictitle subforum<!-- IF top_five_topic.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->">{top_five_topic.TOPIC_TITLE}</a><span class="meta">{top_five_topic.USERNAME_FULL} » {top_five_topic.LAST_TOPIC_TIME} » {L_IN} <a href="{top_five_topic.U_FORUM}">{top_five_topic.FORUM_NAME}</a></span>
<!-- EVENT rmcgirr83_top_five_topiclist_row_append -->
<!-- ENDIF -->
</li>
<!-- END top_five_topic -->
</ul>
</div>
</dt>
<dd class="topics tf-most-active">
<ul>
<!-- BEGIN top_five_active -->
<li>
<span class="meta">{top_five_active.USERNAME_FULL}<span><br /> {L_POSTS}{L_COLON} <a href="{top_five_active.S_SEARCH_ACTION}">{top_five_active.POSTS}</a></span></span>
</li>
<!-- END top_five_active -->
</ul>
</dd>
<dd class="lastpost tf-newest">
<ul>
<!-- BEGIN top_five_newest -->
<li>
<span class="meta">{top_five_newest.USERNAME_FULL}<span><br /> {L_JOINED}{L_COLON} {top_five_newest.REG_DATE}</span></span>
</li>
<!-- END top_five_newest -->
</ul>
</dd>
</dl>
</li>
</ul>
</div>
</div>
Cod: Selectaţi tot
<?php
/**
*
* @package phpBB3
* @version $Id:
* @copyright (c) 2013 Rich McGirr
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* @ Top five varianta Just4Metin by Animo
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* Include only once.
*/
if (!defined('INCLUDES_TOP_FIVE_PHP'))
{
define('INCLUDES_TOP_FIVE_PHP', true);
global $auth, $cache, $user, $db, $phpbb_root_path, $phpEx, $template, $config;
$user->add_lang('mods/top_five');
$how_many = 5; //change this number if you want more or less to display
$forum_ary = array();
$forum_read_ary = $auth->acl_getf('f_read');
foreach ($forum_read_ary as $forum_id => $allowed)
{
if ($allowed['f_read'])
{
$forum_ary[] = (int) $forum_id;
}
}
$forum_ary = array_unique($forum_ary);
if (sizeof($forum_ary))
{
/**
* Select topic_ids
*/
$sql = 'SELECT forum_id, topic_id, topic_type
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('forum_id', $forum_ary) . '
ORDER BY topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $how_many);
$forums = $ga_topic_ids = $topic_ids = array();
while ($row = $db->sql_fetchrow($result))
{
$topic_ids[] = $row['topic_id'];
if ($row['topic_type'] == POST_GLOBAL)
{
$ga_topic_ids[] = $row['topic_id'];
}
else
{
$forums[$row['forum_id']][] = $row['topic_id'];
}
}
$db->sql_freeresult($result);
// Get topic tracking
$topic_ids_ary = $topic_ids;
$topic_tracking_info = array();
foreach ($forums as $forum_id => $topic_ids)
{
$topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $topic_ids, $ga_topic_ids);
}
$topic_ids = $topic_ids_ary;
unset($topic_ids_ary);
// grab all posts that meet criteria and auths
$sql_ary = array(
'SELECT' => 'u.user_id, u.username, u.user_colour, t.topic_title, f.forum_name, t.forum_id, t.topic_id, t.topic_last_post_id, t.topic_last_post_time, t.topic_last_poster_name, p.post_text',
'FROM' => array(TOPICS_TABLE => 't'),
'LEFT_JOIN' => array(
array(
'FROM' => array(USERS_TABLE => 'u'),
'ON' => 't.topic_last_poster_id = u.user_id',
),
array(
'FROM' => array(POSTS_TABLE => 'p'),
'ON' => 'p.post_id = t.topic_last_post_id',
),
array(
'FROM' => array(FORUMS_TABLE => 'f'),
'ON' => 'f.forum_id = t.forum_id',
),
),
'WHERE' => $db->sql_in_set('t.topic_id', $topic_ids),
'ORDER_BY' => 't.topic_last_post_time DESC',
);
$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $how_many);
while( $row = $db->sql_fetchrow($result) )
{
$topic_id = $row['topic_id'];
$forum_id = $row['forum_id'];
$post_unread = (isset($topic_tracking_info[$forum_id][$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$topic_id]) ? true : false;
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id']);
$view_forum_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']);
$topic_title = censor_text($row['topic_title']);
if (utf8_strlen($topic_title) >= 60)
{
$topic_title = (utf8_strlen($topic_title) > 60 + 3) ? utf8_substr($topic_title, 0, 60) . '...' : $topic_title;
}
$is_guest = $row['user_id'] != ANONYMOUS ? false : true;
//BEGIN Topic Text Hover Mod
if(!empty($row['post_text']) && !empty($config['hover_active']))
{
if(!function_exists('bbcode_strip'))
{
include($phpbb_root_path . 'includes/topic_text_hover.' . $phpEx);
}
$text_hover = censor_text(bbcode_strip($row['post_text']));
if (utf8_strlen($text_hover) >= $config['hover_char_limit'])
{
$text_hover = (utf8_strlen($text_hover) > $config['hover_char_limit'] + 3) ? utf8_substr($text_hover, 0, $config['hover_char_limit']) . '...' : $text_hover;
}
}
// END Topic Text Hover MOD
$template->assign_block_vars('top_five_topic',array(
'U_TOPIC' => $view_topic_url,
'FORUM_TITLE' => $row['forum_name'],
'U_FORUM' => $view_forum_url,
'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'),
'POST_TEXT' => (isset($text_hover)) ? $text_hover : '',
'USERNAME_FULL' => $is_guest ? $user->lang['POST_BY_AUTHOR'] . ' ' . get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour'], $row['topic_last_poster_name']) : $user->lang['POST_BY_AUTHOR'] . ' ' . get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']),
'LAST_TOPIC_TIME' => $user->format_date($row['topic_last_post_time'], '|d M Y|, H:i'),
'TOPIC_TITLE' => $topic_title,
));
}
$db->sql_freeresult($result);
}
else
{
$template->assign_block_vars('top_five_topic', array(
'NO_TOPIC_TITLE' => $user->lang['NO_TOPIC_EXIST'],
));
}
// top five posters
// an array of user types we dont' bother with
// could add board founder (USER_FOUNDER) if wanted
$ignore_users = array(USER_IGNORE, USER_INACTIVE);
// top five posters
if (($user_posts = $cache->get('_top_five_posters')) === false)
{
$user_posts = $admin_mod_array = array();
// quick check for forum moderators and administrators
// some may not want to show them
$not_show_admins_mods = false; //change false to true to have moderators and administrators not shown in top five posters
$sql_and = '';
if ($not_show_admins_mods)
{
// grab all admins
$admin_ary = $auth->acl_get_list(false, 'a_', false);
$admin_ary = (!empty($admin_ary[0]['a_'])) ? $admin_ary[0]['a_'] : array();
//grab all mods
$mod_ary = $auth->acl_get_list(false,'m_', false);
$mod_ary = (!empty($mod_ary[0]['m_'])) ? $mod_ary[0]['m_'] : array();
$admin_mod_array = array_unique(array_merge($admin_ary,$mod_ary));
if(sizeof($admin_mod_array))
{
$sql_and = ' AND ' . $db->sql_in_set('u.user_id', $admin_mod_array, true);
}
}
// do the main sql query
$sql_ary = array(
'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_posts',
'FROM' => array(USERS_TABLE => 'u'),
'WHERE' => $db->sql_in_set('u.user_type', $ignore_users, true) . ' ' . $sql_and . '
AND u.user_posts <> 0',
'ORDER_BY' => 'u.user_posts DESC',
);
$result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $how_many);
while ($row = $db->sql_fetchrow($result))
{
$user_posts[$row['user_id']] = array(
'user_id' => $row['user_id'],
'username' => $row['username'],
'user_colour' => $row['user_colour'],
'user_posts' => $row['user_posts'],
);
}
$db->sql_freeresult($result);
// cache this data for 5 minutes, this improves performance
$cache->put('_top_five_posters', $user_posts, 300);
}
foreach ($user_posts as $row)
{
$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
$template->assign_block_vars('top_five_active',array(
'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'author_id=' . $row['user_id'] . '&sr=posts'),
'POSTS' => number_format($row['user_posts']),
'USERNAME_FULL' => $username_string,
));
}
// newest registered users
if (($newest_users = $cache->get('_top_five_newest_users')) === false)
{
$newest_users = array();
// grab most recent registered users
$sql = 'SELECT user_id, username, user_colour, user_regdate
FROM ' . USERS_TABLE . '
WHERE ' . $db->sql_in_set('user_type', $ignore_users, true) . '
AND user_inactive_reason = 0
ORDER BY user_regdate DESC';
$result = $db->sql_query_limit($sql, $how_many);
while ($row = $db->sql_fetchrow($result))
{
$newest_users[$row['user_id']] = array(
'user_id' => $row['user_id'],
'username' => $row['username'],
'user_colour' => $row['user_colour'],
'user_regdate' => $row['user_regdate'],
);
}
$db->sql_freeresult($result);
// cache this data for ever, cache is purged when adding or deleting users
$cache->put('_top_five_newest_users', $newest_users);
}
foreach ($newest_users as $row)
{
$username_string = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']);
$template->assign_block_vars('top_five_newest',array(
'REG_DATE' => $user->format_date($row['user_regdate'], '|d M Y|, H:i'),
'USERNAME_FULL' => $username_string,
));
}
}
?>