Размер файла: 2.78Kb
<?php
//***************************************************************************//
// top_list.php
// ::::::::::::::::::::::::::::::::::: Разработка топа: Злодей. [zlodey.su] :::::::::::::::::::::::::::::::::::::::::::::::
// :::::::::::::::::::::::: Мод 'Cпасибо за тему': KaspeR. [bbmod.net.ru] ::::::::::::::::::::::::::::::::::::::;:::
// ... 2009 год
//**************************************************************************//
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_VIEWMEMBERS);
init_userprefs($userdata);
$page_title = 'Топ 10';
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'list_body.tpl')
);
$numb_strok = 10; // количество выводимых строк
$sql = "SELECT topic_id FROM ".$table_prefix."thanks";
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Could not query users', '', __LINE__, __FILE__, $sql);
}
$total = $db->sql_fetchrowset($result);
$total_new = array();
$total_new_n = array();
for($i = 0; $i < count($total); $i++) //
{
$total_id[$i] = $total[$i]['topic_id'];
}
for($i = 0; $i < count($total); $i++) //
{
if(!in_array($total_id[$i], $total_new))
{
$index_new = count($total_new);
for($s=0; $s<count($total); $s++)
{
if ($total_id[$s] == $total_id[$i])
{
$total_new_n[$index_new] = $total_new_n[$index_new]+1;
}
}
$total_new[$index_new] = $total_id[$i];
}
}
for($i = 0; $i < count($total_new); $i++)
{
$total_new_join[$i] = $total_new_n[$i] . '.' . $total_new[$i];
}
@rsort($total_new_join);
$numb_strok2 = (count($total_new_join) < $numb_strok+1) ? count($total_new_join) : $numb_strok;
for($i = 0; $i < $numb_strok2; $i++)
{
$topic_temp = explode(".",$total_new_join[$i]);
$topic_id = $topic_temp[1];
$numb_sps = $topic_temp[0];
$nomer_posta = $i + 1;
$sql = "SELECT topic_title FROM " . TOPICS_TABLE . "
WHERE topic_id = $topic_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Error Getting Forums!<br />');
}
$tota = $db->sql_fetchrow($result);
$name[$i] = $tota['topic_title'];
$template->assign_block_vars('memberrow', array(
'USERNAME' => $name[$i],
'NOMER_POSTA' => $nomer_posta,
'NUMB_SPS' => $numb_sps,
'U_VIEWPROFILE' => append_sid("viewtopic.php?t"."=$topic_id"))
);
}
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>