From c25a6f1dde40f60bdf15d7d2044e7078874c3bc5 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 4 Aug 2024 22:55:28 +0700 Subject: [PATCH] Minor improvements (#1570) * Minor improvements * Update index_data.php * Updated * Updated * Update CHANGELOG.md * Update common.php * Updated * Revert "Updated" This reverts commit f5227b40834081bd3b5331563b59f8537329d2bb. * Revert "Updated" This reverts commit 911ac4ac292270d805ecae11e07c79ebf25c95b4. * Revert "Updated" This reverts commit 3e19c1a973e7742028c949c0b501b311ec7bc19d. * Update CHANGELOG.md --- CHANGELOG.md | 2 ++ common.php | 2 +- library/ajax/index_data.php | 23 ++++++++----------- .../templates/default/usercp_viewprofile.tpl | 4 ++-- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4f6d92ec..74170a602 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - 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)) +- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570) ([belomaxorka](https://github.com/belomaxorka)) +- New Crowdin updates [\#1569](https://github.com/torrentpier/torrentpier/pull/1569) ([Exileum](https://github.com/Exileum)) ## [v2.4.4](https://github.com/torrentpier/torrentpier/tree/v2.4.4) (2024-07-22) [Full Changelog](https://github.com/torrentpier/torrentpier/compare/v2.4.3...v2.4.4) diff --git a/common.php b/common.php index 0a105fbe6..dfc54f43d 100644 --- a/common.php +++ b/common.php @@ -172,7 +172,7 @@ function utime() return array_sum(explode(' ', microtime())); } -function bb_log($msg, $file_name = 'logs.log', $return_path = false) +function bb_log($msg, $file_name = 'logs', $return_path = false) { if (is_array($msg)) { $msg = implode(LOG_LF, $msg); diff --git a/library/ajax/index_data.php b/library/ajax/index_data.php index f09ea9cc9..ab1e9397b 100644 --- a/library/ajax/index_data.php +++ b/library/ajax/index_data.php @@ -124,33 +124,30 @@ switch ($mode) { 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) + SELECT COUNT(tor.poster_id) as total_releases, SUM(tor.size) as total_size, SUM(tor.complete_count) as total_complete, SUM(ad.download_count) as total_dl_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 + LIMIT 1 "; - $total_releases_size = $total_releases = $total_releases_completed = 0; + $total_releases_size = $total_releases = $total_releases_completed = $total_releases_downloaded = 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']; + $total_releases_downloaded = $row['total_dl_count']; + $total_releases_completed = $row['total_complete']; } $html = '[ ' . $lang['RELEASES'] . ': ' . $total_releases . ' | ' . $lang['RELEASER_STAT_SIZE'] . ' ' . $total_releases_size . ' | - ' . $lang['DOWNLOADED'] . ': ' . declension((int)$total_releases_completed, 'times') . ' ] - '; + ' . $lang['DOWNLOADED'] . ': ' . declension((int)$total_releases_downloaded, 'times') . ' ]'; break; case 'get_traf_stats': diff --git a/styles/templates/default/usercp_viewprofile.tpl b/styles/templates/default/usercp_viewprofile.tpl index 5ee0cf144..2c00e3da9 100644 --- a/styles/templates/default/usercp_viewprofile.tpl +++ b/styles/templates/default/usercp_viewprofile.tpl @@ -462,12 +462,12 @@ ajax.callback.group_membership = function(data) { {AGE} - + {L_RELEASER_STAT} [ {L_RELEASER_STAT_SHOW} ] - +