diff --git a/upload/ajax.php b/upload/ajax.php index d462b05b5..93b68a8c9 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -436,7 +436,7 @@ class ajax_common } else { - $this->response['group_list_html'] = $lang['GROUP_HIDDEN']; + $this->response['group_list_html'] = $lang['GROUP_LIST_HIDDEN']; } break; diff --git a/upload/ajax/index_data.php b/upload/ajax/index_data.php index 80cfce59d..154a4bd3a 100644 --- a/upload/ajax/index_data.php +++ b/upload/ajax/index_data.php @@ -89,8 +89,38 @@ switch($mode) } break; - default: - $html = ''; + case 'get_traf_stats': + $user_id = (int) $this->request['user_id']; + $btu = get_bt_userdata($user_id); + $bts = get_bt_speed($user_id); + + $speed_up = ($bts['speed_up']) ? humn_size($bts['speed_up']).'/s' : '0 KB/s'; + $speed_down = ($bts['speed_down']) ? humn_size($bts['speed_down']).'/s' : '0 KB/s'; + $user_ratio = ($btu['u_down_total'] > MIN_DL_FOR_RATIO) ? ''. get_bt_ratio($btu) .'' : $lang['IT_WILL_BE_DOWN'] .' '. humn_size(MIN_DL_FOR_RATIO) .''; + + $html = ' + + '. $lang['DOWNLOADED'] .' + '. $lang['UPLOADED'] .' + '. $lang['RELEASED'] .' + '. $lang['BONUS'] .' + + + '. humn_size($btu['u_down_total']) .' + ' .humn_size($btu['u_up_total']) .' + '. humn_size($btu['u_up_release']) .' + '. humn_size($btu['u_up_bonus']) .' + + + '. $lang['DL_DL_SPEED'] .': '. $speed_down .' + '. $lang['DL_UL_SPEED'] .': '. $speed_up .' + + '; + + $this->response['user_ratio'] = ' + '. $lang['USER_RATIO'] .': + '. $user_ratio .' + '; break; } diff --git a/upload/config.php b/upload/config.php index 7ab094a62..d2231401b 100644 --- a/upload/config.php +++ b/upload/config.php @@ -52,8 +52,8 @@ $bb_cfg = $tr_cfg = $page_cfg = array(); // Increase number of revision after update $bb_cfg['tp_version'] = '2.4 (beta)'; -$bb_cfg['tp_release_state'] = 'R377'; -$bb_cfg['tp_release_date'] = '25-02-2012'; +$bb_cfg['tp_release_state'] = 'R378'; +$bb_cfg['tp_release_date'] = '03-03-2012'; // Database $charset = 'utf8'; diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 06ca952de..62a98ab86 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -1206,7 +1206,13 @@ function wbr ($text, $max_word_length = HTML_WBR_LENGTH) function get_bt_userdata ($user_id) { - return DB()->fetch_row("SELECT * FROM ". BB_BT_USERS ." WHERE user_id = ". (int) $user_id ." LIMIT 1"); + return DB()->fetch_row("SELECT * FROM ". BB_BT_USERS ." WHERE user_id = ". (int) $user_id); +} + +function get_bt_speed ($user_id) +{ + return DB()->fetch_row("SELECT SUM(speed_up) as speed_up, SUM(speed_down) as speed_down + FROM ". BB_BT_TRACKER ." WHERE user_id = ". (int) $user_id); } function get_bt_ratio ($btu) @@ -1221,6 +1227,7 @@ function get_bt_ratio ($btu) function show_bt_userdata ($user_id) { $btu = get_bt_userdata($user_id); + $bts = get_bt_speed($user_id); $GLOBALS['template']->assign_vars(array( 'SHOW_BT_USERDATA' => true, @@ -1233,6 +1240,8 @@ function show_bt_userdata ($user_id) 'MIN_DL_FOR_RATIO' => humn_size(MIN_DL_FOR_RATIO), 'MIN_DL_BYTES' => MIN_DL_FOR_RATIO, 'AUTH_KEY' => $btu['auth_key'], + 'SPEED_UP' => ($bts['speed_up']) ? humn_size($bts['speed_up']).'/s' : '0 KB/s', + 'SPEED_DOWN' => ($bts['speed_down']) ? humn_size($bts['speed_down']).'/s' : '0 KB/s', )); } @@ -2721,24 +2730,28 @@ function create_magnet($infohash, $auth_key, $logged_in) return ''; } -function get_avatar ($avatar, $type, $allow_avatar = true, $height = false, $width = false) +function get_avatar ($avatar, $type, $allow_avatar = true, $height = '', $width = '') { global $bb_cfg, $lang; - $user_avatar = ''; + $height = ($height != '') ? 'height="'. $height .'"' : ''; + $width = ($width != '') ? 'width="'. $width .'"' : ''; + + $user_avatar = ''; + if ($allow_avatar) { switch($type) { case USER_AVATAR_UPLOAD: - $user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '' : ''; + $user_avatar = ( $bb_cfg['allow_avatar_upload'] ) ? '' : ''; break; case USER_AVATAR_REMOTE: - $user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '' : ''; + $user_avatar = ( $bb_cfg['allow_avatar_remote'] ) ? '' : ''; break; case USER_AVATAR_GALLERY: - $user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '' : ''; + $user_avatar = ( $bb_cfg['allow_avatar_local'] ) ? '' : ''; break; } } diff --git a/upload/includes/ucp/torrent_userprofile.php b/upload/includes/ucp/torrent_userprofile.php index e983ba872..70b73a1e4 100644 --- a/upload/includes/ucp/torrent_userprofile.php +++ b/upload/includes/ucp/torrent_userprofile.php @@ -31,7 +31,10 @@ else } // Set tpl vars for bt_userdata -show_bt_userdata($profile_user_id); +if (IS_ADMIN || $profile_user_id == $userdata['user_id']) +{ + show_bt_userdata($profile_user_id); +} if (IS_ADMIN) { @@ -157,7 +160,6 @@ $template->assign_vars(array( 'L_SEEDINGS' => ''. $lang['SEEDING'] .''. (($seeding_count) ? "
[ $seeding_count ]" : ''), 'L_LEECHINGS' => ''. $lang['LEECHING'] .''. (($leeching_count) ? "
[ $leeching_count ]" : ''), - 'L_VIEW_TOR_PROF' => sprintf($lang['VIEWING_USER_BT_PROFILE'], $username), 'RELEASED_ROWSPAN' => ($releasing_count) ? 'rowspan="'. ($releasing_count + 1) .'"' : '', 'SEED_ROWSPAN' => ($seeding_count) ? 'rowspan="'. ($seeding_count + 1) .'"' : '', 'LEECH_ROWSPAN' => ($leeching_count) ? 'rowspan="'. ($leeching_count + 1) .'"' : '', @@ -169,18 +171,3 @@ if (!IS_USER || $profile_user_id == $userdata['user_id']) { $page_cfg['dl_links_user_id'] = $profile_user_id; } - -$sql = 'SELECT SUM(speed_up) as speed_up, SUM(speed_down) as speed_down - FROM '. BB_BT_TRACKER .' - WHERE user_id = ' . $profile_user_id . ''; - -if ($row = DB()->fetch_row($sql)) -{ - $speed_up = ($row['speed_up']) ? humn_size($row['speed_up']).'/s' : '-'; - $speed_down = ($row['speed_down']) ? humn_size($row['speed_down']).'/s' : '-'; - - $template->assign_vars(array( - 'SPEED_UP' => $speed_up, - 'SPEED_DOWN' => $speed_down, - )); -} \ No newline at end of file diff --git a/upload/includes/ucp/usercp_register.php b/upload/includes/ucp/usercp_register.php index 29ea1ddfd..eccd55f39 100644 --- a/upload/includes/ucp/usercp_register.php +++ b/upload/includes/ucp/usercp_register.php @@ -910,7 +910,7 @@ if ($submit && !$errors) if($adm_edit) { - bb_die($lang['PROFILE_USER'] . " {$pr_data['username']} " . $lang['GOOD_UPDATE']); + bb_die($lang['PROFILE_USER'] . ' '. profile_url($pr_data) .' '. $lang['GOOD_UPDATE']); } elseif(!$pr_data['user_active']) { diff --git a/upload/includes/ucp/usercp_viewprofile.php b/upload/includes/ucp/usercp_viewprofile.php index de5eea959..50ac9111c 100644 --- a/upload/includes/ucp/usercp_viewprofile.php +++ b/upload/includes/ucp/usercp_viewprofile.php @@ -136,6 +136,7 @@ $template->assign_vars(array( 'SHOW_ROLE' => (IS_AM || $profile_user_id || $profiledata['user_active']), 'GROUP_MEMBERSHIP' => false, + 'TRAF_STATS' => !(IS_ADMIN || $profile_user_id), )); if (IS_ADMIN) diff --git a/upload/language/lang_english/lang_main.php b/upload/language/lang_english/lang_main.php index 77612b413..e69b68ec9 100644 --- a/upload/language/lang_english/lang_main.php +++ b/upload/language/lang_english/lang_main.php @@ -1348,22 +1348,17 @@ $lang['ONLY_1_TOR_PER_TOPIC'] = 'You can register only one torrent in one topic' $lang['VIEWING_USER_BT_PROFILE'] = 'Viewing torrent-profile :: %s'; // %s is username $lang['CUR_ACTIVE_DLS'] = 'Currently active torrents'; -$lang['UP_TOTAL'] = 'Total uploaded'; -$lang['DOWN_TOTAL'] = 'Total downloaded'; -$lang['BONUS'] = 'Bonus'; -$lang['TOTAL_RELEASED'] = 'Total released'; $lang['USER_RATIO'] = 'Ratio'; $lang['MAX_SPEED'] = 'Speed'; -$lang['IT_WILL_BE_DOWN'] = 'it will start to be considered after it will be downloaded'; - -$lang['CURR_PASSKEY'] = 'Current passkey:'; -$lang['SPMODE_FULL'] = 'Show peers in full details'; - $lang['BT_RATIO'] = 'Ratio'; $lang['DOWNLOADED'] = 'Downloaded'; $lang['UPLOADED'] = 'Uploaded'; $lang['RELEASED'] = 'Released'; -$lang['BT_BONUS_UP'] = 'Bonus'; +$lang['BONUS'] = 'Bonus'; +$lang['IT_WILL_BE_DOWN'] = 'it will start to be considered after it will be downloaded'; + +$lang['CURR_PASSKEY'] = 'Current passkey:'; +$lang['SPMODE_FULL'] = 'Show peers in full details'; $lang['TRACKER'] = 'Tracker'; $lang['GALLERY'] = 'Gallery'; @@ -1624,7 +1619,7 @@ $lang['MEMBERSHIP_IN'] = 'Membership in'; $lang['PARTY'] = 'Party:'; $lang['CANDIDATE'] = 'Candidate:'; $lang['INDIVIDUAL'] = 'Has the individual rights'; -$lang['GROUP_HIDDEN'] = 'You are not authorized to view hidden groups'; +$lang['GROUP_LIST_HIDDEN'] = 'You are not authorized to view hidden groups'; $lang['USER_ACTIVATE'] = 'Activate'; $lang['USER_DEACTIVATE'] = 'Deactivate'; diff --git a/upload/language/lang_russian/lang_main.php b/upload/language/lang_russian/lang_main.php index 3a66d96bd..aeda6f839 100644 --- a/upload/language/lang_russian/lang_main.php +++ b/upload/language/lang_russian/lang_main.php @@ -1352,26 +1352,20 @@ $lang['ALREADY_REG'] = 'Торрент уже зарегистрирован'; $lang['NOT_TORRENT'] = 'Это не торрент-файл'; $lang['ONLY_1_TOR_PER_POST'] = 'Вы не можете зарегистрировать еще один торрент для этого сообщения'; $lang['ONLY_1_TOR_PER_TOPIC'] = 'Вы не можете зарегистрировать еще один торрент для этого топика'; -$lang['VIEWING_USER_BT_PROFILE'] = 'Торрент-профиль пользователя %s'; // %s is username +$lang['VIEWING_USER_BT_PROFILE'] = 'Торрент-профиль'; // %s is username $lang['CUR_ACTIVE_DLS'] = 'Текущие активные торренты'; -$lang['UP_TOTAL'] = 'Всего отдано'; -$lang['DOWN_TOTAL'] = 'Всего скачано'; -$lang['BONUS'] = 'Бонус'; -$lang['TOTAL_RELEASED'] = 'Отдано на своих раздачах'; $lang['USER_RATIO'] = 'Рейтинг'; $lang['MAX_SPEED'] = 'Скорость'; +$lang['DOWNLOADED'] = 'Скачано'; +$lang['UPLOADED'] = 'Отдано'; +$lang['RELEASED'] = 'На своих'; +$lang['BONUS'] = 'Бонус'; $lang['IT_WILL_BE_DOWN'] = 'начнет учитываться после того как будет скачано'; $lang['SPMODE_FULL'] = 'Подробная статистика пиров'; $lang['CURR_PASSKEY'] = 'Текущий passkey:'; -$lang['BT_RATIO'] = 'Рейтинг'; -$lang['DOWNLOADED'] = 'Скачано'; -$lang['UPLOADED'] = 'Отдано'; -$lang['RELEASED'] = 'На своих'; -$lang['BT_BONUS_UP'] = 'Бонус'; - $lang['TRACKER'] = 'Трекер'; $lang['GALLERY'] = 'Галерея'; $lang['OPEN_TOPICS'] = 'Открывать топики'; @@ -1629,7 +1623,7 @@ $lang['MEMBERSHIP_IN'] = 'Членство в группах'; $lang['PARTY'] = 'Участник:'; $lang['CANDIDATE'] = 'Кандидат:'; $lang['INDIVIDUAL'] = 'Имеет индивидуальные права'; -$lang['GROUP_HIDDEN'] = 'У Вас нет прав на просмотр скрытых групп'; +$lang['GROUP_LIST_HIDDEN'] = 'У Вас нет прав на просмотр скрытых групп'; $lang['USER_ACTIVATE'] = 'Активировать'; diff --git a/upload/templates/default/css/main.css b/upload/templates/default/css/main.css index 6cb0e72b5..c340a8e96 100644 --- a/upload/templates/default/css/main.css +++ b/upload/templates/default/css/main.css @@ -598,6 +598,11 @@ a.selfMod, a.selfMod:visited { color: #0000FF; } table.mod_ip { background: #F9F9F9; border: 1px solid #A5AFB4; border-collapse: separate;} table.mod_ip td { padding: 2px 5px; white-space: normal; font-size: 11px; } table.mod_ip div { max-height: 150px; overflow: auto;} + +table.ratio { background: #F9F9F9; border: 1px solid #A5AFB4; border-collapse: separate; } +table.ratio th, table.ratio td { padding: 2px 12px; text-align: center; white-space: nowrap; font-size: 11px;} +table.ratio th { color: #000000; white-space: nowrap; } +table.ratio td { padding: 2px 24px; } /* ---------------------------------- * Forums on home page * ---------------------------------- */ diff --git a/upload/templates/default/page_header.tpl b/upload/templates/default/page_header.tpl index a08b3a019..53e16b668 100644 --- a/upload/templates/default/page_header.tpl +++ b/upload/templates/default/page_header.tpl @@ -542,14 +542,14 @@ important_info
-

{L_BT_RATIO}

+

{L_USER_RATIO}

{THIS_AVATAR}
- + - +
{L_BT_RATIO}{USER_RATIO}{L_NONE} (DL < {MIN_DL_FOR_RATIO})
{L_USER_RATIO}{USER_RATIO}{L_NONE} (DL < {MIN_DL_FOR_RATIO})
{L_DOWNLOADED}{DOWN_TOTAL}
{L_UPLOADED}{UP_TOTAL}
{L_RELEASED}{RELEASED}
{L_BT_BONUS_UP}{UP_BONUS}
{L_BONUS}{UP_BONUS}
diff --git a/upload/templates/default/usercp_viewprofile.tpl b/upload/templates/default/usercp_viewprofile.tpl index 384966f56..478599c42 100644 --- a/upload/templates/default/usercp_viewprofile.tpl +++ b/upload/templates/default/usercp_viewprofile.tpl @@ -128,6 +128,34 @@ ajax.callback.group_membership = function(data) { + + + + + + + +

{L_VIEWING_PROFILE}

@@ -277,10 +305,13 @@ ajax.callback.group_membership = function(data) { {LAST_VISIT_TIME} - + {L_LAST_ACTIVITY}: - {LAST_ACTIVITY_TIME} + + {LAST_ACTIVITY_TIME} + [ {L_VIEWING_USER_BT_PROFILE} ] + {L_TOTAL_POSTS}: @@ -293,6 +324,26 @@ ajax.callback.group_membership = function(data) {

+ + style="display: none;"> + {L_USER_RATIO}: + + + {USER_RATIO} + [?] + + {L_NONE} (DL < {MIN_DL_FOR_RATIO}) + + + [ Passkey: {AUTH_KEY} ] + + + + + + ( {L_UP_TOTAL} {UP_TOTAL} + {L_TOTAL_RELEASED} {RELEASED} + {L_BONUS} {UP_BONUS} ) / {L_DOWNLOADED} {DOWN_TOTAL} + + @@ -340,6 +391,30 @@ ajax.callback.group_membership = function(data) { {L_ACCESS_SRV_LOAD}: {IGNORE_SRV_LOAD} + + + + style="display: none;" class="ratio bCenter borderless" cellspacing="1" width="200"> + + + + + + + + + + + + + + + + +
{L_DOWNLOADED}{L_UPLOADED}{L_RELEASED}{L_BONUS}
{DOWN_TOTAL}{UP_TOTAL}{RELEASED}{UP_BONUS}
{L_DL_DL_SPEED}: {SPEED_DOWN}{L_DL_UL_SPEED}: {SPEED_UP}
+ + + @@ -367,82 +442,6 @@ ajax.callback.group_membership = function(data) { - - - - - - -
{L_VIEW_TOR_PROF}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{L_DOWN_TOTAL}: - {DOWN_TOTAL} -
{L_UP_TOTAL}: - {UP_TOTAL} -
{L_TOTAL_RELEASED}: - {RELEASED} -
{L_BONUS}: - {UP_BONUS} -
{L_MAX_SPEED}: - {SPEED_UP} / {SPEED_DOWN} -
{L_USER_RATIO}: - - {USER_RATIO}  - [?] - - {L_IT_WILL_BE_DOWN} {MIN_DL_FOR_RATIO} - -
Passkey:{AUTH_KEY}
- -
{L_CUR_ACTIVE_DLS}