/** * Build a list of forums for RSS multiselect. * * @param int Parent forum ID. * @param unknown_type deprecated * @param boolean Whether to add selected attribute or not. * @param string HTML for the depth of the forum. * @return string HTML of the list of forums for CSS. */ function makesyndicateforums($pid = "0", $selitem = "", $addselect = "1", $depth = "") { global $db, $forumcache, $permissioncache, $mybb, $forumlist, $forumlistbits, $flist, $lang, $unexp, $templates; $pid = (int) $pid; $forumlist = ''; if (!is_array($forumcache)) { // Get Forums $query = $db->simple_select("forums", "*", "linkto = '' AND active!=0", array('order_by' => 'pid, disporder')); while ($forum = $db->fetch_array($query)) { $forumcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; } } if (!is_array($permissioncache)) { $permissioncache = forum_permissions(); } if (is_array($forumcache[$pid])) { foreach ($forumcache[$pid] as $key => $main) { foreach ($main as $key => $forum) { $perms = $permissioncache[$forum['fid']]; if ($perms['canview'] == 1 || $mybb->settings['hideprivateforums'] == 0) { $optionselected = ''; if (isset($flist[$forum['fid']])) { $optionselected = 'selected="selected"'; $selecteddone = "1"; } if ($forum['password'] == '' && !in_array($forum['fid'], $unexp) || $forum['password'] && isset($mybb->cookies['forumpass'][$forum['fid']]) && $mybb->cookies['forumpass'][$forum['fid']] === md5($mybb->user['uid'] . $forum['password'])) { $forumlistbits .= "<option value=\"{$forum['fid']}\" {$optionselected}>{$depth} {$forum['name']}</option>\n"; } if (!empty($forumcache[$forum['fid']])) { $newdepth = $depth . " "; $forumlistbits .= makesyndicateforums($forum['fid'], '', 0, $newdepth); } } } } } if ($addselect) { $addsel = ''; if (empty($selecteddone)) { $addsel = ' selected="selected"'; } eval("\$forumlist = \"" . $templates->get("misc_syndication_forumlist") . "\";"); } return $forumlist; }
function makesyndicateforums($pid = "0", $selitem = "", $addselect = "1", $depth = "", $permissions = "") { global $db, $forumcache, $permissioncache, $mybb, $selecteddone, $forumlist, $forumlistbits, $theme, $templates, $flist, $lang, $unviewable; static $unviewableforums; $pid = intval($pid); if (!$permissions) { $permissions = $mybb->usergroup; } if (!is_array($forumcache)) { // Get Forums $query = $db->simple_select("forums", "*", "linkto = '' AND active!=0", array('order_by' => 'pid, disporder')); while ($forum = $db->fetch_array($query)) { $forumcache[$forum['pid']][$forum['disporder']][$forum['fid']] = $forum; } } if (!is_array($permissioncache)) { $permissioncache = forum_permissions(); } if (!$unviewableforums) { // Save our unviewable forums in an array $unviewableforums = explode(",", str_replace("'", "", $unviewable)); } if (is_array($forumcache[$pid])) { foreach ($forumcache[$pid] as $key => $main) { foreach ($main as $key => $forum) { $perms = $permissioncache[$forum['fid']]; if ($perms['canview'] == 1 || $mybb->settings['hideprivateforums'] == 0) { if ($flist[$forum['fid']]) { $optionselected = "selected=\"selected\""; $selecteddone = "1"; } else { $optionselected = ''; } if ($forum['password'] == '' && !in_array($forum['fid'], $unviewableforums) || $forum['password'] && $mybb->cookies['forumpass'][$forum['fid']] == md5($mybb->user['uid'] . $forum['password'])) { $forumlistbits .= "<option value=\"{$forum['fid']}\" {$optionselected}>{$depth} {$forum['name']}</option>\n"; } if ($forumcache[$forum['fid']]) { $newdepth = $depth . " "; $forumlistbits .= makesyndicateforums($forum['fid'], $selitem, 0, $newdepth, $perms); } } } } } if ($addselect) { if (!$selecteddone) { $addsel = " selected=\"selected\""; } $forumlist = "<select name=\"forums[]\" size=\"10\" multiple=\"multiple\">\n<option value=\"all\" {$addsel}>{$lang->syndicate_all_forums}</option>\n<option value=\"all\">----------------------</option>\n{$forumlistbits}\n</select>"; } return $forumlist; }