Generate jumpbox files only if enabled (#764)

This commit is contained in:
Roman Kelesidis 2023-06-04 10:21:27 +07:00 committed by GitHub
commit ce9c3d9b47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions

View file

@ -106,15 +106,17 @@ $this->store('cat_forums', $data);
// //
// jumpbox // jumpbox
// //
$data = array( if ($bb_cfg['show_jumpbox']) {
'guest' => get_forum_select('guest', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'), $data = array(
'user' => get_forum_select('user', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'), 'guest' => get_forum_select('guest', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'),
); 'user' => get_forum_select('user', 'f', null, null, null, 'id="jumpbox" onchange="window.location.href=\'viewforum.php?f=\'+this.value;"'),
);
$this->store('jumpbox', $data); $this->store('jumpbox', $data);
file_write($data['guest'], AJAX_HTML_DIR . '/jumpbox_guest.html', false, true, true); file_write($data['guest'], AJAX_HTML_DIR . '/jumpbox_guest.html', false, true, true);
file_write($data['user'], AJAX_HTML_DIR . '/jumpbox_user.html', false, true, true); file_write($data['user'], AJAX_HTML_DIR . '/jumpbox_user.html', false, true, true);
}
// //
// viewtopic_forum_select // viewtopic_forum_select

View file

@ -1000,7 +1000,11 @@ function get_userdata($u, $force_name = false, $allow_guest = false)
function make_jumpbox($selected = 0) function make_jumpbox($selected = 0)
{ {
global $datastore, $template; global $datastore, $template, $bb_cfg;
if (!$bb_cfg['show_jumpbox']) {
return;
}
if (!$jumpbox = $datastore->get('jumpbox')) { if (!$jumpbox = $datastore->get('jumpbox')) {
$datastore->update('jumpbox'); $datastore->update('jumpbox');