simple_select('forums','fid,pid'); while($row=$db->fetch_array($query))$parents[(int)$row['fid']]=(int)$row['pid']; $manage=''; foreach($identity['systemBoards']['organisations'] ?? [] as $grant){ $board=$boards[($grant['kind'] ?? '').':'.($grant['id'] ?? '')] ?? null; if(!$board||($grant['manage'] ?? false)!==true||!dune_board_descendant($fid,(int)$board['fid'],$parents))continue; $href='/system-board-manage.php?kind='.rawurlencode($grant['kind']).'&organisation='.rawurlencode($grant['id']).'&dune_embed=1'; $manage='Manage board'; } $page=preg_replace_callback('/]*)>/i',function($match){$attributes=$match[1];if(str_contains($attributes,'class="'))$attributes=str_replace('class="','class="dune-board-embedded ',$attributes);else $attributes.=' class="dune-board-embedded"';return '';},$page,1); $path=parse_url($_SERVER['REQUEST_URI'] ?? '/index.php',PHP_URL_PATH);if(!in_array($path,['/forumdisplay.php','/showthread.php'],true))$path='/index.php'; $params=$_GET;unset($params['dune_embed']);$outside='https://forums.dunerealms.com'.$path.($params?'?'.http_build_query($params):''); $toolbar='
Internal BoardsPrivate conversations · Your organisation
'; if(!str_contains($page,'data-system-board-toolbar'))$page=preg_replace('/(]*>)/i','$1'.$toolbar,$page,1); $style = ''; $script = <<<'JS' JS; $page = str_replace('', $style.'', $page); $page = str_replace('', $script.'', $page); } // Initialize once, then let MyBB's existing category expander and cookie keep // the user's preference. No second collapse implementation or local storage. function dune_system_board_default_collapse(): void { global $mybb,$db,$collapse,$collapsed,$collapsedimg,$collapsedthead; if(!empty($mybb->cookies['dune_system_board_default'])||!$db->table_exists('dune_system_boards'))return; $root=$db->fetch_array($db->simple_select('dune_system_boards','fid',"kind='system' AND organisation_id='root'")); if(empty($root['fid']))return;$key='cat_'.(int)$root['fid']; $collapse=array_values(array_unique(array_merge($collapse??[],[$key]))); $collapsed[$key.'_e']='display: none;';$collapsedimg[$key]='_collapsed';$collapsedthead[$key]=' thead_collapsed'; my_setcookie('collapsed',implode('|',$collapse));my_setcookie('dune_system_board_default','1'); }