From d57bf5265aaa8e1df0981100f55b878eb7e4fa6a Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Fri, 22 Dec 2023 16:04:16 +0700 Subject: [PATCH] Minor improvements (#1248) * WIP: Minor improvements * Update Torrent.php * Updated * Updated * Revert "Updated" This reverts commit e98a5dfe9c5f1d931ae9a39a7c36a8f4a584933f. * Revert "Updated" This reverts commit 0b53396c56fbd8c03e8ae8b682f5cb1a32cc05fc. * Update group.php * Update CHANGELOG.md --- CHANGELOG.md | 7 ++++++- group.php | 20 ++++++++++---------- src/Legacy/Torrent.php | 3 +-- styles/templates/default/viewtopic.tpl | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 394ab9757..7ed87dc91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ - search.php parameter sanitizing [\#1213](https://github.com/torrentpier/torrentpier/pull/1213) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka)) - Limit execution time for forum file-listing [\#1211](https://github.com/torrentpier/torrentpier/pull/1211) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka)) - Some reported bugfixes [\#1214](https://github.com/torrentpier/torrentpier/pull/1214) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1215](https://github.com/torrentpier/torrentpier/pull/1215), [\#1217](https://github.com/torrentpier/torrentpier/pull/1217), [\#1219](https://github.com/torrentpier/torrentpier/pull/1219), [\#1220](https://github.com/torrentpier/torrentpier/pull/1220), [\#1224](https://github.com/torrentpier/torrentpier/pull/1224), [\#1228](https://github.com/torrentpier/torrentpier/pull/1228), [\#1229](https://github.com/torrentpier/torrentpier/pull/1229), [\#1230](https://github.com/torrentpier/torrentpier/pull/1230), [\#1234](https://github.com/torrentpier/torrentpier/pull/1234), [\#1236](https://github.com/torrentpier/torrentpier/pull/1236), [\#1243](https://github.com/torrentpier/torrentpier/pull/1243) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1215](https://github.com/torrentpier/torrentpier/pull/1215), [\#1217](https://github.com/torrentpier/torrentpier/pull/1217), [\#1219](https://github.com/torrentpier/torrentpier/pull/1219), [\#1220](https://github.com/torrentpier/torrentpier/pull/1220), [\#1224](https://github.com/torrentpier/torrentpier/pull/1224), [\#1228](https://github.com/torrentpier/torrentpier/pull/1228), [\#1229](https://github.com/torrentpier/torrentpier/pull/1229), [\#1230](https://github.com/torrentpier/torrentpier/pull/1230), [\#1234](https://github.com/torrentpier/torrentpier/pull/1234), [\#1236](https://github.com/torrentpier/torrentpier/pull/1236), [\#1243](https://github.com/torrentpier/torrentpier/pull/1243), [\#1248](https://github.com/torrentpier/torrentpier/pull/1248) ([belomaxorka](https://github.com/belomaxorka)) - Fixed extensions issue [\#1218](https://github.com/torrentpier/torrentpier/pull/1218) ([belomaxorka](https://github.com/belomaxorka)) - Fixed broken sorting in group.php [\#1221](https://github.com/torrentpier/torrentpier/pull/1221) ([belomaxorka](https://github.com/belomaxorka)) - Code re-formatting [\#1225](https://github.com/torrentpier/torrentpier/pull/1225) ([kovalensky](https://github.com/kovalensky)) @@ -27,6 +27,11 @@ - Fixed set auth cookie issue [\#1227](https://github.com/torrentpier/torrentpier/pull/1227) ([belomaxorka](https://github.com/belomaxorka)) - Fixed broken captcha check on login.php [\#1233](https://github.com/torrentpier/torrentpier/pull/1233) ([belomaxorka](https://github.com/belomaxorka)) - Hide vote button in poll if user already voted [\#1235](https://github.com/torrentpier/torrentpier/pull/1235) ([belomaxorka](https://github.com/belomaxorka)) +- Exception handling for Bencode errors [\#1237](https://github.com/torrentpier/torrentpier/pull/1237), [\#1239](https://github.com/torrentpier/torrentpier/pull/1239) ([kovalensky](https://github.com/kovalensky)) +- Handle & show upload_max_filesize occurrences [\#1241](https://github.com/torrentpier/torrentpier/pull/1241) ([kovalensky](https://github.com/kovalensky)) +- Little improvements [\#1244](https://github.com/torrentpier/torrentpier/pull/1244) ([kovalensky](https://github.com/kovalensky)) +- Improved handling errors while uploading [\#1246](https://github.com/torrentpier/torrentpier/pull/1246) +- Use hardcoded dictionary names for better counting result in file listing [\#1247](https://github.com/torrentpier/torrentpier/pull/1247) ([kovalensky](https://github.com/kovalensky)) - New Crowdin updates [\#1203](https://github.com/torrentpier/torrentpier/pull/1203), [\#1222](https://github.com/torrentpier/torrentpier/pull/1222) ([Exileum](https://github.com/Exileum)) ## [v2.4.0-rc2](https://github.com/torrentpier/torrentpier/tree/v2.4.0-rc2) (2023-12-12) diff --git a/group.php b/group.php index 0b647e7e3..82c824d15 100644 --- a/group.php +++ b/group.php @@ -162,7 +162,7 @@ if (!$group_id) { bb_die($lang['NO_GROUPS_EXIST']); } if ($row['user_id']) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['ALREADY_MEMBER_GROUP']); } @@ -185,12 +185,12 @@ if (!$group_id) { $emailer->send(); } - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['GROUP_JOINED']); } elseif (!empty($_POST['unsub']) || !empty($_POST['unsubpending'])) { \TorrentPier\Legacy\Group::delete_user_group($group_id, $userdata['user_id']); - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['UNSUB_SUCCESS']); } else { // Handle Additions, removals, approvals and denials @@ -198,26 +198,26 @@ if (!$group_id) { if (!empty($_POST['add']) || !empty($_POST['remove']) || !empty($_POST['approve']) || !empty($_POST['deny'])) { if (!$is_moderator) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['NOT_GROUP_MODERATOR']); } if (!empty($_POST['add'])) { if (isset($_POST['username']) && !($row = get_userdata($_POST['username'], true))) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['COULD_NOT_ADD_USER']); } // Prevent adding moderator if ($row['user_id'] == $group_moderator) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die(sprintf($lang['USER_IS_MOD_GROUP'], profile_url($row))); } // Prevent infinity user adding into group if ($is_member = DB()->fetch_row("SELECT user_id FROM " . BB_USER_GROUP . " WHERE group_id = $group_id AND user_id = " . $row['user_id'] . " LIMIT 1")) { if ($is_member['user_id']) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die(sprintf($lang['USER_IS_MEMBER_GROUP'], profile_url($row))); } } @@ -248,7 +248,7 @@ if (!$group_id) { $sql_in[] = (int)$members_id; } if (!$sql_in = implode(',', $sql_in)) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['NONE_SELECTED']); } @@ -418,7 +418,7 @@ if (!$group_id) { // TODO Correct SQL to posts with attach and limit them, optimization if (!$group_info['release_group']) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['NOT_A_RELEASE_GROUP']); } @@ -449,7 +449,7 @@ if (!$group_id) { "; if (!$releases = DB()->fetch_rowset($sql)) { - set_die_append_msg(false, false, $group_id); + set_die_append_msg(group_id: $group_id); bb_die($lang['NO_SEARCH_MATCH']); } diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php index e4aa10bd8..48ca026d9 100644 --- a/src/Legacy/Torrent.php +++ b/src/Legacy/Torrent.php @@ -474,8 +474,7 @@ class Torrent if ($reg_mode == 'request' || $reg_mode == 'newtopic') { set_die_append_msg($forum_id, $topic_id); - $mess = sprintf($lang['BT_REGISTERED'], DL_URL . $attach_id); - bb_die($mess); + bb_die(sprintf($lang['BT_REGISTERED'], DL_URL . $attach_id)); } return true; diff --git a/styles/templates/default/viewtopic.tpl b/styles/templates/default/viewtopic.tpl index 406a9eea5..02848ba3f 100644 --- a/styles/templates/default/viewtopic.tpl +++ b/styles/templates/default/viewtopic.tpl @@ -634,7 +634,7 @@ function build_poll_add_form (src_el)
- Admin:  + {L_ADMIN}:  {L_LOGS}