function construct_faq_jump($parent = 0, $depth = 0) { global $ifaqcache, $faqcache, $faqjumpbits, $faqparent, $vbphrase, $vbulletin; if (!is_array($ifaqcache["{$parent}"])) { return; } foreach ($ifaqcache["{$parent}"] as $key1 => $faq) { $optiontitle = str_repeat('--', $depth) . ' ' . $faq['title']; $optionvalue = 'faq.php?' . $vbulletin->session->vars['sessionurl'] . "faq={$parent}#faq_{$faq['faqname']}"; $optionselected = iif($faq['faqname'] == $faqparent, ' ' . 'selected="selected"'); $faqjumpbits .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); if (is_array($ifaqcache["{$faq['faqname']}"])) { construct_faq_jump($faq['faqname'], $depth + 1); } } }
/** * Returns HTML of options/optgroups for direct display in a template for the * selected forum. * * @param integer Forum ID to show prefixes from * @param string Selected prefix ID * @param boolean Whether to check whether the user can use the prefix before returning it in the list * * @return string HTML to output */ function fetch_prefix_html($forumid, $selectedid = '', $permcheck = false) { global $vbulletin, $vbphrase; $prefix_options = ''; if ($prefixsets = fetch_prefix_array($forumid)) { foreach ($prefixsets as $prefixsetid => $prefixes) { $optgroup_options = ''; foreach ($prefixes as $prefixid => $prefix) { if ($permcheck and !can_use_prefix($prefixid, $prefix['restrictions']) and $prefixid != $selectedid) { continue; } $optionvalue = $prefixid; $optiontitle = htmlspecialchars_uni($vbphrase["prefix_{$prefixid}_title_plain"]); $optionselected = $prefixid == $selectedid ? ' selected="selected"' : ''; $optionclass = ''; $optgroup_options .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } // Make sure we dont try to add the prefix set if we've restricted them all. if ($optgroup_options != '') { // if there's only 1 prefix set available, we don't want to show the optgroup if (sizeof($prefixsets) > 1) { $optgroup_label = htmlspecialchars_uni($vbphrase["prefixset_{$prefixsetid}_title"]); $templater = vB_Template::create('optgroup'); $templater->register('optgroup_extra', $optgroup_extra); $templater->register('optgroup_label', $optgroup_label); $templater->register('optgroup_options', $optgroup_options); $prefix_options .= $templater->render(); } else { $prefix_options = $optgroup_options; } } } } return $prefix_options; }
{ $albums[$album['albumid']]['title'] = $album['title']; $albums[$album['albumid']]['pictures'][] = $album; } require_once(DIR . '/includes/functions_album.php'); foreach ($albums AS $albumid => $info) { $picturebits = ''; $show['backgroundpicker'] = true; $optionvalue = $albumid; // Need to shorten album titles here $optiontitle = "{$info['title']} (" . count($info['pictures']) . ")"; $optionselected = empty($albumbits) ? 'selected="selected"' : ''; $albumbits .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); $show['hidediv'] = empty($picturerowbits) ? false : true; foreach($info['pictures'] AS $picture) { $picture['caption_preview'] = fetch_censored_text(fetch_trimmed_title( $picture['caption'], $vbulletin->options['album_captionpreviewlen'] )); //$picture['thumburl'] = ($picture['thumbnail_filesize'] ? fetch_picture_url($picture, $picture, true) : ''); $picture['dimensions'] = ($picture['thumbnail_width'] ? "width=\"$picture[thumbnail_width]\" height=\"$picture[thumbnail_height]\"" : ''); $templater = vB_Template::create('modifyusercss_backgroundbit'); $templater->register('picture', $picture); $picturebits .= $templater->render(); } $templater = vB_Template::create('modifyusercss_backgroundrow');
/** * Constructs a Forum Jump Menu based on moderator permissions * * @param integer The "root" forum to work from * @param integer The ID of the forum that is currently selected * @param integer Characters to prepend to the item in the menu * @param string The moderator permission to check when building the Forum Jump Menu * * @return string The built forum Jump menu * */ function construct_mod_forum_jump($parentid = -1, $selectedid, $modpermission = '') { global $vbulletin; if (empty($vbulletin->iforumcache)) { cache_ordered_forums(); } if (empty($vbulletin->iforumcache["$parentid"]) OR !is_array($vbulletin->iforumcache["$parentid"])) { return; } foreach($vbulletin->iforumcache["$parentid"] AS $forumid) { $forumperms = $vbulletin->userinfo['forumpermissions']["$forumid"]; if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) OR $vbulletin->forumcache["$forumid"]['link']) { continue; } $children = construct_mod_forum_jump($forumid, $selectedid, $modpermission); if (!can_moderate($forumid, $modpermission) AND !$children) { continue; } // set $forum from the $vbulletin->forumcache $forum = $vbulletin->forumcache["$forumid"]; $optionvalue = $forumid; $optiontitle = $forum[title_clean]; $optionclass = 'd' . iif($forum['depth'] > 4, 4, $forum['depth']); $optionselected = ''; if ($selectedid == $optionvalue) { $optionselected = 'selected="selected"'; $optionclass .= ' fjsel'; } $forumjumpbits .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); $forumjumpbits .= $children; } // end foreach ($vbulletin->iforumcache[$parentid] AS $forumid) return $forumjumpbits; }
/** * Constructs a Forum Jump Menu for use when moving an item to a new forum * * @param integer The "Root" ID from which to generate this Menu * @param integer A Forum ID to "exclude" from the menu * @param integer If 1, removes all previous information from the Forum Jump Menu * @param string Characters to prepend to the items in the Jump Box * * @return string The generated forum jump menu * */ function construct_move_forums_options($parentid = -1, $excludeforumid = NULL, $addbox = 1) { global $vbulletin, $optionselected, $jumpforumid, $jumpforumtitle, $jumpforumbits, $vbphrase, $curforumid; if (empty($vbulletin->iforumcache)) { // get the vbulletin->iforumcache, as we use it all over the place, not just for forumjump cache_ordered_forums(0, 1); } if (empty($vbulletin->iforumcache["$parentid"]) OR !is_array($vbulletin->iforumcache["$parentid"])) { return; } if ($addbox == 1) { $jumpforumbits = ''; } foreach($vbulletin->iforumcache["$parentid"] AS $forumid) { $forumperms =& $vbulletin->userinfo['forumpermissions']["$forumid"]; if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) { continue; } else { // set $forum from the $vbulletin->forumcache $forum = $vbulletin->forumcache["$forumid"]; $optionvalue = $forumid; $optiontitle = $forum[title]; if ($forum['link']) { $optiontitle .= " ($vbphrase[link])"; } else if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['cancontainthreads'])) { $optiontitle .= " ($vbphrase[category])"; } else if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['allowposting'])) { $optiontitle .= " ($vbphrase[no_posting])"; } $optionclass = 'd' . iif($forum['depth'] > 3, 3, $forum['depth']); if ($curforumid == $optionvalue) { $optionselected = ' ' . 'selected="selected"'; $optionclass .= ' fjsel'; $selectedone = 1; } else { $optionselected = ''; } if ($excludeforumid == NULL OR $excludeforumid != $forumid) { $jumpforumbits .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } construct_move_forums_options($optionvalue, $excludeforumid, 0); } // if can view } // end foreach ($vbulletin->iforumcache[$parentid] AS $forumid) return $jumpforumbits; }
/** * Function to output select bits * * @param integer The category parent id to select by default * @param integer Userid * * @return void */ function construct_category_select($parentid = 0, $userid = 0) { global $vbulletin; if (!intval($userid)) { $userid = $vbulletin->userinfo['userid']; } if (!isset($vbulletin->vbblog['categorycache']["$userid"])) { fetch_ordered_categories($userid); } if (empty($vbulletin->vbblog['categorycache']["$userid"])) { return; } foreach ($vbulletin->vbblog['categorycache']["$userid"] AS $blogcategoryid => $category) { if ($category['userid'] != $userid) { continue; } $optionvalue = $blogcategoryid; $optiontitle = $category[title]; $optionclass = 'd' . ($category['depth'] > 4) ? 4 : $category['depth']; $optionselected = ($blogcategoryid == $parentid) ? 'selected="selected"' : ''; $jumpcategorybits .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } return $jumpcategorybits; }
/** * vB_Search_Searchtools::getPrefixOptions() * Get the list of prefix options for prefix filtering. * * @param array $prefixchoice -- Prefixes that have been selected. * @param boolean $include_meta -- Include the special array values (use is deprecated * should be included in templates so that they can be altered). * @return $html: complete html for the select element */ public static function getPrefixOptions($prefixchoice = array(), $include_meta=false) { global $vbulletin; global $vbphrase; $prefixsets = array(); $gotPrefixes = false; if (! is_array($prefixchoice)) { $prefixchoice = array($prefixchoice); } $prefixes_sql = $vbulletin->db->query_read(" SELECT prefix.prefixsetid, prefix.prefixid, forumprefixset.forumid FROM " . TABLE_PREFIX . "prefix AS prefix INNER JOIN " . TABLE_PREFIX . "prefixset AS prefixset ON (prefixset.prefixsetid = prefix.prefixsetid) INNER JOIN " . TABLE_PREFIX . "forumprefixset AS forumprefixset ON (forumprefixset.prefixsetid = prefixset.prefixsetid) ORDER BY prefixset.displayorder, prefix.displayorder "); while ($prefix = $vbulletin->db->fetch_array($prefixes_sql)) { $forumperms =& $vbulletin->userinfo['forumpermissions']["$prefix[forumid]"]; if (($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) AND ($forumperms & $vbulletin->bf_ugp_forumpermissions['cansearch']) AND verify_forum_password($prefix['forumid'], $vbulletin->forumcache["$prefix[forumid]"]['password'], false) ) { $prefixsets["$prefix[prefixsetid]"]["$prefix[prefixid]"] = $prefix['prefixid']; } } $prefix_options = ''; foreach ($prefixsets AS $prefixsetid => $prefixes) { $optgroup_options = ''; foreach ($prefixes AS $prefixid) { $gotPrefixes = true; $optgroup_options .= render_option_template( htmlspecialchars_uni($vbphrase["prefix_{$prefixid}_title_plain"]), $prefixid, in_array($prefixid, $prefixchoice) ? ' selected="selected"' : ''); } // if there's only 1 prefix set available, we don't want to show the optgroup if (count($prefixsets) > 1) { $optgroup_template = vB_Template::create('optgroup'); $optgroup_template->register('optgroup_label', htmlspecialchars_uni($vbphrase["prefixset_{$prefixsetid}_title"])); $optgroup_template->register('optgroup_options', $optgroup_options); $prefix_options .= $optgroup_template->render(); } else if (! $gotPrefixes) { return $vbphrase['no_prefix_defined']; } else { $prefix_options = $optgroup_options; } } $anythread_selected = (empty($prefixchoice) OR in_array('', $prefixchoice) ) ? ' selected="selected"' : ''; $anyprefix_selected = ($prefixchoice AND in_array('-1', $prefixchoice)) ? ' selected="selected"' : ''; $none_selected = ($prefixchoice AND in_array('-1', $prefixchoice)) ? ' selected="selected"' : ''; if ($include_meta) { $prefix_options = render_option_template($vbphrase['any_thread_meta'], '', $anythread_selected) . render_option_template($vbphrase['any_prefix_meta'], -2, $anyprefix_selected) . render_option_template($vbphrase['no_prefix_meta'], -1, $none_selected) . $prefix_options ; } return $prefix_options; }
while ($joinrequest = $db->fetch_array($joinrequests)) { $usergroups["{$joinrequest['usergroupid']}"] = intval($joinrequest['requests']); } unset($joinrequest); $db->free_result($joinrequests); // if we got no results, or if the specified usergroupid was not returned, show no permission if (empty($usergroups)) { print_no_permission(); } $usergroupbits = ''; foreach ($vbulletin->usergroupcache as $optionvalue => $usergroup) { if (isset($usergroups["{$optionvalue}"])) { $optiontitle = construct_phrase($vbphrase['x_y_requests'], $vbulletin->usergroupcache["{$optionvalue}"]['title'], vb_number_format($usergroups["{$optionvalue}"])); $optionselected = iif($optionvalue == $vbulletin->GPC['usergroupid'], 'selected="selected"', ''); $optionclass = ''; $usergroupbits .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } } // set a shortcut to the vbulletin->usergroupcache entry for this group $usergroup =& $vbulletin->usergroupcache["{$vbulletin->GPC['usergroupid']}"]; // initialize $joinrequestbits $joinrequestbits = ''; $numrequests =& $usergroups["{$vbulletin->GPC['usergroupid']}"]; // if there are some requests for this usergroup, display them if ($numrequests > 0) { // set defaults sanitize_pageresults($numrequests, $vbulletin->GPC['pagenumber'], $vbulletin->GPC['perpage'], 100, 20); $startat = ($vbulletin->GPC['pagenumber'] - 1) * $vbulletin->GPC['perpage']; $pagenav = construct_page_nav($vbulletin->GPC['pagenumber'], $vbulletin->GPC['perpage'], $numrequests, 'joinrequests.php?' . $vbulletin->session->vars['sessionurl'] . "usergroupid={$vbulletin->GPC['usergroupid']}&pp=" . $vbulletin->GPC['perpage']); $requests = $db->query_read_slave("\n\t\t\tSELECT req.*, user.username, IF(user.displaygroupid = 0, user.usergroupid, user.displaygroupid) AS displaygroupid, infractiongroupid\n\t\t\tFROM " . TABLE_PREFIX . "usergrouprequest AS req\n\t\t\tINNER JOIN " . TABLE_PREFIX . "user AS user USING(userid)\n\t\t\tWHERE req.usergroupid = " . $vbulletin->GPC['usergroupid'] . "\n\t\t\tLIMIT {$startat}, " . $vbulletin->GPC['perpage'] . "\n\t\t"); while ($request = $db->fetch_array($requests)) {
private function showCategoryOptions($selected) { global $vbphrase; require_once DIR . '/includes/functions_databuild.php'; fetch_phrase_group('search'); $categories = fetch_socialgroup_category_options(false); if (!is_array($selected)) { $selected = array($selected); } if (count($categories) > 0) { $select = render_option_template($vbphrase['any_category'], '', !count($selected) ? 'selected="selected"' : ''); foreach ($categories as $categoryid => $category) { $select .= render_option_template(htmlspecialchars_uni($category['title']), $categoryid, in_array($categoryid, $selected) ? 'selected="selected"' : ''); } return $select; } else { return false; } }
/** * Parses the appropiate template for contenttype that is to be updated on the calling window during an upload * * @param array Attachment information * @param array Values array pertaining to contenttype * @param boolean Disable template comments * @return string */ public function process_display_template($picture, $values = array(), $disablecomment = false) { global $show, $vbphrase; $languageid = $this->registry->userinfo['languageid'] ? $this->registry->userinfo['languageid'] : $this->registry->options['languageid']; $phraseinfo = $this->registry->db->query_first_slave(" SELECT phrasegroup_album FROM " . TABLE_PREFIX . "language WHERE languageid = $languageid "); $tmp = unserialize($phraseinfo['phrasegroup_album']); if (is_array($tmp)) { $vbphrase = array_merge($vbphrase, $tmp); } $show['album_cover'] = ($attachment['state'] == 'visible' OR can_moderate(0, 'canmoderatepictures')); $album_options = ''; $album_result = $this->registry->db->query_read(" SELECT albumid, title FROM " . TABLE_PREFIX . "album WHERE userid = {$this->registry->userinfo['userid']} "); if ($this->registry->db->num_rows($album_result) > 1) { while ($album = $this->registry->db->fetch_array($album_result)) { $optiontitle = $album['title']; $optionvalue = $album['albumid']; $optionselected = ($album['albumid'] == $values['albumid']) ? 'selected="selected"' : ''; $album_options .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } $show['move_to_album'] = true; } if (($ext_pos = strrpos($picture['filename'], '.')) !== false) { $picture['caption'] = substr($picture['filename'], 0, $ext_pos); } else { $picture['caption'] = $picture['filename']; } $picture['caption'] = str_replace(array('_', '-'), ' ', $picture['caption']); $picture['caption_preview'] = fetch_censored_text(fetch_trimmed_title( $picture['caption'], $this->registry->options['album_captionpreviewlen'] )); $picture['thumburl'] = ($picture['hasthumbnail']); $picture['dimensions'] = ($picture['thumbnail_width'] ? "width=\"$picture[thumbnail_width]\" height=\"$picture[thumbnail_height]\"" : ''); $templater = vB_Template::create('album_picture_editbit'); $templater->register('picture', $picture); $templater->register('album_options', $album_options); $templater->register('albuminfo', array('albumid' => $values['albumid'])); return $templater->render($disablecomment); }
/** * Constructs a style chooser HTML menu * * @param integer Style ID * @param string String repeated before style name to indicate nesting * @param boolean Whether or not to initialize this function (this function is recursive) * @param boolean Whether or not this will build the quick chooser menu * @param integer Reference to the total number of styles available in the chooser * * @return string */ function construct_style_options($styleid = -1, $depthmark = '', $init = true, $quickchooser = false, &$stylecount = 0) { global $vbulletin, $vbphrase, $show; $thisstyleid = $quickchooser ? $vbulletin->userinfo['styleid'] : $vbulletin->userinfo['realstyleid']; if ($thisstyleid == 0) { $thisstyleid = $quickchooser ? $vbulletin->userinfo['realstyleid'] : $vbulletin->userinfo['styleid']; } if ($thisstyleid == 0) { $thisstyleid = $vbulletin->options['styleid']; } // initialize various vars if ($init) { $stylesetlist = ''; // set the user's 'real style id' if (!isset($vbulletin->userinfo['realstyleid'])) { $vbulletin->userinfo['realstyleid'] = $vbulletin->userinfo['styleid']; } if (!$quickchooser) { if ($thisstyleid == 0) { $optionselected = 'selected="selected"'; $show['style_option_default_selected'] = true; } $show['style_option_default'] = true; } } // check to see that the current styleid exists // and workaround a very very odd bug (#2079) if (isset($vbulletin->stylecache["{$styleid}"]) and is_array($vbulletin->stylecache["{$styleid}"])) { $cache =& $vbulletin->stylecache["{$styleid}"]; } else { if (isset($vbulletin->stylecache[$styleid]) and is_array($vbulletin->stylecache[$styleid])) { $cache =& $vbulletin->stylecache[$styleid]; } else { return; } } // loop through the stylecache to get results foreach ($cache as $x) { foreach ($x as $style) { if (!$vbulletin->options['allowchangestyles']) { // Only allow the default style and any mobile styles. if (!$style['userselect'] or $style['styleid'] != $vbulletin->options['styleid'] and !isset($vbulletin->stylecache['mobile'][$style['styleid']])) { continue; } } if ($style['userselect'] or $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) { $stylecount++; if ($thisstyleid == $style['styleid']) { $optionselected = 'selected="selected"'; } else { $optionselected = ''; } $optionvalue = $style['styleid']; $optiontitle = $depthmark . ' ' . htmlspecialchars_uni($style['title']); $optionclass = ''; $stylesetlist .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); $stylesetlist .= construct_style_options($style['styleid'], $depthmark . '--', false, $quickchooser, $stylecount); } else { $stylesetlist .= construct_style_options($style['styleid'], $depthmark, false, $quickchooser, $stylecount); } } } return $stylesetlist; }
if ($vbulletin->GPC['addgroup'] and $albuminfo['userid'] != $vbulletin->userinfo['userid']) { print_no_permission(); } $show['add_group_row'] = ($userinfo['userid'] == $vbulletin->userinfo['userid'] and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] and $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups'] and $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canjoingroups']); ($hook = vBulletinHook::fetch_hook('album_album')) ? eval($hook) : false; if ($vbulletin->GPC['addgroup'] and $show['add_group_row']) { // need a list of groups this user is in $groups_sql = $db->query_read_slave("\n\t\t\tSELECT\n\t\t\t\tsocialgroup.groupid, socialgroup.name\n\t\t\tFROM " . TABLE_PREFIX . "socialgroup AS socialgroup\n\t\t\tINNER JOIN " . TABLE_PREFIX . "socialgroupmember AS socialgroupmember ON\n\t\t\t\t(\n\t\t\t\t\tsocialgroupmember.groupid = socialgroup.groupid\n\t\t\t\t\t\tAND\n\t\t\t\t\tsocialgroupmember.userid = " . $vbulletin->userinfo['userid'] . ")\n\t\t\tWHERE\n\t\t\t\tsocialgroupmember.type = 'member'\n\t\t\t\t\tAND\n\t\t\t\tsocialgroup.options & " . $vbulletin->bf_misc_socialgroupoptions['enable_group_albums'] . "\n\t\t\tORDER BY\n\t\t\t\tsocialgroup.name\n\t\t"); if ($db->num_rows($groups_sql) == 0) { standard_error(fetch_error('not_member_groups_find_some', fetch_seo_url('grouphome', array()))); } $group_options = ''; while ($group = $db->fetch_array($groups_sql)) { $optiontitle = fetch_censored_text($group['name']); $optionvalue = $group['groupid']; $group_options .= render_option_template($optiontitle, $optionvalue); } $show['add_group_form'] = true; $show['add_group_row'] = false; $show['private_notice'] = $albuminfo['state'] == 'private'; $perpage = 999999; // disable pagination } else { $show['add_group_form'] = false; $perpage = $vbulletin->options['album_pictures_perpage']; } if ($vbulletin->GPC['pagenumber'] < 1) { $vbulletin->GPC['pagenumber'] = 1; } $input_pagenumber = $vbulletin->GPC['pagenumber']; if (can_moderate(0, 'canmoderatepictures') or $albuminfo['userid'] == $vbulletin->userinfo['userid']) {
{ $optionvalue = "0|$username"; $optionselected = ($optionvalue == "$userid|$username") ? "selected='selected'" : ""; $usernamebit .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } $usernamebit .= "</optgroup>\n"; } $show['userchoice'] = true; } $postlistbit = ''; foreach ($postselect AS $optionvalue => $optiontitle) { $optionselected = ($optionvalue == $vbulletin->GPC['postid']) ? "selected='selected'" : ""; $postlistbit .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } ($hook = vBulletinHook::fetch_hook('inlinemod_mergeposts_complete')) ? eval($hook) : false; // draw navbar $navbits = array(); $navbits[$vbulletin->options['forumhome'] . '.php' . $vbulletin->session->vars['sessionurl_q']] = $vbphrase['forum']; $parentlist = array_reverse(explode(',', substr($foruminfo['parentlist'], 0, -3))); foreach ($parentlist AS $forumID) { $forumTitle = $vbulletin->forumcache["$forumID"]['title']; $navbits[fetch_seo_url('forum', array('forumid' => $forumID, 'title' => $forumTitle))] = $forumTitle; }
/** * vBForum_Search_Type_Post::showForumSelect() * This function generates the select scrolling list for forums, use in search for posts */ private function showForumOptions($forumchoice = array()) { global $vbulletin, $vbphrase, $show; //this will fill out $searchforumids as well as set the depth param in $vbulletin->forumcache global $searchforumids; fetch_search_forumids_array(); $options = array(); $non_searchable_forums = array(); foreach ($searchforumids as $forumid) { $forum =& $vbulletin->forumcache["{$forumid}"]; if (trim($forum['link'])) { continue; } //note that this code relies on the fact that searchforumids is ordered so that //parents appear before their childern (actually the what the display works depends //heavily on that fact so its not much of an assumption here). //if the forum isn't searchable, then don't show it. if (!($forum['options'] & $vbulletin->bf_misc_forumoptions['indexposts'])) { $non_searchable_forums[$forumid] = $forumid; } else { unset($non_searchable_forums[$forum['parentid']]); } $optionvalue = $forumid; $optiontitle = "{$forum['depthmark']} {$forum['title_clean']}"; if (!($vbulletin->userinfo['forumpermissions'][$forumid] & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) { $optiontitle .= '*'; $show['cantsearchposts'] = true; } $optionselected = ''; if ($forumchoice and in_array($forumid, $forumchoice)) { $optionselected = 'selected="selected"'; $haveforum = true; } $options[$forumid] = render_option_template($optiontitle, $forumid, $optionselected, 'd' . min(4, $forum['depth'])); } foreach ($non_searchable_forums as $forumid) { unset($options[$forumid]); } $options = implode("", $options); $options = render_option_template($vbphrase['search_all_open_forums'], '', $haveforum ? '' : 'selected="selected"') . render_option_template($vbphrase['search_subscribed_forums'], 'subscribed') . $options; return $options; }
/** * Constructs a style chooser HTML menu * * @param integer Style ID * @param string String repeated before style name to indicate nesting * @param boolean Whether or not to initialize this function (this function is recursive) * @param boolean Whether or not this will build the quick chooser menu * @param integer Reference to the total number of styles available in the chooser * * @return string */ function construct_style_options($styleid = -1, $depthmark = '', $init = true, $quickchooser = false, &$stylecount = 0) { global $vbulletin, $vbphrase; $thisstyleid = ($quickchooser ? $vbulletin->userinfo['styleid'] : $vbulletin->userinfo['realstyleid']); if ($thisstyleid == 0) { $thisstyleid = ($quickchooser ? $vbulletin->userinfo['realstyleid'] : $vbulletin->userinfo['styleid']); } if ($thisstyleid == 0) { $thisstyleid = $vbulletin->options['styleid']; } // initialize various vars if ($init) { $stylesetlist = ''; // set the user's 'real style id' if (!isset($vbulletin->userinfo['realstyleid'])) { $vbulletin->userinfo['realstyleid'] = $vbulletin->userinfo['styleid']; } if (!$quickchooser) { if ($thisstyleid == 0) { $optionselected = 'selected="selected"'; } $optionvalue = 0; $optiontitle = $vbphrase['use_forum_default']; $stylesetlist .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } } // check to see that the current styleid exists // and workaround a very very odd bug (#2079) if (isset($vbulletin->stylecache["$styleid"]) AND is_array($vbulletin->stylecache["$styleid"])) { $cache =& $vbulletin->stylecache["$styleid"]; } else if (isset($vbulletin->stylecache[$styleid]) AND is_array($vbulletin->stylecache[$styleid])) { $cache =& $vbulletin->stylecache[$styleid]; } else { return; } // loop through the stylecache to get results foreach ($cache AS $x) { foreach ($x AS $style) { if ($style['userselect'] OR $vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) { $stylecount++; if ($thisstyleid == $style['styleid']) { $optionselected = 'selected="selected"'; } else { $optionselected = ''; } $optionvalue = $style['styleid']; $optiontitle = $depthmark . ' ' . $style['title']; $optionclass = ''; $stylesetlist .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); $stylesetlist .= construct_style_options($style['styleid'], $depthmark . '--', false, $quickchooser, $stylecount); } else { $stylesetlist .= construct_style_options($style['styleid'], $depthmark, false, $quickchooser, $stylecount); } } } return $stylesetlist; }
// forum choice $forum_options_array = fetch_moderator_forum_options($vbphrase['all_forums'], ($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['ismoderator']), false, 'canannounce', '--', false); $forum_options = ''; foreach ($forum_options_array AS $optionvalue => $optiontitle) { if ($optionvalue == $announcementinfo['forumid']) { $optionselected = ' selected="selected"'; $optionclass = 'fjsel'; } else { $optionselected = ''; $optionclass = ''; } $forum_options .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } $post =& $announcementinfo; // build editor $editorid = construct_edit_toolbar( $announcementinfo['pagetext'], 0, // is html? 'announcement', // forumid true, // allow smilies ($announcementinfo['announcementoptions'] & $vbulletin->bf_misc_announcementoptions['allowsmilies']) ? 1 : 0 // parse smilies ); // build navbar $navbits = array();
/** * This lists the forums for the select list * @param mixed $config - array of current configuration for this widget * @return */ private function getForums($config, $name = 'forumchoice') { global $vbulletin, $vbphrase, $show; require_once DIR . '/includes/functions_search.php'; //this will fill out $searchforumids as well as set the depth param in $vbulletin->forumcache global $searchforumids; fetch_search_forumids_array(); $options = ""; foreach ($searchforumids AS $forumid) { $forum = $vbulletin->forumcache["$forumid"]; if (trim($forum['link'])) { continue; } $optionvalue = $forumid; $optiontitle = "$forum[depthmark] $forum[title_clean]"; if ($vbulletin->options['fulltextsearch'] AND !($vbulletin->userinfo['forumpermissions'][$forumid] & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) { $optiontitle .= '*'; $show['cantsearchposts'] = true; } $optionselected = ''; if ($config['forumchoice'] AND in_array($forumid, $config['forumchoice'])) { $optionselected = 'selected="selected"'; $haveforum = true; } $options .= render_option_template($optiontitle, $forumid, $optionselected, 'fjdpth' . min(4, $forum['depth'])); } //"All subscribed" requires special handling. if (is_array($config['forumchoice']) AND in_array('subscribed', $config['forumchoice'])) { $subscribed_selected = 'selected="selected"'; $haveforum = true; } else { $subscribed_selected = ''; } $select = "<select name=\"" .$name."[]\" multiple=\"multiple\" size=\"4\" $style_string>\n" . render_option_template($vbphrase['search_all_open_forums'], '', $haveforum ? '' : 'selected="selected"') . render_option_template($vbphrase['search_subscribed_forums'], 'subscribed', $subscribed_selected) . $options . "</select>\r"; return $select; }
$to_yearselected["{$today['year']}"] = 'selected="selected"'; } $from_yearbits = ''; $to_yearbits = ''; for ($gyear = $calendarinfo['startyear']; $gyear <= $calendarinfo['endyear']; $gyear++) { $from_yearbits .= "\t\t<option value=\"{$gyear}\" {$from_yearselected[$gyear]}>{$gyear}</option>"; $to_yearbits .= "\t\t<option value=\"{$gyear}\" {$to_yearselected[$gyear]}>{$gyear}</option>"; } // select correct timezone and build timezone options require_once DIR . '/includes/functions_misc.php'; // mainly for fetch_timezone $timezoneoptions = ''; foreach (fetch_timezone() as $optionvalue => $timezonephrase) { $optiontitle = $vbphrase["{$timezonephrase}"]; $optionselected = $optionvalue == $vbulletin->userinfo['timezoneoffset'] ? 'selected="selected"' : ''; $timezoneoptions .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } $patterncheck = array(1 => 'checked="checked"'); $eventtypecheck = array(1 => 'checked="checked"'); $dailybox = '1'; $weeklybox = '1'; $monthlybox1 = '2'; $monthlybox2 = '1'; $monthlycombo1 = 1; $monthlycombo2 = array(1 => 'selected="selected"'); $monthlycombo3 = array(1 => 'selected="selected"'); $yearlycombo1 = array(1 => 'selected="selected"'); $yearlycombo2 = 1; $yearlycombo3 = array(1 => 'selected="selected"'); $yearlycombo4 = array(1 => 'selected="selected"'); $yearlycombo5 = array(1 => 'selected="selected"');
/** * Function to output select bits * * @param integer The category parent id to select by default * * @return void */ function construct_category_select($parentid = 0) { global $vbulletin; if (!isset($vbulletin->cms_layout['categorycache'])) { fetch_ordered_layout_categories(); } if (empty($vbulletin->cms_layout['categorycache'])) { return; } foreach ($vbulletin->cms_layout['categorycache'] AS $categoryid => $category) { $optionvalue = $categoryid; $optiontitle = $category[title]; $optionclass = 'd' . ($category['depth'] > 4) ? 4 : $category['depth']; $optionselected = ($categoryid == $parentid) ? 'selected="selected"' : ''; $jumpcategorybits .= render_option_template($optiontitle, $optionvalue, $optionselected, $optionclass); } return $jumpcategorybits; }