Fixed broken "Disable Board" function (#1529)

* Fixed broken "Disable Board" function

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-07-03 16:20:50 +07:00 committed by GitHub
commit a90653e7e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 15 deletions

View file

@ -6,6 +6,7 @@
**Merged pull requests:**
- Release 2.4.4 🦩 ([belomaxorka](https://github.com/belomaxorka))
- Fixed broken "Disable Board" function [\#1529](https://github.com/torrentpier/torrentpier/pull/1529) ([belomaxorka](https://github.com/belomaxorka))
- Create tech stack docs (techstack.yml and techstack.md) [\#1521](https://github.com/torrentpier/torrentpier/pull/1521), [\#1522](https://github.com/torrentpier/torrentpier/pull/1522) ([belomaxorka](https://github.com/belomaxorka))
- Fixed seed bonus accrual [\#1518](https://github.com/torrentpier/torrentpier/pull/1518) ([belomaxorka](https://github.com/belomaxorka))
- [BETA] Added emojis support 😄😁 [\#1514](https://github.com/torrentpier/torrentpier/pull/1514) ([belomaxorka](https://github.com/belomaxorka))

View file

@ -459,15 +459,11 @@ if (($bb_cfg['board_disable'] || is_file(BB_DISABLED)) && !defined('IN_ADMIN') &
if ($bb_cfg['board_disable']) {
// admin lock
send_no_cache_headers();
if (\TorrentPier\Helpers\CronHelper::isEnabled()) {
bb_die('BOARD_DISABLE', 503);
}
bb_die('BOARD_DISABLE', 503);
} elseif (is_file(BB_DISABLED)) {
// trigger lock
TorrentPier\Helpers\CronHelper::releaseDeadlock();
send_no_cache_headers();
if (\TorrentPier\Helpers\CronHelper::isEnabled()) {
bb_die('BOARD_DISABLE_CRON', 503);
}
bb_die('BOARD_DISABLE_CRON', (\TorrentPier\Helpers\CronHelper::isEnabled() ? 503 : null));
}
}

View file

@ -21,13 +21,13 @@ class Ajax
public array $response = [];
public array $valid_actions = [
// ACTION NAME => [AJAX_AUTH, IN_ADMIN_CP (optional)]
// ACTION NAME => [AJAX_AUTH]
'edit_user_profile' => ['admin'],
'change_user_rank' => ['admin'],
'change_user_opt' => ['admin'],
'manage_user' => ['admin'],
'manage_admin' => ['admin', true],
'sitemap' => ['admin', true],
'manage_admin' => ['admin'],
'sitemap' => ['admin'],
'mod_action' => ['mod'],
'topic_tpl' => ['mod'],
@ -89,12 +89,10 @@ class Ajax
// Exit if board is disabled via ON/OFF trigger or by admin
if ($bb_cfg['board_disable'] || is_file(BB_DISABLED)) {
if (!isset($action_params[1]) || $action_params[1] !== true) {
if ($bb_cfg['board_disable']) {
$this->ajax_die($lang['BOARD_DISABLE']);
} elseif (is_file(BB_DISABLED)) {
$this->ajax_die($lang['BOARD_DISABLE_CRON']);
}
if ($bb_cfg['board_disable']) {
$this->ajax_die($lang['BOARD_DISABLE']);
} elseif (is_file(BB_DISABLED) && $this->action !== 'manage_admin') {
$this->ajax_die($lang['BOARD_DISABLE_CRON']);
}
}