B
Boltik
Гость
Пора и СидБонус добавить сюда
Пора и СидБонус добавить сюда
эм... дописать мод... элементарно кстати...Boltik, где бы такой взять..
Boltik, да, но некоторые хотят то готовый) но не я канеш.
function user_stats()
{
global $db, $bb_cfg, $lang, $userdata;
$user_id = (int) $this->request['user_id'];
$btu = get_bt_userdata ($user_id);
$ratio = get_bt_ratio ($btu);
$act_tor = get_bt_active_torrent ($user_id);
$u_up_total = humn_size($btu['u_up_total']);
$u_up_bonus = humn_size($btu['u_up_bonus']);
$u_up_release = humn_size($btu['u_up_release']);
$u_down_total = humn_size($btu['u_down_total']);
$speed_up = humn_size($act_tor['speed_up']);
$speed_down = humn_size($act_tor['speed_down']);
$seed_bonus = ($btu['user_bonus']) ? $btu['user_bonus'] : 0;
if ($btu['u_down_total'] < MIN_DL_FOR_RATIO) $ratio = '---';
############ Закончили ###################
############ Выводим данные ##############
$html = '
<table class="ratio1 table-wrap bCenter borderless w100" cellspacing="1">
<tr class="row3 tCenter">
<td colspan="2" class="bold">Статистика</td>
</tr>
<tr class="row1 seed">
<td class="med tLeft"> '.$lang['BT_RATIO'].':</p></td>
<td class="bold tLeft"> '.$ratio.'</td>
</tr>
<tr class="row5 leech">
<td class="med tLeft"> <a class="leechsmall" href="'.SEARCH_URL.'?dlu='.$user_id.'&dlc=1#results">'.$lang['DOWNLOADED'].'</a>: </td>
<td class="tLeft"> <b>'.$u_down_total.'</b> ('.$act_tor['leecher'].')</td>
</tr>
<tr class="row1 seed">
<td class="med tLeft"> '.$lang['UPLOADED'].': </p></td>
<td class="tLeft"> <b>'.$u_up_total.'</b> ('.$act_tor['seeder'].')</td>
</tr>
<tr class="row5 seed">
<td class="med tLeft"> <i><a class="seedsmall" href="'.TRACKER_URL.'?rid='.$user_id.'#results">'.$lang['RELEASED'].'</a>:</i> </td>
<td class="tLeft"> <i>'.$u_up_release.' ('.$act_tor['releaser'].')</i></td>
</tr>
<tr class="row1 dlWill">
<td class="med tLeft"> <i><a class="small dlWill" href="'.TOPIC_URL.'4">'.$lang['BT_BONUS_UP'].'</a>:</i> </td>
<td class="tLeft"> <i>'.$u_up_bonus.'</i></td>
</tr>
<tr class="row5 tDLCmpl">
<td class="med tLeft"> <a class="small tDLCmpl" href="'.BONUS_URL.'">Сид бонус</a>: </td>
<td class="tLeft tDLCmpl"> '.$seed_bonus.'</td>
</tr>
<tr class="row3">
<td colspan="2" class="med tCenter bold">Спасибы</td>
</tr>
<tr class="row1">
<td class="tLeft"><span class="small">Вы:</span></td>
<td class="tLeft"><span class="small">'.@get_user_thanks($user_id).'</span></td>
</tr>
<tr class="row1">
<td class="tLeft"><span class="small">Вам:</span></td>
<td class="tLeft"><span class="small">'.@get_user_thanked($user_id).'</span></td>
</tr>
<tr class="row3">
<td colspan="2" class="med tCenter bold">Тек. скорость</td>
</tr>
<tr class="row1">
<td style="text-align: justify;" colspan="2" class="tCenter"><span class="seed small">Upl. '.$speed_up.'</span> | <span class="leech small">Dwnl. '.$speed_down.'</span></td>
</tr>
</table>
';
$this->response['post_id'] = (int) $this->request['post_id'];
$this->response['html'] = $html;
}
function get_bt_userdata ($user_id)
{
global $db, $bb_cache;
$cache_name = 'bt_userdata_'.$user_id;
if(!$data=$bb_cache->get($cache_name))
{
$data = $db->fetch_row('SELECT * FROM '. BT_USERS_TABLE .' WHERE user_id = '. (int) $user_id .' LIMIT 1');
$bb_cache->set($cache_name, $data, 300);
}
return $data;
}
function get_bt_active_torrent ($user_id)
{
global $db, $bb_cache;
$cache_name = 'bt_active_torrent_'.$user_id;
$act_tor = array();
if(!$data=$bb_cache->get($cache_name))
{
$data = $db->fetch_row("SELECT SUM(speed_up) AS speed_up, SUM(speed_down) AS speed_down, SUM(releaser) AS releaser, SUM(seeder) AS seeder, COUNT(user_id) AS act_tor FROM " . BT_TRACKER_TABLE . " WHERE user_id = " . (int) $user_id);
$bb_cache->set($cache_name, $data, 300);
}
$act_tor['releaser'] = ($data['releaser']) ? $data['releaser'] : 0;
$act_tor['seeder'] = ($data['seeder'] - $data['releaser']);
$act_tor['leecher'] = ($data['act_tor'] - $data['seeder']);
$act_tor['speed_up'] = ($data['speed_up']) ? $data['speed_up'] : 0;
$act_tor['speed_down'] = ($data['speed_down']) ? $data['speed_down'] : 0;
return $act_tor;
}
function get_bt_ratio ($btu)
{
return
(!empty($btu['u_down_total']) && $btu['u_down_total'] > MIN_DL_FOR_RATIO)
? round((($btu['u_up_total'] + $btu['u_up_release'] + $btu['u_up_bonus']) / $btu['u_down_total']), 2)
: null
;
}
а толку ? не подойдёт оно тебе !!! Придут гуру и может быть...., переделают.... )а вот мог бы ты описать чё куда вставлять )
хватит спорить !! говорю не подойдут функции !!!Boltik, да пойдёт, пошёл жэ этот, и твой пойдёт)