Minor improvements (#960)

* Minor improvements

* Update admin_extensions.php

* Update Ajax.php
This commit is contained in:
Roman Kelesidis 2023-10-06 18:43:56 +07:00 committed by GitHub
commit 8f4d00c1cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -569,7 +569,7 @@ if ($e_mode == 'perm' && $group) {
$forum_p = []; $forum_p = [];
$act_id = 0; $act_id = 0;
$forum_p = auth_unpack($allowed_forums); $forum_p = auth_unpack($allowed_forums);
$sql = 'SELECT forum_id, forum_name, forum_parent FROM ' . BB_FORUMS . ' WHERE forum_id IN (' . implode(', ', $forum_p) . ') ORDER BY forum_order'; $sql = 'SELECT forum_id, forum_name FROM ' . BB_FORUMS . ' WHERE forum_id IN (' . implode(', ', $forum_p) . ')';
if (!($result = DB()->sql_query($sql))) { if (!($result = DB()->sql_query($sql))) {
bb_die('Could not get forum names'); bb_die('Could not get forum names');
} }
@ -577,16 +577,15 @@ if ($e_mode == 'perm' && $group) {
while ($row = DB()->sql_fetchrow($result)) { while ($row = DB()->sql_fetchrow($result)) {
$forum_perm[$act_id]['forum_id'] = $row['forum_id']; $forum_perm[$act_id]['forum_id'] = $row['forum_id'];
$forum_perm[$act_id]['forum_name'] = $row['forum_name']; $forum_perm[$act_id]['forum_name'] = $row['forum_name'];
$forum_perm[$act_id]['forum_parent'] = $row['forum_parent'];
$act_id++; $act_id++;
} }
} }
for ($i = 0, $iMax = count($forum_perm); $i < $iMax; $i++) { for ($i = 0, $iMax = count($forum_perm); $i < $iMax; $i++) {
$template->assign_block_vars('allow_option_values', [ $template->assign_block_vars('allow_option_values', array(
'VALUE' => $forum_perm[$i]['forum_id'], 'VALUE' => $forum_perm[$i]['forum_id'],
'OPTION' => (($forum_perm[$i]['forum_parent']) ? HTML_SF_SPACER : '') . htmlCHR($forum_perm[$i]['forum_name']) 'OPTION' => htmlCHR($forum_perm[$i]['forum_name']))
]); );
} }
$template->assign_vars(array( $template->assign_vars(array(
@ -595,24 +594,24 @@ if ($e_mode == 'perm' && $group) {
'A_PERM_ACTION' => "admin_extensions.php?mode=groups&amp;e_mode=perm&amp;e_group=$group", 'A_PERM_ACTION' => "admin_extensions.php?mode=groups&amp;e_mode=perm&amp;e_group=$group",
)); ));
$forum_option_values = array(0 => array('parent' => 0, 'name' => $lang['PERM_ALL_FORUMS'])); $forum_option_values = array(0 => $lang['PERM_ALL_FORUMS']);
$sql = 'SELECT forum_id, forum_name, forum_parent FROM ' . BB_FORUMS . ' ORDER BY forum_order'; $sql = 'SELECT forum_id, forum_name FROM ' . BB_FORUMS;
if (!($result = DB()->sql_query($sql))) { if (!($result = DB()->sql_query($sql))) {
bb_die('Could not get forums #1'); bb_die('Could not get forums #1');
} }
while ($row = DB()->sql_fetchrow($result)) { while ($row = DB()->sql_fetchrow($result)) {
$forum_option_values[(int)$row['forum_id']] = array('parent' => $row['forum_parent'], 'name' => $row['forum_name']); $forum_option_values[(int)$row['forum_id']] = $row['forum_name'];
} }
DB()->sql_freeresult($result); DB()->sql_freeresult($result);
foreach ($forum_option_values as $value => $option) { foreach ($forum_option_values as $value => $option) {
$template->assign_block_vars('forum_option_values', [ $template->assign_block_vars('forum_option_values', array(
'VALUE' => $value, 'VALUE' => $value,
'OPTION' => (($option['parent']) ? HTML_SF_SPACER : '') . htmlCHR($option['name']) 'OPTION' => htmlCHR($option))
]); );
} }
$empty_perm_forums = []; $empty_perm_forums = [];