mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 05:43:55 -07:00
Fixed auth(): empty $f_access (#1329)
* Fixed auth(): empty $f_access * Update functions.php * Update CHANGELOG.md * Updated * Update functions.php * Update functions.php
This commit is contained in:
parent
7ee71887f2
commit
3b4fe8008b
5 changed files with 13 additions and 6 deletions
|
@ -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))
|
||||
|
|
|
@ -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 .= '<optgroup label="' . htmlCHR($row['cat_title']) . '">';
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -398,7 +398,7 @@ ajax.callback.index_data = function(data) {
|
|||
<!-- IF SHOW_PASSKEY -->
|
||||
[ {L_BT_PASSKEY}: <span id="passkey-btn"><a class="med" href="#" onclick="$('#passkey-gen').show(); $('#passkey-btn').hide(); return false;">{L_BT_PASSKEY_VIEW}</a></span>
|
||||
<span id="passkey-gen" class="med" style="display: none;">
|
||||
<b id="passkey" class="med bold">{AUTH_KEY}</b> | <a href="#" onclick="ajax.exec({ action: 'passkey', mode: 'generate', user_id : {PROFILE_USER_ID} }); return false;">{L_BT_GEN_PASSKEY}</a>
|
||||
<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 -->
|
||||
</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue