Some bugfixes (#1326)

* Some bugfixes

* Update CHANGELOG.md

* Update functions_admin.php
This commit is contained in:
Roman Kelesidis 2024-01-19 00:33:29 +07:00 committed by GitHub
commit a46c40e106
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 33 deletions

View file

@ -14,6 +14,7 @@
- Fixed HTTP 500 while cron running in server-side [\#1321](https://github.com/torrentpier/torrentpier/pull/1321) ([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)) - 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) ([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) ([belomaxorka](https://github.com/belomaxorka))
- Some bugfixes [\#1326](https://github.com/torrentpier/torrentpier/pull/1326) ([belomaxorka](https://github.com/belomaxorka))
- Updated deps [\#1304](https://github.com/torrentpier/torrentpier/pull/1304), [\#1305](https://github.com/torrentpier/torrentpier/pull/1305) ([belomaxorka](https://github.com/belomaxorka)) - Updated deps [\#1304](https://github.com/torrentpier/torrentpier/pull/1304), [\#1305](https://github.com/torrentpier/torrentpier/pull/1305) ([belomaxorka](https://github.com/belomaxorka))
## [v2.4.0](https://github.com/torrentpier/torrentpier/tree/v2.4.0) (2024-01-01) ## [v2.4.0](https://github.com/torrentpier/torrentpier/tree/v2.4.0) (2024-01-01)

View file

@ -245,25 +245,3 @@ function search_attachments($order_by, &$total_rows)
return $attachments; return $attachments;
} }
/**
* Perform limit statement on arrays
*
* @param $array
* @param $start
* @param $pagelimit
* @return array
*/
function limit_array($array, $start, $pagelimit)
{
// array from start - start+pagelimit
$limit = (count($array) < ($start + $pagelimit)) ? count($array) : $start + $pagelimit;
$limit_array = [];
for ($i = $start; $i < $limit; $i++) {
$limit_array[] = $array[$i];
}
return $limit_array;
}

View file

@ -269,6 +269,11 @@ function auth($type, $forum_id, $ug_data, array $f_access = [], $group_perm = UG
$auth = $auth_fields = $u_access = []; $auth = $auth_fields = $u_access = [];
$add_auth_type_desc = ($forum_id != AUTH_LIST_ALL); $add_auth_type_desc = ($forum_id != AUTH_LIST_ALL);
// Check forum existence
if ($add_auth_type_desc && !forum_exists($forum_id)) {
return [];
}
// //
// Get $auth_fields // Get $auth_fields
// //
@ -304,7 +309,7 @@ function auth($type, $forum_id, $ug_data, array $f_access = [], $group_perm = UG
} }
if (empty($f_access)) { if (empty($f_access)) {
return []; trigger_error(__FUNCTION__ . '(): empty $f_access', E_USER_ERROR);
} }
// //

View file

@ -727,9 +727,9 @@ class User
* @param $auth_type * @param $auth_type
* @param string $return_as * @param string $return_as
* *
* @return array|bool|string * @return array|string
*/ */
public function get_excluded_forums($auth_type, $return_as = 'csv') public function get_excluded_forums($auth_type, string $return_as = 'csv')
{ {
$excluded = []; $excluded = [];
@ -754,14 +754,13 @@ class User
} }
} }
switch ($return_as) { return match ($return_as) {
case 'csv': 'csv' => implode(',', $excluded),
return implode(',', $excluded); 'flip_csv' => implode(',', array_flip($excluded)),
case 'array': 'array' => $excluded,
return $excluded; 'flip' => array_flip($excluded),
case 'flip': default => [],
return array_flip(explode(',', $excluded)); };
}
} }
/** /**