diff --git a/CHANGELOG.md b/CHANGELOG.md index 8381d64c6..42c621098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Used `humn_size()` to count average of releases in tr_stats.php [\#1313](https://github.com/torrentpier/torrentpier/pull/1313) ([belomaxorka](https://github.com/belomaxorka)) - Some enhancements in default template [\#1312](https://github.com/torrentpier/torrentpier/pull/1312) ([belomaxorka](https://github.com/belomaxorka)) - Set response code in some cases [\#1319](https://github.com/torrentpier/torrentpier/pull/1319) ([belomaxorka](https://github.com/belomaxorka)) +- Fixed auth(): empty $f_access [\#1329](https://github.com/torrentpier/torrentpier/pull/1329) ([belomaxorka](https://github.com/belomaxorka)) - Fixed HTTP 500 while cron running in server-side [\#1321](https://github.com/torrentpier/torrentpier/pull/1321) ([belomaxorka](https://github.com/belomaxorka)) - Sending debug errors to us 🌚 via Telegram bot [\#1323](https://github.com/torrentpier/torrentpier/pull/1323) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1306](https://github.com/torrentpier/torrentpier/pull/1306), [\#1307](https://github.com/torrentpier/torrentpier/pull/1307), [\#1308](https://github.com/torrentpier/torrentpier/pull/1308), [\#1315](https://github.com/torrentpier/torrentpier/pull/1315), [\#1328](https://github.com/torrentpier/torrentpier/pull/1328) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/admin/admin_user_search.php b/admin/admin_user_search.php index cd243869b..7bd2b1ec8 100644 --- a/admin/admin_user_search.php +++ b/admin/admin_user_search.php @@ -64,13 +64,12 @@ if (!isset($_REQUEST['dosearch'])) { } $forums = []; + $last_cat_id = -1; + $forums_list = ''; if (DB()->num_rows($result) != 0) { $template->assign_block_vars('forums_exist', []); - $last_cat_id = -1; - $forums_list = ''; - while ($row = DB()->sql_fetchrow($result)) { if ($row['cat_id'] != $last_cat_id) { $forums_list .= ''; diff --git a/library/includes/functions.php b/library/includes/functions.php index 19ce6f4ef..8de7c2e99 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -270,6 +270,9 @@ function auth($type, $forum_id, $ug_data, array $f_access = [], $group_perm = UG $add_auth_type_desc = ($forum_id != AUTH_LIST_ALL); // Check forum existence + if (!forum_exists()) { + return []; + } if ($add_auth_type_desc && !forum_exists($forum_id)) { return []; } @@ -1829,8 +1832,12 @@ function get_topic_title($topic_id) return $row['topic_title']; } -function forum_exists($forum_id): bool +function forum_exists($forum_id = null): bool { + if (!isset($forum_id)) { + return (bool)DB()->fetch_row("SELECT * FROM " . BB_FORUMS . " LIMIT 1"); + } + return (bool)DB()->fetch_row("SELECT forum_id FROM " . BB_FORUMS . " WHERE forum_id = $forum_id LIMIT 1"); } diff --git a/src/Legacy/Torrent.php b/src/Legacy/Torrent.php index 48ca026d9..a7f3a0c75 100644 --- a/src/Legacy/Torrent.php +++ b/src/Legacy/Torrent.php @@ -843,7 +843,7 @@ class Torrent * @param int|string $user_id * @return bool|string */ - public static function getPasskey($user_id) + public static function getPasskey(int|string $user_id): bool|string { if ($passkey = DB()->fetch_row("SELECT auth_key FROM " . BB_BT_USERS . " WHERE user_id = " . (int)$user_id . " LIMIT 1")) { return $passkey['auth_key']; diff --git a/styles/templates/default/usercp_viewprofile.tpl b/styles/templates/default/usercp_viewprofile.tpl index df5a72107..333d3fb51 100644 --- a/styles/templates/default/usercp_viewprofile.tpl +++ b/styles/templates/default/usercp_viewprofile.tpl @@ -398,7 +398,7 @@ ajax.callback.index_data = function(data) { [ {L_BT_PASSKEY}: {L_BT_PASSKEY_VIEW} ]