[mw_shl_code=php,true]foreach($forumcache as $forum) {
if(!$forum['status'] && !$showhide) {
continue;
}
if($selectedfid) {
if(!is_array($selectedfid)) {
$selected = $selectedfid == $forum['fid'] ? ' selected' : '';
} else {
$selected = in_array($forum['fid'], $selectedfid) ? ' selected' : '';
}
}
if($forum['type'] == 'group') {
if($arrayformat) {
$forumlist[$forum['fid']]['name'] = $forum['name'];
} else {
$forumlist .= $groupselectable ? '<option value="'.($evalue ? 'gid_' : '').$forum['fid'].'" class="bold">--'.$forum['name'].'</option>' : '</optgroup><optgroup label="--'.$forum['name'].'">';
}
$visible[$forum['fid']] = true;
} elseif($forum['type'] == 'forum' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t$_G[uid]\t")) && (!$special || (substr($forum['allowpostspecial'], -$special, 1)))) {
if($arrayformat) {
$forumlist[$forum['fup']]['sub'][$forum['fid']] = $forum['name'];
} else {
$forumlist .= '<option value="'.($evalue ? 'fid_' : '').$forum['fid'].'"'.$selected.'>'.$forum['name'].'</option>';
}
$visible[$forum['fid']] = true;
} elseif(!$arrayformat && $forum['type'] == 'sub' && isset($visible[$forum['fup']]) && (!$forum['viewperm'] || ($forum['viewperm'] && forumperm($forum['viewperm'])) || strstr($forum['users'], "\t$_G[uid]\t")) && (!$special || substr($forum['allowpostspecial'], -$special, 1))) {
$forumlist .= '<option value="'.($evalue ? 'fid_' : '').$forum['fid'].'"'.$selected.'> '.$forum['name'].'</option>';
}
}[/mw_shl_code]