function ForumJump() { global $fid, $loguserid, $loguser, $forum; $viewableforums = ForumsWithPermission('forum.viewforum'); $viewhidden = HasPermission('user.viewhiddenforums'); $rCats = Query("SELECT id, name FROM {categories} WHERE board={0} ORDER BY corder, id", $forum['board']); $cats = array(); while ($cat = Fetch($rCats)) { $cats[$cat['id']] = $cat['name']; } $rFora = Query("\tSELECT\n\t\t\t\t\t\t\tf.id, f.title, f.catid, f.redirect\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{forums} f\n\t\t\t\t\t\tWHERE f.id IN ({0c})" . (!$viewhidden ? " AND f.hidden=0" : '') . "\n\t\t\t\t\t\tORDER BY f.forder, f.id", $viewableforums); $fora = array(); while ($forum = Fetch($rFora)) { $fora[$forum['catid']][] = $forum; } $theList = ''; foreach ($cats as $cid => $cname) { if (empty($fora[$cid])) { continue; } $theList .= ' <optgroup label="' . htmlspecialchars($cname) . '"> ' . fj_forumBlock($fora, $cid, $fid, 0) . ' </optgroup> '; } $theList = '<select onchange="document.location=this.options[this.selectedIndex].value;">' . ($forum['board'] ? '<option value="' . actionLink('board') . '">Back to main forums</option>' : '') . $theList . '</select>'; RenderTemplate('forumjump', array('forumlist' => $theList)); }
function ForumJump() { global $fid, $loguserid, $loguser; $pl = $loguser['powerlevel']; if ($pl < 0) { $pl = 0; } $rCats = Query("SELECT id, name FROM {categories} WHERE 1 ORDER BY corder, id"); $cats = array(); while ($cat = Fetch($rCats)) { $cats[$cat['id']] = $cat['name']; } $rFora = Query("\tSELECT\n\t\t\t\t\t\t\tf.id, f.title, f.catid\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t{forums} f\n\t\t\t\t\t\tWHERE " . forumAccessControlSQL() . ($pl < 1 ? " AND f.hidden=0" : '') . "\n\t\t\t\t\t\tORDER BY f.forder, f.id"); $fora = array(); while ($forum = Fetch($rFora)) { $fora[$forum['catid']][] = $forum; } $theList = ''; foreach ($cats as $cid => $cname) { if (empty($fora[$cid])) { continue; } $theList .= ' <optgroup label="' . htmlspecialchars($cname) . '"> ' . fj_forumBlock($fora, $cid, $fid, 0) . ' </optgroup> '; } echo "\n\t<label>\n\t\t" . __("Forum Jump:") . "\n\t\t<select onchange=\"document.location=this.options[this.selectedIndex].value;\">\n\t\t\t{1}\n\t\t\t{$theList}\n\t\t\t</optgroup>\n\t\t</select>\n\t</label>"; }