コード例 #1
0
ファイル: functions_search.php プロジェクト: holandacz/nb4
function fetch_search_forumids_array($parentid = -1, $depthmark = '')
{
    global $searchforumids, $vbulletin;
    static $indexed_forum_cache;
    if ($parentid == -1) {
        $searchforumids = array();
        $indexed_forum_cache = array();
        foreach ($vbulletin->forumcache as $forumid => $forum) {
            $indexed_forum_cache["{$forum['parentid']}"]["{$forumid}"] =& $vbulletin->forumcache["{$forumid}"];
        }
    }
    if (is_array($indexed_forum_cache["{$parentid}"])) {
        foreach ($indexed_forum_cache["{$parentid}"] as $forumid => $forum) {
            $forumperms =& $vbulletin->userinfo['forumpermissions']["{$forumid}"];
            if ($forum['displayorder'] != 0 and $forumperms & $vbulletin->bf_ugp_forumpermissions['canview'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['cansearch'] and $forum['options'] & $vbulletin->bf_misc_forumoptions['active'] and verify_forum_password($forum['forumid'], $forum['password'], false)) {
                $vbulletin->forumcache["{$forumid}"]['depthmark'] = $depthmark;
                $searchforumids[] = $forumid;
                fetch_search_forumids_array($forumid, $depthmark . FORUM_PREPEND);
            }
        }
    }
}
コード例 #2
0
ファイル: recentposts.php プロジェクト: hungnv0789/vhtm
	/**
	 * 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;

	}
コード例 #3
0
ファイル: search.php プロジェクト: holandacz/nb4
     }
     if (empty($vbulletin->GPC['childforums'])) {
         $prefs['childforums'] = 0;
     }
 }
 // now check appropriate boxes, select menus etc...
 $formdata = array();
 foreach ($prefs as $varname => $value) {
     $formdata["{$varname}"] = ${$varname} = htmlspecialchars_uni($value);
     $checkedvar = $varname . 'checked';
     $selectedvar = $varname . 'selected';
     $formdata["{$checkedvar}"] = ${$checkedvar} = array($value => 'checked="checked"');
     $formdata["{$selectedvar}"] = ${$selectedvar} = array($value => 'selected="selected"');
 }
 // now get the IDs of the forums we are going to display
 fetch_search_forumids_array();
 $searchforumbits = '';
 $haveforum = false;
 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;
     }
     $optionclass = 'fjdpth' . iif($forum['depth'] > 4, 4, $forum['depth']);
     if (in_array($forumid, $vbulletin->GPC['forumchoice'])) {
コード例 #4
0
ファイル: post.php プロジェクト: 0hyeah/yurivn
 /**
  * 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;
 }