mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Added showing releaser stats in profile (#1568)
* Added showing releaser stats in profile * Update viewprofile.php * Update usercp_viewprofile.tpl * Update CHANGELOG.md * Update viewprofile.php
This commit is contained in:
parent
c215d8fb31
commit
7f746af5d5
5 changed files with 70 additions and 26 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
- Release 2.4.5 🦕 ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added some new HTML meta-tags [\#1562](https://github.com/torrentpier/torrentpier/pull/1562) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added showing releaser stats in profile [\#1568](https://github.com/torrentpier/torrentpier/pull/1568) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Fixed `md5()` deprecated in PHP 8.4 [\#1561](https://github.com/torrentpier/torrentpier/pull/1561) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Increased `USEREMAIL_MAX_LENGTH` [\#1566](https://github.com/torrentpier/torrentpier/pull/1566) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
||||
|
|
|
@ -122,6 +122,37 @@ switch ($mode) {
|
|||
$this->ajax_die($lang['BT_NULL_RATIO_SUCCESS']);
|
||||
break;
|
||||
|
||||
case 'releaser_stats':
|
||||
$user_id = (int)$this->request['user_id'];
|
||||
if (!IS_ADMIN && $user_id != $userdata['user_id']) {
|
||||
$this->ajax_die($lang['NOT_AUTHORISED']);
|
||||
}
|
||||
|
||||
$sql = "
|
||||
SELECT COUNT(tor.poster_id) as total_releases, SUM(tor.size) as total_size, tor.poster_id, SUM(ad.download_count) as download_count
|
||||
FROM " . BB_BT_TORRENTS . " tor
|
||||
LEFT JOIN " . BB_USERS . " u ON(u.user_id = tor.poster_id)
|
||||
LEFT JOIN " . BB_ATTACHMENTS_DESC . " ad ON(ad.attach_id = tor.attach_id)
|
||||
LEFT JOIN " . BB_BT_USERS . " ut ON(ut.user_id = tor.poster_id)
|
||||
WHERE u.user_id = $user_id
|
||||
GROUP BY tor.poster_id
|
||||
ORDER BY SUM(ad.download_count) DESC
|
||||
";
|
||||
|
||||
$total_releases_size = $total_releases = $total_releases_completed = 0;
|
||||
if ($row = DB()->fetch_row($sql)) {
|
||||
$total_releases = $row['total_releases'];
|
||||
$total_releases_size = humn_size($row['total_size']);
|
||||
$total_releases_completed = $row['download_count'];
|
||||
}
|
||||
|
||||
$html = '[
|
||||
' . $lang['RELEASES'] . ': <span class="seed bold">' . $total_releases . '</span> |
|
||||
' . $lang['RELEASER_STAT_SIZE'] . ' <span class="seed bold">' . $total_releases_size . '</span> |
|
||||
' . $lang['DOWNLOADED'] . ': <span class="seed bold">' . declension((int)$total_releases_completed, 'times') . '</span> ]
|
||||
';
|
||||
break;
|
||||
|
||||
case 'get_traf_stats':
|
||||
if (!RATIO_ENABLED) {
|
||||
$this->ajax_die($lang['MODULE_OFF']);
|
||||
|
|
|
@ -75,9 +75,8 @@ if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
|
|||
}
|
||||
|
||||
// Null ratio
|
||||
if ($bb_cfg['ratio_null_enabled']) {
|
||||
$btu = get_bt_userdata($profiledata['user_id']);
|
||||
$template->assign_vars(array('NULLED_RATIO' => (bool)$btu['ratio_nulled']));
|
||||
if ($bb_cfg['ratio_null_enabled'] && $btu = get_bt_userdata($profiledata['user_id'])) {
|
||||
$template->assign_vars(array('NULLED_RATIO' => $btu['ratio_nulled']));
|
||||
}
|
||||
|
||||
// Ban information
|
||||
|
|
|
@ -3069,3 +3069,8 @@ $lang['BT_NULL_RATIO_ALERT'] = "Attention!\n\nAre you sure you want to reset you
|
|||
$lang['BT_NULL_RATIO_AGAIN'] = 'You have already reset your ratio!';
|
||||
$lang['BT_NULL_RATIO_NOT_NEEDED'] = 'You have a good ratio. Reset is possible only with a ratio less than %s';
|
||||
$lang['BT_NULL_RATIO_SUCCESS'] = 'The ratio has been reset successfully!';
|
||||
|
||||
// Releaser stats
|
||||
$lang['RELEASER_STAT_SIZE'] = 'Total size:';
|
||||
$lang['RELEASER_STAT'] = 'Releaser stats:';
|
||||
$lang['RELEASER_STAT_SHOW'] = 'Show stats';
|
||||
|
|
|
@ -130,29 +130,31 @@ ajax.callback.group_membership = function(data) {
|
|||
</script>
|
||||
<!-- ENDIF / IS_AM -->
|
||||
|
||||
<!-- IF #RATIO_ENABLED -->
|
||||
<!-- IF TRAF_STATS || $bb_cfg['ratio_null_enabled'] -->
|
||||
<script type="text/javascript">
|
||||
ajax.index_data = function(mode) {
|
||||
ajax.exec({
|
||||
action : 'index_data',
|
||||
mode : mode,
|
||||
user_id : {PROFILE_USER_ID}
|
||||
});
|
||||
};
|
||||
ajax.callback.index_data = function(data) {
|
||||
if (data.mode === 'null_ratio') {
|
||||
return;
|
||||
}
|
||||
$('#traf-stats-tbl').html(data.html);
|
||||
$('#bt_user_ratio').html(data.user_ratio);
|
||||
$('#traf-stats-span').hide();
|
||||
$('#traf-stats-tbl').show();
|
||||
$('#bt_user_ratio').show();
|
||||
};
|
||||
ajax.index_data = function(mode) {
|
||||
ajax.exec({
|
||||
action: 'index_data',
|
||||
mode: mode,
|
||||
user_id: {PROFILE_USER_ID}
|
||||
});
|
||||
};
|
||||
ajax.callback.index_data = function(data) {
|
||||
switch (data.mode) {
|
||||
case 'null_ratio':
|
||||
break;
|
||||
case 'releaser_stats':
|
||||
$('#releases_profile').html(data.html);
|
||||
break;
|
||||
case 'get_traf_stats':
|
||||
$('#traf-stats-tbl').html(data.html);
|
||||
$('#bt_user_ratio').html(data.user_ratio);
|
||||
$('#traf-stats-span').hide();
|
||||
$('#traf-stats-tbl').show();
|
||||
$('#bt_user_ratio').show();
|
||||
break;
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF SHOW_PASSKEY -->
|
||||
<script type="text/javascript">
|
||||
|
@ -405,9 +407,9 @@ ajax.callback.index_data = function(data) {
|
|||
<b id="passkey" class="med bold"><!-- IF AUTH_KEY -->{AUTH_KEY}<!-- ELSE -->{L_NOSELECT}<!-- ENDIF --></b> | <a href="#" onclick="ajax.exec({ action: 'passkey', mode: 'generate', user_id : {PROFILE_USER_ID} }); return false;">{L_BT_GEN_PASSKEY}</a>
|
||||
</span> ]
|
||||
<!-- ENDIF -->
|
||||
<!-- IF PROFILE_USER || IS_ADMIN --><!-- IF $bb_cfg['ratio_null_enabled'] --><!-- IF not NULLED_RATIO or IS_ADMIN -->
|
||||
<!-- IF SHOW_BT_USERDATA --><!-- IF PROFILE_USER || IS_ADMIN --><!-- IF $bb_cfg['ratio_null_enabled'] --><!-- IF not NULLED_RATIO or IS_ADMIN -->
|
||||
[ <a class="med" href="#" onclick="ajax.index_data('null_ratio'); return false;">{L_BT_NULL_RATIO}</a> ]
|
||||
<!-- ENDIF --><!-- ENDIF --><!-- ENDIF -->
|
||||
<!-- ENDIF --><!-- ENDIF --><!-- ENDIF --><!-- ENDIF -->
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
@ -460,6 +462,12 @@ ajax.callback.index_data = function(data) {
|
|||
<td><b>{AGE}</b></td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF SHOW_BT_USERDATA --><!-- IF PROFILE_USER || IS_ADMIN -->
|
||||
<tr>
|
||||
<th>{L_RELEASER_STAT}</th>
|
||||
<td id="releases_profile">[ <a href="#" class="med" onclick="ajax.index_data('releaser_stats'); return false;">{L_RELEASER_STAT_SHOW}</a> ]</td>
|
||||
</tr>
|
||||
<!-- ENDIF --><!-- ENDIF -->
|
||||
<!-- IF SHOW_BT_USERDATA -->
|
||||
<tr>
|
||||
<td colspan="2" class="pad_4">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue