'gen_passkey' => array('user'),
'clear_cache_stats' => array('user'),
function index_data()
{
require(AJAX_DIR .'index_data.php');
}
function clear_cache_stats()
{
$user_id = $this->request['user_id'];
CACHE('bb_cache')->rm('get_bt_sql_'.$user_id);
CACHE('bb_cache')->rm('row_'.$user_id);
$this->ajax_die('Статистика обновлена! Пожалуйста перезагрузите страницу!');
}
ajax.index_data = function(tz) {
ajax.exec({
action : 'index_data',
mode : 'change_tz',
tz : tz,
});
};
ajax.clear_cache_stats = function(user_id) {
ajax.exec({
action : 'clear_cache_stats',
user_id : user_id
});
};
ajax.callback.clear_cache_stats = function(data) {};
<h3>{L_USER_RATIO}</h3>
<h3>{L_USER_RATIO} <a href="#" onclick="ajax.clear_cache_stats('{SESSION_USER_ID}'); return false;">Обновить</a></h3>
'gen_passkey' => array('user'),
'clear_cache_stats' => array('user'),
function index_data()
{
require(AJAX_DIR .'index_data.php');
}
function clear_cache_stats()
{
global $lang, $userdata, $bb_cfg;
$user_id = $this->request['user_id'];
// Чистим кеш со статистикой
CACHE('bb_cache')->rm('get_bt_sql_'.$user_id);
CACHE('bb_cache')->rm('row_'.$user_id);
// Обновляем информацию на странице
$data = get_bt_userdata($user_id);
if($data['u_down_total'] > MIN_DL_FOR_RATIO) $ratio = '<b>'.get_bt_ratio($data).'</b>'; else $ratio = '<b>'.$lang['NONE'].'</b> (DL < '.humn_size(MIN_DL_FOR_RATIO).')';
$html = "<div id=\"user_ratio\"><h3>".$lang['USER_RATIO']." <img title=\"Обновить статистику\" src=\"images/pic_loading.gif\" onclick=\"ajax.clear_cache_stats('".$userdata['user_id']."'); return false;\"></h3>";
$html .= '<table cellpadding="0">';
$html .= '<div align="center">'.get_avatar($userdata['user_avatar'], $userdata['user_avatar_type'], !bf($userdata['user_opt'], 'user_opt', 'allow_avatar')).'</div>';
$html .= '<tr><td>'.$lang['USER_RATIO'].'</td><td>'.$ratio.'</td></tr>';
$html .= '<tr><td>'.$lang['DOWNLOADED'].'</td><td class="leechmed"><b>'.humn_size($data['u_down_total']).'</b></td></tr>';
$html .= '<tr><td>'.$lang['UPLOADED'].'</td><td class="seedmed"><b>'.humn_size($data['u_up_total']).'</b></td></tr>';
$html .= '<tr><td>'.$lang['RELEASED'].'</td><td class="seedmed">'.humn_size($data['u_up_release']).'</td></tr>';
$html .= '<tr><td>'.$lang['BONUS'].'</td><td class="seedmed">'.humn_size($data['u_up_bonus']).'</td></tr>';
($bb_cfg['seed_bonus_enabled']) ? $html .= '<tr><td>'.$lang['SEED_BONUS'].'</td><td><a href="profile.php?mode=bonus"><span class="points bold">'.$userdata['user_points'].'</span></a></td></tr></table></div>' : $html .= '';
//Отправляем данные
$this->response['user_id'] = $user_id;
$this->response['html'] = $html;
}
ajax.index_data = function(tz) {
ajax.exec({
action : 'index_data',
mode : 'change_tz',
tz : tz,
});
};
ajax.callback.index_data = function(data) {};
ajax.clear_cache_stats = function(user_id) {
ajax.exec({
action : 'clear_cache_stats',
user_id : user_id
});
};
ajax.callback.clear_cache_stats = function(data) {
$('#user_ratio').html(data.html);
};
<div id="user_ratio">
<h3>{L_USER_RATIO}</h3>
<table cellpadding="0">
<div align="center">{THIS_AVATAR}</div>
<tr><td>{L_USER_RATIO}</td><td><!-- IF DOWN_TOTAL_BYTES gt MIN_DL_BYTES --><b>{USER_RATIO}</b><!-- ELSE --><b>{L_NONE}</b> (DL < {MIN_DL_FOR_RATIO})<!-- ENDIF --></td></tr>
<tr><td>{L_DOWNLOADED}</td><td class="leechmed"><b>{DOWN_TOTAL}</b></td></tr>
<tr><td>{L_UPLOADED}</td><td class="seedmed"><b>{UP_TOTAL}</b></td></tr>
<tr><td>{L_RELEASED}</td><td class="seedmed">{RELEASED}</td></tr>
<tr><td>{L_BONUS}</td><td class="seedmed">{UP_BONUS}</td></tr>
<!-- IF $bb_cfg['seed_bonus_enabled'] --><tr><td>{L_SEED_BONUS}</td><td><a href="profile.php?mode=bonus"><span class="points bold">{POINTS}</span></a></td></tr><!-- ENDIF -->
</table>
</div>
<div id="user_ratio">
<h3>{L_USER_RATIO} <img title="Обновить статистику" src="images/pic_loading.gif" onclick="ajax.clear_cache_stats('{SESSION_USER_ID}'); return false;"></h3>
<table cellpadding="0">
<div align="center">{THIS_AVATAR}</div>
<tr><td>{L_USER_RATIO}</td><td><!-- IF DOWN_TOTAL_BYTES gt MIN_DL_BYTES --><b>{USER_RATIO}</b><!-- ELSE --><b>{L_NONE}</b> (DL < {MIN_DL_FOR_RATIO})<!-- ENDIF --></td></tr>
<tr><td>{L_DOWNLOADED}</td><td class="leechmed"><b>{DOWN_TOTAL}</b></td></tr>
<tr><td>{L_UPLOADED}</td><td class="seedmed"><b>{UP_TOTAL}</b></td></tr>
<tr><td>{L_RELEASED}</td><td class="seedmed">{RELEASED}</td></tr>
<tr><td>{L_BONUS}</td><td class="seedmed">{UP_BONUS}</td></tr>
<!-- IF $bb_cfg['seed_bonus_enabled'] --><tr><td>{L_SEED_BONUS}</td><td><a href="profile.php?mode=bonus"><span class="points bold">{POINTS}</span></a></td></tr><!-- ENDIF -->
</table>
</div>