コード例 #1
0
ファイル: socialgroupmessage.php プロジェクト: 0hyeah/yurivn
 /**
  * vBForum_Search_Type_SocialGroupMessage::listUi()
  *This function generates the search elements for a user to search for group messages
  *
  *
  * @param mixed $prefs : the array of user preferences
  * @param mixed $contenttypeid : the content type for which we are going to
  *    search
  * @param array registers : any additional elements to be registered. These are
  * 	just passed to the template
  * @param string $template_name : name of the template to use for display. We have
  *		a default template.
  * @param boolean $groupable : a flag to tell whether the interface should display
  * 	grouping option(s).
  * @return $html: complete html for the search elements
  */
 public function listUi($prefs = null, $contenttypeid = null, $registers = null, $template_name = null)
 {
     global $vbulletin, $vbphrase, $show;
     if (!isset($template_name)) {
         $template_name = 'search_input_groupmessage';
     }
     if (!isset($contenttypeid)) {
         $contenttypeid = vB_Search_Core::get_instance()->get_contenttypeid('vBForum', 'SocialGroupMessage');
     }
     $messagegroupoptions = $this->showGroupOptions($prefs['messagegroupid']);
     if ($messagegroupoptions) {
         $show['search_messagegroupid'] = true;
     }
     $categoryoptions = $this->showCategoryOptions($prefs['categoryid']);
     if ($categoryoptions) {
         $show['search_categoryid'] = true;
     }
     $template = vB_Template::create($template_name);
     $template->register('securitytoken', $vbulletin->userinfo['securitytoken']);
     $template->register('contenttypeid', $contenttypeid);
     $template->register('search_messagegroup_options', $messagegroupoptions);
     $template->register('search_category_options', $categoryoptions);
     $this->setPrefs($template, $prefs, array('select' => array('searchdate', 'beforeafter', 'starteronly', 'messagegroupid', 'sortby'), 'cb' => array('nocache', 'exactname'), 'value' => array('query', 'searchuser'), 'rb' => array('showposts')));
     vB_Search_Searchtools::searchIntroRegisterHumanVerify($template);
     if (isset($registers) and is_array($registers)) {
         foreach ($registers as $key => $value) {
             $template->register($key, htmlspecialchars_uni($value));
         }
     }
     ($hook = vBulletinHook::fetch_hook('search_listui_complete')) ? eval($hook) : false;
     //clean up any changes to the show variable.
     unset($show['search_messagegroupid']);
     return $template->render();
 }
コード例 #2
0
ファイル: criteria.php プロジェクト: 0hyeah/yurivn
 /**
  *	Add a filter for forums which should not be searched.
  *
  *	@param array $forumids
  */
 public function add_excludeforumid_filter($forumids)
 {
     global $vbphrase;
     $this->add_filter('forumid', vB_Search_Core::OP_NEQ, $forumids);
     $this->add_display_strings('exclude_forum', vB_Search_Searchtools::getDisplayString('forum', $vbphrase['excluded_forums'], 'title', 'forumid', $forumids, vB_Search_Core::OP_NEQ, false));
 }
コード例 #3
0
ファイル: socialgroup.php プロジェクト: 0hyeah/yurivn
 public function add_advanced_search_filters($criteria, $registry)
 {
     if ($registry->GPC['memberlimit']) {
         $criteria->add_display_strings('sgmemberlimit', vB_Search_Searchtools::getCompareString($registry->GPC['memberless']) . $registry->GPC['memberlimit'] . ' ' . $vbphrase['members']);
         $op = $registry->GPC['memberless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT;
         $criteria->add_filter('sgmemberlimit', $op, $registry->GPC['memberlimit'], true);
     }
     if ($registry->GPC['messagelimit']) {
         $criteria->add_display_strings('sgmessagelimit', vB_Search_Searchtools::getCompareString($registry->GPC['messageless']) . $registry->GPC['messagelimit'] . ' ' . $vbphrase['messages']);
         $op = $registry->GPC['messageless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT;
         $criteria->add_filter('sgmessagelimit', $op, $registry->GPC['messagelimit'], true);
     }
     if ($registry->GPC['discussionlimit']) {
         $criteria->add_display_strings('sgdiscussionlimit', vB_Search_Searchtools::getCompareString($registry->GPC['discussionless']) . $registry->GPC['discussionlimit'] . ' ' . $vbphrase['discussions']);
         $op = $registry->GPC['discussionless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT;
         $criteria->add_filter('sgdiscussionlimit', $op, $registry->GPC['discussionlimit'], true);
     }
     if ($registry->GPC['picturelimit']) {
         $criteria->add_display_strings('sgpicturelimit', vB_Search_Searchtools::getCompareString($registry->GPC['pictureless']) . $registry->GPC['picturelimit'] . ' ' . $vbphrase['pictures']);
         $op = $registry->GPC['pictureless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT;
         $criteria->add_filter('sgpicturelimit', $op, $registry->GPC['picturelimit'], true);
     }
     if (count($registry->GPC['cat']) > 0) {
         $value = $registry->GPC['cat'];
         if (!is_array($value)) {
             $value = array($value);
         }
         if (!(in_array(' ', $value) or in_array('', $value))) {
             $criteria->add_filter('sgcategory', vB_Search_Core::OP_EQ, $value);
             $criteria->add_display_strings('sgcategory', vB_Search_Searchtools::getDisplayString('socialgroupcategory', $vbphrase['categories'], 'title', 'socialgroupcategoryid', $value, vB_Search_Core::OP_EQ, true));
         }
     }
     $year = $registry->GPC["group_filter_date_lteq_year"];
     $month = $registry->GPC["group_filter_date_lteq_month"];
     $day = $registry->GPC["group_filter_date_lteq_day"];
     $ltdate = $this->get_date($year, $month, $day);
     if ($ltdate) {
         //this is actually a core field with an odd UI, we don't need to handle it in
         //the db_fields function.
         $criteria->add_filter('dateline', vB_Search_Core::OP_LT, $ltdate, true);
         $criteria->add_display_strings('sgdate_before', $vbphrase['before'] . ' ' . date($vbulletin->options['dateformat'], $ltdate));
     }
     $year = $registry->GPC["group_filter_date_gteq_year"];
     $month = $registry->GPC["group_filter_date_gteq_month"];
     $day = $registry->GPC["group_filter_date_gteq_day"];
     $gtdate = $this->get_date($year, $month, $day);
     if ($gtdate) {
         $criteria->add_filter('dateline', vB_Search_Core::OP_GT, $gtdate, true);
         $criteria->add_display_strings('sgdate_after', $vbphrase['after'] . ' ' . date($vbulletin->options['dateformat'], $gtdate));
     }
     ($hook = vBulletinHook::fetch_hook('search_advanced_filters')) ? eval($hook) : false;
 }
コード例 #4
0
ファイル: ajax.php プロジェクト: hungnv0789/vhtm
if ($_REQUEST['do'] == 'list')
{
	$current_user = new vB_Legacy_CurrentUser();
	$vbulletin->input->clean_array_gpc('p', array(
		'search_type' => TYPE_UINT));

	if ($vbulletin->GPC_exists['search_type'])
	{
		vB_Search_Searchtools::getUiXml($vbulletin->GPC['search_type'],
			vB_Search_Searchtools::searchIntroFetchPrefs($current_user, $vbulletin->GPC['search_type']));
	}
	else
	{
		vB_Search_Searchtools::getUiXml(vB_Search_Core::TYPE_COMMON,
			vB_Search_Searchtools::searchIntroFetchPrefs($current_user, vB_Search_Core::TYPE_COMMON));
	}
}

if ($_POST['do'] == 'loadimageconfig')
{
	$vbulletin->input->clean_array_gpc('p', array(
		'attachmentid' => TYPE_UINT,
	));

	$xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
	$xml->add_group('settings');

		if ($attachment = $db->query_first("
			SELECT settings
			FROM " . TABLE_PREFIX . "attachment
コード例 #5
0
ファイル: visitormessage.php プロジェクト: 0hyeah/yurivn
 /**
  * vBForum_Search_Result_VisitorMessage::render()
  *
  * @param string $current_user
  * @param object $criteria
  * @return
  */
 public function render($current_user, $criteria, $template_name = '')
 {
     require_once DIR . '/includes/functions_user.php';
     if (!strlen($template_name)) {
         $template_name = 'search_results_visitormessage';
     }
     //TODO- create a template and pass it the necessary information
     //TODO- check vbphrase and see what we have to add.
     //TODO- figure if we are passing the right parameters. I suspect not.
     global $show;
     $template = vB_Template::create($template_name);
     $template->register('messagetext', vB_Search_Searchtools::getSummary($this->message['pagetext'], 100));
     //The template is out with the variables fromid and toid. It should just be
     // from and to, but we need to get out a simple patch.
     $from = array('userid' => $this->message['postuserid'], 'username' => $this->message['postusername']);
     $to = array('userid' => $this->message['userid'], 'username' => $this->message['username']);
     $template->register('vmid', $this->message['vmid']);
     $template->register('to', $this->message['username']);
     $template->register('from', $this->message['postusername']);
     $template->register('fromid', $from);
     $template->register('toid', $to);
     $template->register('sentdate', vbdate(vB::$vbulletin->options['dateformat'], $this->message['dateline'], true));
     $template->register('senttime', vbdate(vB::$vbulletin->options['timeformat'], $this->message['dateline']));
     if (vB::$vbulletin->options['avatarenabled']) {
         $template->register('avatar', fetch_avatar_from_record($this->message, true, 'postuserid'));
     }
     return $template->render();
 }
コード例 #6
0
ファイル: forum.php プロジェクト: 0hyeah/yurivn
 public function add_advanced_search_filters($criteria, $registry)
 {
     if ($registry->GPC['threadlimit']) {
         $criteria->add_display_strings('forumthreadlimit', vB_Search_Searchtools::getCompareString($registry->GPC['threadless']) . $registry->GPC['threadlimit'] . ' ' . $vbphrase['threads']);
         $op = $registry->GPC['threadless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT;
         $criteria->add_filter('forumthreadlimit', $op, $registry->GPC['threadlimit'], true);
     }
     if ($registry->GPC['postlimit']) {
         $criteria->add_display_strings('forumthreadlimit', vB_Search_Searchtools::getCompareString($registry->GPC['postless']) . $registry->GPC['postlimit'] . ' ' . $vbphrase['posts']);
         $op = $registry->GPC['postless'] ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT;
         $criteria->add_filter('forumpostlimit', $op, $registry->GPC['postlimit'], true);
     }
     if ($registry->GPC['forumdateline']) {
         if (is_numeric($registry->GPC['forumdateline'])) {
             $dateline = TIMENOW - $this->forumdateline * 86400;
         } else {
             $current_user = new vB_Legacy_CurrentUser();
             $dateline = $current_user->get_field('lastvisit');
         }
         $op = $registry->GPC['beforeafter'] == 'before' ? vB_Search_Core::OP_LT : vB_Search_Core::OP_GT;
         $criteria->add_filter('forumpostdateline', $op, $dateline, true);
         $this->set_display_date($criteria, $registry->GPC['forumdateline'], $registry->GPC['beforeafter']);
     }
     ($hook = vBulletinHook::fetch_hook('search_advanced_filters')) ? eval($hook) : false;
 }
コード例 #7
0
ファイル: search.php プロジェクト: hungnv0789/vhtm
/**
 * Display the main search form.
 *
 * @param vB_Legacy_Current_User $user  The current user for the board.
 * @param array $globals The array of "global" GPC items and their type defaults
 * @param array $navbits The navbit array
 * @param array $errors A list of errors to display, used for redisplaying the form on error
 * @param array $searchterms A map of form fields posted by the user.  Used to propogate the
 *		the form when processing fails.
 */
function do_intro($user, $globals, $navbits, $search_type, $errors = array(), $searchterms = array())
{
	global $vbulletin, $vbphrase, $prefs, $searchforumids, $show;

	if ($vbulletin->GPC['search_type']
		OR intval($vbulletin->GPC['searchthreadid'])
		OR (isset($vbulletin->GPC['searchfromtype'])
			and strlen($vbulletin->GPC['searchfromtype']) > 6))
	{
		$template = vB_Template::create('search_common_select_type');
	}
	else
	{
		$template = vB_Template::create('search_common');

		// we only need the list of content types if we're doing the generic
		$template->register('type_options', vB_Search_Searchtools::get_type_options());
		if (!$prefs['type']) $prefs['type'] = array();
		$template->register('selectedtypes', $prefs['type']);
	}

	search_intro_register_prefs($template, $prefs);
	vB_Search_Searchtools::searchIntroRegisterHumanVerify($template);

	//actually render any errors.
	search_intro_register_errors($template, $errors);
	$show['errors'] = !empty($errors);
	$show['tag_option'] = $vbulletin->options['threadtagging'];

	//check to see if we have a preferred type
	$defaulttype = null;

	if ($prefs['type'])
	{
		if (is_array($prefs['type']))
		{
			$defaulttype = $prefs['type'][0];
		}
		else
		{
			$defaulttype = $prefs['type'];
		}
	}

	if ($vbulletin->GPC['contenttypeid'])
	{
		$defaulttype = $vbulletin->GPC['contenttypeid'];
	}

	//If we have nothing else, let's show Posts
	if ($defaulttype == null)
	{
		$defaulttype = vB_Search_Core::get_instance()->get_contenttypeid('vBForum', 'Post');
	}

	//If we have the common type, set to the default
	if ($search_type instanceof vBForum_Search_Type_Common)
	{
		unset($search_type);
		$search_type = vb_Search_Core::get_instance()->get_search_type_from_id($defaulttype);
		$prefs = vB_Search_Searchtools::searchIntroFetchPrefs($user, $defaulttype);
	}

	if ($vbulletin->GPC['search_type'] )
	{
		$template->register('input_search_types', vB_Search_Searchtools::listSearchable('vb_search_params',
			 'search.php', $prefs, $defaulttype));

		if (intval($vbulletin->GPC['contenttypeid']) OR $defaulttype)
		{
			$template->register('search_ui', $search_type->listUi($prefs,
				intval($vbulletin->GPC['contenttypeid']) ?
				$vbulletin->GPC['contenttypeid'] : $defaulttype));
		}
	}
	else if (isset($vbulletin->GPC['searchfromtype'])
		AND strlen($vbulletin->GPC['searchfromtype']) > 6)
	{
		$template->register('input_search_types', vB_Search_Searchtools::listSearchable('vb_search_params',
			 'search.php', $prefs, $defaulttype));
		$search_type = explode(':', $vbulletin->GPC['searchfromtype'], 2);

		if (count($search_type) == 2)
		{
			$search_type = vb_Search_Core::get_instance()->get_search_type($search_type[0], $search_type[1]);
		}
		else if (intval($vbulletin->GPC['contenttypeid']))
		{
			$search_type = vb_Search_Core::get_instance()->get_search_type_from_id($vbulletin->GPC['contenttypeid']);
		}
		if (isset($search_type))
		{
			$template->register('search_ui', $search_type->listUi($prefs,
				$search_type->get_contenttypeid()));
		}
	}

	$template->register('sessionhash', $sessionhash);
	search_intro_register_tagcloud($template);

	if ($vbulletin->debug)
	{
		$show['nocache'] = true;
	}

	// unlink the 'search' part of the navbits
	array_pop($navbits);
	$navbits[''] = $vbphrase['advanced_search'];
	($hook = vBulletinHook::fetch_hook('search_intro')) ? eval($hook) : false;

	//finish off search
	($hook = vBulletinHook::fetch_hook('search_complete')) ? eval($hook) : false;

	$template->register('show', $show);
	$template->register('navbar', render_navbar_template(construct_navbits($navbits)));
	$template->register_page_templates();

	print_output($template->render());
}
コード例 #8
0
ファイル: list.php プロジェクト: hungnv0789/vhtm
	/**
	 * Inflate dynamic segments to canonical values.
	 */
	public function inflateSegments()
	{
		// Ensure we can resolve the value
		if (!$value = intval($this->value))
		{
			return;
		}

		// Inflate section
		if ('section' == $this->type)
		{
			$node = new vBCms_Item_Content($value);

			if (!$node->isValid())
			{
				return;
			}

			if ($this->value != ($segment = $node->getUrlSegment()))
			{
				$this->setSegment('value', $segment, true);
			}

			return;
		}

		// Inflate author
		if ('author' == $this->type)
		{
			// TODO: Need a model for users
			$result = vB::$vbulletin->db->query_first("
				SELECT username FROM " . TABLE_PREFIX . "user
				WHERE userid = $value
				AND username != ''
			");

			if ($result)
			{
				$this->setSegment('value', vBCms_Item_Content::buildUrlSegment($value, $result['username']), true);
			}

			return;
		}

		// Inflate category
		if ('category' == $this->type)
		{
			// TODO: Need a model for categories
			$result = vB::$vbulletin->db->query_first("
				SELECT category FROM " . TABLE_PREFIX . "cms_category
				WHERE categoryid = $value
				AND category != ''
			");

			if ($result)
			{
				$url = vB_Search_Searchtools::stripHtmlTags($record['category']);
				$segments['value'] .= '-' . str_replace(' ', '-', $url) ;

				$this->setSegment('value', vBCms_Item_Content::buildUrlSegment($value, $result['category']), true);
			}
		}
	}
コード例 #9
0
ファイル: statichtml.php プロジェクト: hungnv0789/vhtm
	/**
	 * function to return the rendered html for this result
	 *
	 * @param string $current_user
	 * @param object $criteria
	 * @return
	 */

	public function render($current_user, $criteria, $template_name = '')
	{
		global $vbulletin;
		global $show;
		include_once DIR . '/vb/search/searchtools.php';

		if (!strlen($template_name))
		{
			$template_name = 'vbcms_searchresult_statichtml';
		}
		$template = vB_Template::create($template_name);

		$template->register('title', $this->record['title'] );
		$template->register('html_title', $this->record['html_title'] );
		$template->register('page_url', vB_Route::create('vBCms_Route_Content', $this->record['nodeid'])->getCurrentURL());
		$template->register('username', $this->record['username']);
		$template->register('user', array(
			'username' => $this->record['username'],
			'userid' => $this->record['userid'],
		));
		$template->register('parentnode', $this->record['parentnode']);
		$template->register('parenttitle', $this->record['parenttitle']);
		$template->register('parent_html_title', $this->record['parent_html_title']);
		$template->register('pagetext',
			vB_Search_Searchtools::getSummary(vB_Search_Searchtools::stripHtmlTags($this->record['pagetext']), 100));
		$template->register('publishdate', $this->record['publishdate']);
		$template->register('published', $this->record['publishdate'] >= TIMENOW ?
		 true : false );
		$template->register('dateline', date($vbulletin->options['dateformat']. ' '
			. $vbulletin->options['default_timeformat'], $this->record['dateline']));
		$template->register('dateformat', $vbulletin->options['dateformat']);
		$template->register('timeformat', $vbulletin->options['default_timeformat']);
		$template->register('categories', $this->record['categories']);
		$result = $template->render();
		return $result;

	}
コード例 #10
0
ファイル: visitormessage.php プロジェクト: hungnv0789/vhtm
	/**
	 * vBForum_Search_Result_VisitorMessage::render()
	 *
	 * @param string $current_user
	 * @param object $criteria
	 * @return
	 */
	public function render($current_user, $criteria, $template_name = '')
	{
		global $vbulletin;

		if (!strlen($template_name)) {
			$template_name = 'search_results_visitormessage';
		}

		//TODO- create a template and pass it the necessary information
		//TODO- check vbphrase and see what we have to add.
		//TODO- figure if we are passing the right parameters. I suspect not.
		global $show;
		$template = vB_Template::create($template_name);
		$template->register('messagetext',
			vB_Search_Searchtools::getSummary($this->message['pagetext'], 100));
		//The template is out with the variables fromid and toid. It should just be
		// from and to, but we need to get out a simple patch.

		$from = array('userid' => $this->message['postuserid'], 'username' => $this->message['postusername']);
		$to = array('userid' => $this->message['userid'], 'username' => $this->message['username']);
		$template->register('vmid', $this->message['vmid']);
		$template->register('to', $this->message['username']);
		$template->register('from', $this->message['postusername']);
		$template->register('fromid', $from);
		$template->register('toid', $to);
		$template->register('sent', date($vbulletin->options['dateformat']. ' '
			. $vbulletin->options['default_timeformat'], $this->message['dateline']));
		$template->register('dateline', $this->message['dateline']);
		$template->register('dateformat', $vbulletin->options['dateformat']);
		$template->register('timeformat', $vbulletin->options['default_timeformat']);
		return $template->render();
	}
コード例 #11
0
ファイル: searchwidget.php プロジェクト: hungnv0789/vhtm
	/**
	 * This lists the available prefixes for the select list
	 *
	 * @param mixed $config - array of current configuration for this widget
	 * @return
	 */
	private function getPrefixes($config)
	{
		require_once DIR . '/vb/search/searchtools.php';
		return vB_Search_Searchtools::showPrefixes('prefixchoice',
			 'class="bginput"', $config['prefixchoice'], 4);
	}
コード例 #12
0
ファイル: post.php プロジェクト: 0hyeah/yurivn
 protected function add_pollid_filter($criteria, $pollids, $op)
 {
     global $vbphrase;
     if (!is_array($pollids) and $pollids and $op = vB_Search_Core::OP_EQ) {
         $criteria->add_filter('pollid', $op, $pollids, $restrictive);
         $criteria->add_display_strings($field, $vbphrase['poll'] . ' ' . $vbphrase['at_least'] . ' ' . $pollid);
         return;
     }
     if (!is_array($pollids)) {
         $pollids = array($pollids);
     }
     //if "everything" is selected, bail -- we don't need to filter.
     if (in_array(' ', $pollids) or in_array('', $pollids)) {
         return;
     }
     $restrictive = true;
     $pos = array_search('-1', $pollids);
     if ($pos !== false) {
         //convert to the actual database value for no prefix
         $pollids[$pos] = '';
         //if "no prefix" is selected, then this isn't a restrictive filter
         //otherwise it is.
         $restrictive = false;
     }
     $criteria->add_filter('pollid', $op, $pollids, $restrictive);
     $criteria->add_display_strings($field, $vbphrase['poll'] . vB_Search_Searchtools::getCompareString($op) . implode(', ', $pollids));
 }
コード例 #13
0
ファイル: content.php プロジェクト: hungnv0789/vhtm
	/**
	 * function to return the rendered html for this result
	 *
	 * @param string $current_user
	 * @param object $criteria
	 * @return
	 */
	public function render($current_user, $criteria, $template_name = '')
	{
		global $vbulletin;
		global $show;
		include_once DIR . '/vb/search/searchtools.php';

		if (!strlen($template_name))
		{
			$template_name = 'vbcms_content_article_preview';
		}
		$template = vB_Template::create($template_name);

		$template->register('title', $this->record['title'] );
		$template->register('html_title', $this->record['html_title'] );
		$page_url = vB_Route::create('vBCms_Route_Content', $this->record['nodeid'])->getCurrentURL();
		$template->register('page_url', $page_url);
		$join_char = strpos($page_url,'?') ? '&' : '?';
		$template->register('newcomment_url', $page_url . $join_char . "goto=newcomment");
		$template->register('username', $this->record['username']);
		$template->register('description', $this->record['description']);
		$template->register('pagetext',
			vB_Search_Searchtools::getSummary($this->record['pagetext'], 100));

		$template->register('dateline', date($vbulletin->options['dateformat']. ' '
			. $vbulletin->options['default_timeformat'], $this->record['dateline']));
		$result = $template->render();
		return $result;

	}
コード例 #14
0
ファイル: article.php プロジェクト: hungnv0789/vhtm
	/**
	 * This function composes the html to display the user interface for this
	 * search type
	 *
	 * @param mixed $prefs : the array of user preferences
	 * @param mixed $contenttypeid : the content type for which we are going to
	 *    search
	 * @param array registers : any additional elements to be registered. These are
	 * 	just passed to the template
	 * @param string $template_name : name of the template to use for display. We have
	 *		a default template.
	 * @param boolean $groupable : a flag to tell whether the interface should display
	 * 	grouping option(s).
	 * @return $html: complete html for the search elements
	 */
	public function listUi($prefs = null, $contenttypeid = null, $registers = null,
		$template_name = null)
	{
		global $vbulletin, $vbphrase;


		if (! isset($template_name))
		{
			$template_name = 'search_input_default';
		}

		if (! isset($contenttypeid))
		{
			$contenttypeid = vB_Types::instance()->getContentTypeID('vBCms_Article');
		}

		$template = vB_Template::create($template_name);
		$template->register('securitytoken', $vbulletin->userinfo['securitytoken']);
		$template->register('class', $this->get_display_name());
		$template->register('contenttypeid',$contenttypeid);

		$prefsettings = array(
			'select'=> array('searchdate', 'beforeafter', 'titleonly', 'sortby', 'sortorder'),
			'cb' => array('exactname'),
		 	'value' => array('query', 'searchuser'));
		$this->setPrefs($template, $prefs, $prefsettings);
		vB_Search_Searchtools::searchIntroRegisterHumanVerify($template);

		if (isset($registers) AND is_array($registers) )
		{
			foreach($registers as $key => $value)
			{
				$template->register($key, htmlspecialchars_uni($value));
			}
		}
		return $template->render();
	}
コード例 #15
0
ファイル: staticpage.php プロジェクト: hungnv0789/vhtm
	/**
	 * Populates a view with the expected info from a content item.
	 *
	 * @param vB_View $view
	 * @param int $viewtype
	 */
	protected function populateViewContent(vB_View $view, $viewtype = self::VIEW_PAGE, $increment_count = true)
	{
		global $show;

		if (empty($this->config))
		{
			$this->content->requireInfo(vBCms_Item_Content::INFO_CONFIG);
			 $this->config = $this->content->getConfig();
		}

		if ($_REQUEST['do']== 'apply' OR $_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'movenode')
		{
			$this->saveData($view);
			$this->content->requireInfo(vBCms_Item_Content::INFO_BASIC);
			$this->content->requireInfo(vBCms_Item_Content::INFO_CONFIG);
			$this->content->requireInfo(vBCms_Item_Content::INFO_NODE);
			$this->content->requireInfo(vBCms_Item_Content::INFO_PARENTS);
			$this->content->requireInfo(vBCms_Item_Content::INFO_NAVIGATION);
			$this->config = $this->content->getConfig();
		}
		else
		{
			$this->content->requireInfo(vBCms_Item_Content::INFO_BASIC);
			$this->content->requireInfo(vBCms_Item_Content::INFO_NODE);
			$this->content->requireInfo(vBCms_Item_Content::INFO_PARENTS);
			$this->content->requireInfo(vBCms_Item_Content::INFO_NAVIGATION);
		}

		if ($_REQUEST['goto'] == 'newcomment')
		{
			require_once DIR . '/includes/functions_bigthree.php' ;

			$record = vB::$vbulletin->db->query_first("SELECT associatedthreadid
				FROM " . TABLE_PREFIX . "cms_nodeinfo WHERE nodeid = " . $this->getNodeId());
			$threadid = $record['associatedthreadid'];
			$threadinfo = verify_id('thread', $threadid, 1, 1);

			if (vB::$vbulletin->options['threadmarking'] AND vB::$vbulletin->userinfo['userid'])
			{
				vB::$vbulletin->userinfo['lastvisit'] = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - (vB::$vbulletin->options['markinglimit'] * 86400));
			}
			else if (($tview = intval(fetch_bbarray_cookie('thread_lastview', $threadid))) > vB::$vbulletin->userinfo['lastvisit'])
			{
				vB::$vbulletin->userinfo['lastvisit'] = $tview;
			}

			$coventry = fetch_coventry('string');
			$posts = vB::$vbulletin->db->query_first("
				SELECT MIN(postid) AS postid
				FROM " . TABLE_PREFIX . "post
				WHERE threadid = $threadinfo[threadid]
					AND visible = 1
					AND dateline > " . intval(vB::$vbulletin->userinfo['lastvisit']) . "
					". ($coventry ? "AND userid NOT IN ($coventry)" : "") . "
				LIMIT 1
			");

			$target_url = vB_Router::getURL();
			$join_char = strpos($target_url,'?') ? '&' : '?';
			if ($posts['postid'])
			{
				exec_header_redirect($target_url . $join_char . "commentid=" . $posts['postid'] . "#post$posts[postid]");
			}
			else
			{
				exec_header_redirect($target_url . $join_char . "commentid=" . $threadinfo['lastpostid'] . "#post$threadinfo[lastpostid]");
			}
		}
		if ($_REQUEST['commentid'])
		{
			vB::$vbulletin->input->clean_array_gpc('r', array(
				'commentid' => vB_Input::TYPE_INT,
			));
			$postinfo = verify_id('post', vB::$vbulletin->GPC['commentid'], 1, 1);
			$record = vB::$vbulletin->db->query_first("SELECT associatedthreadid
				FROM " . TABLE_PREFIX . "cms_nodeinfo WHERE nodeid = " . $this->getNodeId());
			$threadid = $record['associatedthreadid'];

			// if comment id and node id do not match, we ignore commentid
			if ($postinfo['threadid'] == $threadid)
			{
				$getpagenum = vB::$vbulletin->db->query_first("
					SELECT COUNT(*) AS posts
					FROM " . TABLE_PREFIX . "post AS post
					WHERE threadid = $threadid AND visible = 1
					AND dateline <= $postinfo[dateline]
				");
				$_REQUEST['commentpage'] = ceil($getpagenum['posts'] / 20);
			}
		}

		if ($_REQUEST['do']== 'apply' OR $_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'movenode')
		{
			$this->saveData($view);
		}

		($hook = vBulletinHook::fetch_hook($this->startpopulatehook)) ? eval($hook) : false;

		//Now we need to get the settings for turning off content. There is the "settingsforboth" flag, which says whether we even apply
		// the settings to the current page, and there are the six "show" variables.

		if ($_REQUEST['do'] == 'delete' AND $this->content->canEdit())
		{
			$dm = $this->content->getDM();
			$dm->delete();
			$this->cleanContentCache();

			// Create route to redirect the user to
			$route = new vBCms_Route_Content();
			$route->node = $this->content->getParentId();
			$_REQUEST['do'] = '';
			throw (new vB_Exception_Reroute($route));
		}

		//When we come from the link to upgrade a blog post, blog, or forum post, the
		// router puts us here.
		$settings_for = $this->content->getSettingsForboth();
		$showfor_this = (((self::VIEW_PAGE == $viewtype)
			AND ($settings_for == 0)) OR ((self::VIEW_PREVIEW == $viewtype)
			AND ($settings_for == 2))) ? 0 : 1;

		$view->showtitle = (($showfor_this AND !$this->content->getShowTitle()))? 0 : 1;
		$view->showpreviewonly = (($showfor_this AND !$this->content->getShowPreviewonly()))? 0 : 1;
		$view->showuser = (($showfor_this AND !$this->content->getShowUser()))? 0 : 1;
		$view->showupdated = (($showfor_this AND !$this->content->getShowUpdated()))? 0 : 1;
		$view->showviewcount = (($showfor_this AND !$this->content->getShowViewcount()))? 0 : 1;
		$view->showpublishdate = (($showfor_this AND !$this->content->getShowPublishdate()))? 0 : 1;
		$view->lastupdated = $this->content->getLastUpdated();
		$view->previewtext = $this->config['previewtext'];

		if ((self::VIEW_PREVIEW != $viewtype) OR !$view->showpreviewonly)
		{
			$view->pagetext = $this->config['pagetext'];
		}
		$view->previewimage = $this->config['preview_image'];
		$view->nodeid = $this->content->getNodeId();

		parent::populateViewContent($view, $viewtype);

		$segments = array('node' => vBCms_Item_Content::buildUrlSegment($this->content->getNodeId(), $this->content->getUrl()), 'action' =>'view');
		$view->page_url =  vBCms_Route_Content::getURL($segments);
		$view->pagetext = $this->config['pagetext'];

		if (self::VIEW_PAGE == $viewtype)
		{
			if ($increment_count)
			{
				//update the view count
				vB::$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX .
						"cms_nodeinfo set viewcount = viewcount + 1 where nodeid = " . $this->content->getNodeId());
			}

			//tagging code
			require_once DIR . '/includes/class_taggablecontent.php';

			$taggable = vB_Taggable_Content_Item::create(vB::$vbulletin, $this->content->getContentTypeId(),
				$this->content->getNodeId(), $this->content);

			if ($taggable)
			{
				$view->tags = $taggable->fetch_rendered_tag_list();
				$view->tag_count = $taggable->fetch_existing_tag_count();
				$view->showtags = vB::$vbulletin->options['threadtagging'];
			}
			else
			{
				$view->showtags = false;
			}

			$view->comment_count = $this->content->getReplyCount();
			$join_char = strpos($view->page_url,'?') ? '&amp;' : '?';
			$view->newcomment_url = $view->page_url . "#new_comment";
			$view->authorid = ($this->content->getUserId());
			$view->authorname = ($this->content->getUsername());
			$view->viewcount = ($this->content->getViewCount());
			$view->replycount = ($this->content->getReplyCount());
			$view->can_edit = ($this->content->canEdit() OR $this->content->canPublish()) ? 1 : 0;
			$view->parentid = $this->content->getParentId();

			//check to see if there is an associated thread.
			if ($associatedthreadid = $this->content->getAssociatedThreadId()
				and $this->content->getComments_Enabled())
			{
				$comment_block = new vBCms_Comments();
				$view->comment_block = $comment_block->getPageView($this->content->getNodeId(),
					$view->page_url);
			}

		}
		else if (self::VIEW_PREVIEW == $viewtype)
		{

			if ($showpreviewonly)
			{
				$view->previewtext = isset($this->config['previewtext']) ? $this->config['previewtext'] :
					 substr(strip_tags( $this->config['pagetext'], '<br />'), 0, $this->config['previewlength']);
				$view->preview_chopped = 1;

			}
			else
			{
				$view->previewtext = $view->pagetext;
			}

			$segments = array('node' => $this->content->getNodeId() . '-' . $this->content->getUrl(), 'action' =>'edit');
			$view->edit_url =  vBCms_Route_Content::getURL($segments) ;
			$view->read_more_phrase = new vB_Phrase('vbcms', 'read_more');
			$view->parenttitle = $this->content->getParentTitle();
			$view->pagetext = $pagetext;
			$view->setpublish = $view->published = $this->content->getPublished();
			$view->publishdate = $this->content->getPublishDateLocal();
			$view->comment_count = $this->content->getReplyCount();
			$join_char = strpos($view->page_url,'?') ? '&amp;' : '?';
			$view->newcomment_url = $view->page_url . "#new_comment";
			$view->authorid = ($this->content->getUserId());
			$view->authorname = ($this->content->getUsername());
			$view->viewcount = ($this->content->getViewCount());
			$view->replycount = ($this->content->getReplyCount());
			$view->can_edit = ($this->content->canEdit() OR $this->content->canPublish()) ? 1 : 0;
			$view->parentid = $this->content->getParentId();

			if (($associatedthreadid = $this->content->getAssociatedThreadId())
				AND $this->content->getComments_Enabled() AND intval($this->content->getReplyCount()) > 0)
			{
				$view->echo_comments = 1;
				$view->comment_count = $this->content->getReplyCount();
			}
			else
			{
				$view->echo_comments = 0;
				$view->comment_count = 0;
			}
		}

		$view->setpublish = $this->content->getSetPublish();
		$view->publishdate = $this->content->getPublishDate();
		$view->published = $this->content->getPublished() ?
			1 : 0;

		$view->publishdatelocal = vbdate(vB::$vbulletin->options['dateformat'], $this->content->getPublishDate());
		$view->publishtimelocal = vbdate( vB::$vbulletin->options['timeformat'], $this->content->getPublishDate() );

		//Get links to the author, section, and categories search pages
		//categories- this comes as an array
		$view->categories = $this->content->getCategories();
		$route_info = 'author/' . $this->content->getUserid() .
			($this->content->getUsername() != '' ? '-' . str_replace(' ', '-',
				vB_Search_Searchtools::stripHtmlTags($this->content->getUsername())) : '');
		$view->author_url = vB_Route::create('vBCms_Route_List', "$route_info/1")->getCurrentURL();

		// prepare the member action drop-down menu
		$view->memberaction_dropdown = construct_memberaction_dropdown(fetch_userinfo($this->content->getUserId()));

		//Section
		$route_info = 'section/' .$this->content->getParentId() .
			($this->content->getParentURLSegment() != '' ? '-' . str_replace(' ', '-',
				vB_Search_Searchtools::stripHtmlTags($this->content->getParentURLSegment())) : '');
		$view->section_list_url = vB_Route::create('vBCms_Route_List', "$route_info")->getCurrentURL();
		//and the content
		$route_info = $this->content->getParentId() .
			($this->content->getParentURLSegment() != '' ? '-' . str_replace(' ', '-',
				vB_Search_Searchtools::stripHtmlTags($this->content->getParentURLSegment())) : '');
		$view->section_url = vB_Route::create('vBCms_Route_Content', $route_info)->getCurrentURL();

		$view->html_title = $this->content->getHtmlTitle();
		$view->title = $this->content->getTitle();
		$view->contenttypeid = vB_Types::instance()->getContentTypeID("vBCms_Article");
		$view->dateformat = vB::$vbulletin->options['dateformat'];
		$view->showrating = $this->content->getShowRating();
		($hook = vBulletinHook::fetch_hook($this->endpopulatehook)) ? eval($hook) : false;

		if (method_exists($this->content, 'cacheNow'))
		{
			$this->content->cacheNow();
		}
		return $view;
	}
コード例 #16
0
ファイル: ajax.php プロジェクト: Kheros/MMOver
        $templater->register('styles', $settings['styles']);
    }
    $html = $templater->render(false);
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    $xml->add_tag('html', $html);
    $xml->print_xml();
}
if ($_POST['do'] == 'list') {
    $current_user = new vB_Legacy_CurrentUser();
    $vbulletin->input->clean_array_gpc('p', array('search_type' => TYPE_UINT));
    if (isset($vbulletin->GPC['search_type'])) {
        $prefs = vB_Search_Searchtools::searchIntroFetchPrefs($current_user, $vbulletin->GPC['search_type']);
    } else {
        $prefs = vB_Search_Searchtools::searchIntroFetchPrefs($current_user, vB_Search_Core::TYPE_COMMON);
    }
    vB_Search_Searchtools::getUiXml($vbulletin->GPC['search_type'], $prefs);
}
if ($_POST['do'] == 'loadimageconfig') {
    $vbulletin->input->clean_array_gpc('p', array('attachmentid' => TYPE_UINT));
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
    $xml->add_group('settings');
    if ($attachment = $db->query_first("\r\n\t\t\tSELECT settings\r\n\t\t\tFROM " . TABLE_PREFIX . "attachment\r\n\t\t\tWHERE attachmentid = " . $vbulletin->GPC['attachmentid'] . "\r\n\t\t")) {
        $settings = unserialize($attachment['settings']);
        foreach ($settings as $key => $value) {
            $xml->add_tag($key, $value);
        }
    }
    $xml->close_group('settings');
    $xml->print_xml();
}
if ($_POST['do'] == 'saveimageconfig') {
コード例 #17
0
ファイル: article.php プロジェクト: hungnv0789/vhtm
	/**
	 * Populates a view with the expected info from a content item.
	 *
	 * @param vB_View $view
	 * @param int $viewtype
	 */
	protected function populateViewContent(vB_View $view, $viewtype = self::VIEW_PAGE, $increment_count = true)
	{
		global $show;
		$this->content->requireInfo(vBCms_Item_Content::INFO_BASIC);
		$this->content->requireInfo(vBCms_Item_Content::INFO_CONTENT);
		$this->content->requireInfo(vBCms_Item_Content::INFO_CONFIG);
		$this->content->requireInfo(vBCms_Item_Content::INFO_NODE);
		$this->content->requireInfo(vBCms_Item_Content::INFO_PARENTS);

		if ($_REQUEST['goto'] == 'newcomment')
		{
			require_once DIR . '/includes/functions_bigthree.php' ;

			$record = vB::$vbulletin->db->query_first("SELECT associatedthreadid
				FROM " . TABLE_PREFIX . "cms_nodeinfo WHERE nodeid = " . $this->getNodeId());
			$threadid = $record['associatedthreadid'];
			$threadinfo = verify_id('thread', $threadid, 1, 1);

			if (vB::$vbulletin->options['threadmarking'] AND vB::$vbulletin->userinfo['userid'])
			{
				vB::$vbulletin->userinfo['lastvisit'] = max($threadinfo['threadread'], $threadinfo['forumread'], TIMENOW - (vB::$vbulletin->options['markinglimit'] * 86400));
			}
			else if (($tview = intval(fetch_bbarray_cookie('thread_lastview', $threadid))) > vB::$vbulletin->userinfo['lastvisit'])
			{
				vB::$vbulletin->userinfo['lastvisit'] = $tview;
			}

			$coventry = fetch_coventry('string');
			$posts = vB::$vbulletin->db->query_first("
				SELECT MIN(postid) AS postid
				FROM " . TABLE_PREFIX . "post
				WHERE threadid = $threadinfo[threadid]
					AND visible = 1
					AND dateline > " . intval(vB::$vbulletin->userinfo['lastvisit']) . "
					". ($coventry ? "AND userid NOT IN ($coventry)" : "") . "
				LIMIT 1
			");

			$target_url = vB_Router::getURL();
			$join_char = strpos($target_url,'?') ? '&amp;' : '?';
			if ($posts['postid'])
			{
				exec_header_redirect($target_url . $join_char . "commentid=" . $posts['postid'] . "#post$posts[postid]");
			}
			else
			{
				exec_header_redirect($target_url . $join_char . "commentid=" . $threadinfo['lastpostid'] . "#post$threadinfo[lastpostid]");
			}
		}
		if ($_REQUEST['commentid'])
		{
			vB::$vbulletin->input->clean_array_gpc('r', array(
				'commentid' => vB_Input::TYPE_INT,
			));
			$postinfo = verify_id('post', vB::$vbulletin->GPC['commentid'], 1, 1);
			$record = vB::$vbulletin->db->query_first("SELECT associatedthreadid
				FROM " . TABLE_PREFIX . "cms_nodeinfo WHERE nodeid = " . $this->getNodeId());
			$threadid = $record['associatedthreadid'];

			// if comment id and node id do not match, we ignore commentid
			if ($postinfo['threadid'] == $threadid)
			{
				$getpagenum = vB::$vbulletin->db->query_first("
					SELECT COUNT(*) AS posts
					FROM " . TABLE_PREFIX . "post AS post
					WHERE threadid = $threadid AND visible = 1
					AND dateline <= $postinfo[dateline]
				");
				$_REQUEST['commentpage'] = ceil($getpagenum['posts'] / 20);
			}
		}

		if ($_REQUEST['do']== 'apply' OR $_REQUEST['do'] == 'update' OR $_REQUEST['do'] == 'movenode')
		{
			$this->SaveData($view);
		}

		($hook = vBulletinHook::fetch_hook('vbcms_article_populate_start')) ? eval($hook) : false;

		//Now we need to get the settings for turning off content. There is the "settingsforboth" flag, which says whether we even apply
		// the settings to the current page, and there are the six "show" variables.

		if ($_REQUEST['do'] == 'delete' AND $this->content->canEdit())
		{
			$dm = $this->content->getDM();
			$dm->delete();
			$this->cleanContentCache();

			// Create route to redirect the user to
			$route = new vBCms_Route_Content();
			$route->node = $this->content->getParentId();
			$_REQUEST['do'] = '';
			throw (new vB_Exception_Reroute($route));
		}

		//When we come from the link to upgrade a blog post, blog, or forum post, the
		// router puts us here.
		$settings_for = $this->content->getSettingsForboth();
		$showfor_this = (((self::VIEW_PAGE == $viewtype)
			AND ($settings_for == 0)) OR ((self::VIEW_PREVIEW == $viewtype)
			AND ($settings_for == 2))) ? 0 : 1;

		$view->showtitle = (($showfor_this AND !$this->content->getShowTitle()))? 0 : 1;
		$view->showpreviewonly = (($showfor_this AND !$this->content->getShowPreviewonly()))? 0 : 1;
		$view->showuser = (($showfor_this AND !$this->content->getShowUser()))? 0 : 1;
		$view->showupdated = (($showfor_this AND !$this->content->getShowUpdated()))? 0 : 1;
		$view->showviewcount = (($showfor_this AND !$this->content->getShowViewcount()))? 0 : 1;
		$view->showpublishdate = (($showfor_this AND !$this->content->getShowPublishdate()))? 0 : 1;
		$view->lastupdated = $this->content->getLastUpdated();
		$showpreviewonly = (($showfor_this AND !$this->content->getShowPreviewonly()))? 0 : 1;

		parent::populateViewContent($view, $viewtype);

		$segments = array('node' => vBCms_Item_Content::buildUrlSegment($this->content->getNodeId(), $this->content->getUrl()), 'action' =>'view');
		$view->page_url =  vBCms_Route_Content::getURL($segments);

		if ($this->editing)
		{
			$view->pagetext = $this->content->getPageText();
		}
		else
		{
			$rendered = $this->content->getRendered($this->data_saved);
			$view->pagetext = $rendered['pages'][$this->parameters['page']];

			if ($this->content->canDownload())
			{
				$view->attachments = $rendered['attachments'];
				$view->showattachments = empty($rendered['viewinfo']) ? 0 : 1 ;


				if (!empty($rendered['viewinfo']))
				{
					foreach ($rendered['viewinfo'] as $key => $viewbit)
					{
						$view->$key = $viewbit;
					}
				}
			}

			$view->parenttitle = $this->content->getParentTitle();

			$view->showattachments = empty($view->attachments) ? 0 : 1 ;

			if (!empty($viewinfo))
			{
				foreach ($viewinfo as $key => $viewbit)
				{
					$view->$key = $viewbit;
				}
			}

			$view->pagelist = $rendered['pagelist'];
			$view->nodesegment = $this->content->getUrlSegment();
			$view->current_page = $this->parameters['page'];
			if ($this->content->canDownload())
			{
				$show['lightbox'] = (vB::$vbulletin->options['lightboxenabled'] AND vB::$vbulletin->options['usepopups']);
			}
		}

		// Only break pages for the page view
		if ((self::VIEW_PAGE == $viewtype) OR (self::VIEW_PREVIEW == $viewtype))
		{
			if (self::VIEW_PAGE == $viewtype)
			{
				if ($increment_count)
				{
					//update the view count
					vB::$vbulletin->db->query_write("UPDATE " . TABLE_PREFIX .
							"cms_nodeinfo set viewcount = viewcount + 1 where nodeid = " . $this->content->getNodeId());
				}

				//tagging code
				require_once DIR . '/includes/class_taggablecontent.php';
				$taggable = vB_Taggable_Content_Item::create(vB::$vbulletin, $this->content->getContentTypeId(),
					$this->content->getContentId(), $this->content);
				$view->tags = $taggable->fetch_rendered_tag_list();
				$view->tag_count = $taggable->fetch_existing_tag_count();
				$view->showtags = vB::$vbulletin->options['threadtagging'];

				// promoted threadid
				if ($promoted_threadid = $this->content->getThreadId())
				{
					if ($promoted_threadid = verify_id('thread', $promoted_threadid, false))
					{
						// get threadinfo
						$threadinfo = fetch_threadinfo($promoted_threadid);
						$forumperms = fetch_permissions($threadinfo['forumid']);
						$view->threadinfo = $threadinfo;
						// check permissions
						if ($threadinfo['visible'] != 1)
						{
							$promoted_threadid = false;
						}
						else if (!($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canview'])
							OR !($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads'])
							OR (!($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewothers'])
								AND ($threadinfo['postuserid'] != vB::$vbulletin->userinfo['userid'] OR vB::$vbulletin->userinfo['userid'] == 0)
							))
						{
							$promoted_threadid = false;
						}
						else
						{
							// check forum password
							$foruminfo = fetch_foruminfo($threadinfo['forumid']);

							if ($foruminfo['password'] AND !verify_forum_password($foruminfo['forumid'], $foruminfo['password'], false))
							{
								$promoted_threadid = false;
							}
						}

						$view->promoted_threadid = $promoted_threadid;
					}
				}

				// get pagelist for navigation
				$view->postitle = $this->content->getPostTitle();
				$view->poststarter = $this->content->getPostStarter();
				$view->postauthor = $this->content->getPostAuthor();
				$view->postid = ($this->content->getPostId());
				$view->threadid = $this->content->getThreadId();
				$view->blogpostid = ($this->content->getBlogPostId());
				$view->post_started = ($this->content->getPostStarted());
				$view->post_posted = ($this->content->getPostPosted());
				$view->promoted_blogid = $this->content->getBlogId();

				//make links to original post and/or blog if appropriate
				if ($view->promoted_blogid)
				{
					$view->blog_url = fetch_seo_url('blog',
						array('userid' => $this->content->getPostStarter(),
						'blog_title' => $this->content->getPostTitle()));
				}
				else if ($view->threadid)
				{
					$threadinfo = vB::$vbulletin->db->query_first("SELECT threadid, title FROM " .
						TABLE_PREFIX . "thread where threadid = " . $view->threadid);

					if ($threadinfo)
					{
						$post_url = fetch_seo_url('thread', $threadinfo);
						$post_url .= (strpos($post_url, '?' ) ? '&amp;p=' :  '?p=') . $view->postid .
							'#post' . $view->postid;
						$view->post_url = $post_url;
					}
				}

				$view->comment_count = $this->content->getReplyCount();
				$join_char = strpos($view->page_url,'?') ? '&amp;' : '?';
				$view->newcomment_url = $view->page_url . "#new_comment";
				$view->authorid = ($this->content->getUserId());
				$view->authorname = ($this->content->getUsername());
				$view->viewcount = ($this->content->getViewCount());
				$view->replycount = ($this->content->getReplyCount());
				$view->can_edit = ($this->content->canEdit() OR $this->content->canPublish()) ? 1 : 0;
				$view->parentid = $this->content->getParentId();

				// facebook options
				if (is_facebookenabled())
				{
					// display the like button for this article?
					$view->fblikebutton = construct_fblikebutton();
				}

				//check to see if there is an associated thread.
				if ($associatedthreadid = $this->content->getAssociatedThreadId()
					and $this->content->getComments_Enabled())
				{
					$comment_block = new vBCms_Comments();
					$view->comment_block = $comment_block->getPageView($this->content->getNodeId(),
						$view->page_url);
				}
			}
			else if (self::VIEW_PREVIEW == $viewtype)
			{
				if ($showpreviewonly)
				{
					$view->previewtext = $this->content->getPreviewText();
					$view->preview_chopped = 1;
				}
				else
				{
					$view->previewtext = $view->pagetext;

					if (count($view->pagelist) > 1)
					{
						$view->preview_chopped = 1;
					}
				}

				$segments = array('node' => $this->content->getNodeId() . '-' . $this->content->getUrl(), 'action' =>'edit');
				$view->edit_url =  vBCms_Route_Content::getURL($segments) ;
				$view->read_more_phrase = new vB_Phrase('vbcms', 'read_more');
				$view->parenttitle = $this->content->getParentTitle();
				$view->pagetext = $pagetext;
				$view->setpublish = $view->published = $this->content->getPublished();
				$view->publishdate = $this->content->getPublishDateLocal();
				$view->promoted_blogid = $this->content->getBlogId();
				$view->comment_count = $this->content->getReplyCount();
				$join_char = strpos($view->page_url,'?') ? '&amp;' : '?';
				$view->newcomment_url = $view->page_url . "#new_comment";
				$view->authorid = ($this->content->getUserId());
				$view->authorname = ($this->content->getUsername());
				$view->viewcount = ($this->content->getViewCount());
				$view->replycount = ($this->content->getReplyCount());
				$view->postid = ($this->content->getPostId());
				$view->blogpostid = $this->content->getBlogPostId();
				$view->can_edit = ($this->content->canEdit() OR $this->content->canPublish()) ? 1 : 0;
				$view->parentid = $this->content->getParentId();
				$view->post_started = $this->content->getPostStarted();
				$view->post_posted = $this->content->getPostPosted();


				//We need to check rights. If this user doesn't have download rights we hide the image.
				if ($this->content->canDownload())
				{
					if ($view->previewimage= $this->content->getPreviewImage())
					{
						$view->imagewidth= $this->content->getImageWidth();
						$view->imageheight= $this->content->getImageHeight();
					}

					if ($view->previewvideo= $this->content->getPreviewVideo())
					{
						$view->haspreviewvideo = true;
					}
				}
				else
				{
					$view->previewimage = false;
					$view->previewvideo = false;
				}

				if (($associatedthreadid = $this->content->getAssociatedThreadId())
					AND $this->content->getComments_Enabled() AND intval($this->content->getReplyCount()) > 0)
				{
					$view->echo_comments = 1;
					$view->comment_count = $this->content->getReplyCount();
				}
				else
				{
					$view->echo_comments = 0;
					$view->comment_count = 0;
				}
			}
		}

		//If this was promoted from a blog or post, we need to verify the permissions.
		if (intval($view->blogpostid))
		{
			$view->can_view_post =
				(!($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers'])) ?
				0 : 1 ;
		}
		else if (intval($view->postid))
		{
			$user = new vB_Legacy_CurrentUser();
			if ($post = vB_Legacy_Post::create_from_id($view->postid))
			{
				$view->can_view_post = $post->can_view($user) ? 1 : 0;
			}
		}

		$view->poststarter = array('userid' => $this->content->getPostStarter(),
			'username' => $this->content->getPostAuthor());
		$view->setpublish = $this->content->getSetPublish();
		$view->publishdate = $this->content->getPublishDate();
		$view->published = $this->content->getPublished() ?
			1 : 0;

		$view->publishdatelocal = vbdate(vB::$vbulletin->options['dateformat'], $this->content->getPublishDate());
		$view->publishtimelocal = vbdate( vB::$vbulletin->options['timeformat'], $this->content->getPublishDate() );

		//Get links to the author, section, and categories search pages
		//categories- this comes as an array
		$view->categories = $this->content->getCategories();
		$route_info = 'author/' . $this->content->getUserid() .
			($this->content->getUsername() != '' ? '-' . str_replace(' ', '-',
				vB_Search_Searchtools::stripHtmlTags($this->content->getUsername())) : '');
		$view->author_url = vB_Route::create('vBCms_Route_List', "$route_info/1")->getCurrentURL();

		// prepare the member action drop-down menu
		$view->memberaction_dropdown = construct_memberaction_dropdown(fetch_userinfo($this->content->getUserId()));

		//Section
		$route_info = 'section/' .$this->content->getParentId() .
			($this->content->getParentURLSegment() != '' ? '-' . str_replace(' ', '-',
				vB_Search_Searchtools::stripHtmlTags($this->content->getParentURLSegment())) : '');
		$view->section_list_url = vB_Route::create('vBCms_Route_List', "$route_info")->getCurrentURL();
		//and the content
		$route_info = $this->content->getParentId() .
			($this->content->getParentURLSegment() != '' ? '-' . str_replace(' ', '-',
				vB_Search_Searchtools::stripHtmlTags($this->content->getParentURLSegment())) : '');
		$view->section_url = vB_Route::create('vBCms_Route_Content', $route_info)->getCurrentURL();

		$view->html_title = $this->content->getHtmlTitle();
		$view->title = $this->content->getTitle();
		$view->contenttypeid = vB_Types::instance()->getContentTypeID("vBCms_Article");
		$view->dateformat = vB::$vbulletin->options['dateformat'];
		$view->showrating = $this->content->getShowRating();
		($hook = vBulletinHook::fetch_hook('vbcms_article_populate_end')) ? eval($hook) : false;
		$this->content->cacheNow();
		return $view;
	}
コード例 #18
0
ファイル: visitormessage.php プロジェクト: 0hyeah/yurivn
 /**
  * vBForum_Search_Type_VisitorMessage::listUi()
  * This function composes the html to display the user interface for this
  * search type
  *
  * @param mixed $prefs : the array of user preferences
  * @param mixed $contenttypeid : the content type for which we are going to
  *    search
  * @param array registers : any additional elements to be registered. These are
  * 	just passed to the template
  * @param string $template_name : name of the template to use for display. We have
  *		a default template.
  * @param boolean $groupable : a flag to tell whether the interface should display
  * 	grouping option(s).
  * @return $html: complete html for the search elements
  */
 public function listUi($prefs = null, $contenttypeid = null, $registers = null, $template_name = null)
 {
     global $vbulletin, $vbphrase;
     if (!isset($template_name)) {
         $template_name = 'search_input_visitormessage';
     }
     if (!isset($contenttypeid)) {
         $contenttypeid = vB_Search_Core::get_instance()->get_contenttypeid('vBForum', 'VisitorMessage');
     }
     $template = vB_Template::create($template_name);
     $template->register('securitytoken', $vbulletin->userinfo['securitytoken']);
     $template->register('class', $this->get_display_name());
     $template->register('contenttypeid', $contenttypeid);
     $prefsettings = array('select' => array('searchdate', 'beforeafter', 'starteronly', 'sortby'), 'cb' => array('nocache', 'exactname'), 'value' => array('query', 'searchuser'));
     $this->setPrefs($template, $prefs, $prefsettings);
     vB_Search_Searchtools::searchIntroRegisterHumanVerify($template);
     if (isset($registers) and is_array($registers)) {
         foreach ($registers as $key => $value) {
             $template->register($key, htmlspecialchars_uni($value));
         }
     }
     ($hook = vBulletinHook::fetch_hook('search_listui_complete')) ? eval($hook) : false;
     return $template->render();
 }
コード例 #19
0
ファイル: recentcontent.php プロジェクト: hungnv0789/vhtm
	/** This function gets the article information based on the defined criteria
	*
	 * @return	array
	 */
	protected function getContent()
	{
		// First, compose the sql
		$sql = "SELECT node.contenttypeid, node.url, node.publishdate, node.userid,
		node.setpublish, node.publicpreview, info.title, user.username, node.showuser,
		node.nodeid, node.contenttypeid, thread.replycount FROM "
		. TABLE_PREFIX . "cms_node AS node
		INNER JOIN "	. TABLE_PREFIX . "contenttype AS type on type.contenttypeid = node.contenttypeid
		INNER JOIN "	. TABLE_PREFIX . "cms_nodeinfo AS info on info.nodeid = node.nodeid "
		. ( (($this->config['categories'] != '') AND ($this->config['categories'] != '0')) ?
			" INNER JOIN " . TABLE_PREFIX .
		"cms_nodecategory nc ON nc.nodeid = node.nodeid " : '') .	"
		LEFT JOIN "	. TABLE_PREFIX . "user AS user ON user.userid = node.userid
		LEFT JOIN "	. TABLE_PREFIX . "thread AS thread ON thread.threadid = info.associatedthreadid
		WHERE type.isaggregator = '0' AND " . vBCMS_Permissions::getPermissionString() ;
	
		if (($this->config['categories'] != '') AND ($this->config['categories'] != '0') )
		{
			$sql .= "\n AND nc.categoryid IN (" . $this->config['categories'] . ")\n";
		}

		if (($this->config['sections'] != '') AND ($this->config['sections'] != '0'))
		{

			$sql .= "\n AND node.parentnode IN (" . $this->config['sections'] . ")\n";
		}

		if (isset($this->config['days']) AND (intval($this->config['days'])) )
		{
			$sql .= "\n AND node.publishdate > " . (TIMENOW - (86400 * $this->config['days'])) . "\n";
		}

		$sql .= "\n ORDER BY node.publishdate DESC LIMIT " . $this->config['count'];
		$items = array();
	
		//Execute
		if ($rst = vB::$db->query_read($sql))
		{
			$current_record = array('contentid' => -1);
			//now build the results array
			while($item = vB::$db->fetch_array($rst))
			{
				$item['categories'] = array();
				$item['tags'] = array();
				$class = vB_Types::instance()->getContentTypeClass($item['contenttypeid']);
				$package = vB_Types::instance()->getContentTypePackage($item['contenttypeid']);
				$node = vBCms_Content::create($package, $class, $item['nodeid']);
				$item['pagetext'] = $item['previewtext'] = '';
					
				//get the avatar
				if (vB::$vbulletin->options['avatarenabled'])
				{
					$item['avatar'] = fetch_avatar_url($item['userid']);
				}
				
				if (method_exists($node, 'getPageText'))
				{
					$item['pagetext'] = fetch_censored_text($node->getPageText());
				}
				
				if (method_exists($node, 'getPreviewText'))
				{
					$item['previewtext'] = fetch_censored_text($node->getPreviewText());
				}
				else if (!empty($item['pagetext']))
				{
					$item['previewtext'] = vB_Search_Searchtools::getSummary($item['pagetext'], 200);
				}
				
				if (method_exists($node, 'getPreviewImage'))
				{
					$item['pagetext'] = fetch_censored_text($node->getPageText());
				}
								
				$items[$item['nodeid']]  = $item;
			}

			//Let's get the tags and the categories
			// we can do that with one query each.
			if (count($articles))
			{
				//first let's get categories
				$nodeids = implode(', ', array_keys($item));
				$sql = "SELECT nc.nodeid, nc.categoryid, category.category FROM " . TABLE_PREFIX . "cms_nodecategory AS nc
				INNER JOIN "	. TABLE_PREFIX . "cms_category AS category ON category.categoryid = nc.categoryid
				WHERE nc.nodeid IN ($nodeids)";
				if ($rst = vB::$db->query_read($sql))
				{
					while ($record = vB::$db->fetch_array($rst))
					{
						$route_info = $record['categoryid'] .
							($record['category'] != '' ? '-' . str_replace(' ', '-', $record['category']) : '');
						$record['route_info'] = $route_info;
						$record['category_url'] = vB_Route::create('vBCms_Route_List', "category/" . $record['route_info'] . "/1")->getCurrentURL();

						$items[$record['nodeid']]['categories'][$record['categoryid']] = $record;
					}
				}

				//next tags;
				$sql = "SELECT tag.tagid, node.nodeid, tag.tagtext FROM " .
				TABLE_PREFIX . "cms_node AS node INNER JOIN " .	TABLE_PREFIX .
				"tagcontent AS tc ON (tc.contentid = node.contentid AND  tc.contenttypeid = node.contenttypeid)
				INNER JOIN " .	TABLE_PREFIX .
				"tag AS tag ON tag.tagid = tc.tagid
				 WHERE node.nodeid IN ($nodeids) ";
				if ($rst = vB::$db->query_read($sql))
				{
					while ($record = vB::$db->fetch_array($rst))
					{
						$items[$record['nodeid']]['tags'][$record['tagid']] = $record['tagtext'];
					}
				}
			}
		}
		return $items;
	}
コード例 #20
0
ファイル: recentcmscomments.php プロジェクト: hungnv0789/vhtm
	function addVariables($this_post)
	{
		$post = array();
		$thread = $this_post->get_thread();
		$forum = $thread->get_forum();
		$post['post_statusicon'] = 'new';
		$post['post_statustitle'] = $vbphrase['unread'];
		$post['postid'] = $this_post->get_field('postid');
		$post['postdateline'] = $this_post->get_field('dateline');
		$post['posttitle'] = htmlspecialchars_decode(vB_Search_Searchtools::stripHtmlTags($this_post->get_display_title()));
		$post['pagetext'] = nl2br($this_post->get_summary(100));
		$post['visible'] = $this_post->get_field('visible');
		$post['attach'] = $this_post->get_field('attach');

		$post['username'] = $this_post->get_field('userid') == 0 ?
			$this_post->get_field('username') : $this_post->get_user()->get_field('username');
		$post['userid'] = $this_post->get_field('userid');

		$post['threadid'] = $thread->get_field('threadid');
		$post['threadtitle'] = $thread->get_field('title');
		$post['threadiconid'] = $thread->get_field('iconid');
		$post['replycount'] = $thread->get_field('replycount');
		$post['views'] = $thread->get_field('views') > 0 ?
			$thread->get_field('views') : $thread->get_field('replycount') + 1;
		$post['firstpostid'] = $thread->get_field('firstpostid');
		$post['prefixid'] = $thread->get_field('prefixid');
		$post['taglist'] = $thread->get_field('taglist');
		$post['pollid'] = $thread->get_field('pollid');
		$post['sticky'] = $thread->get_field('sticky');
		$post['open'] = $thread->get_field('open');
		$post['lastpost'] = $thread->get_field('lastpost');
		$post['forumid'] = $thread->get_field('forumid');
		$post['thread_visible'] = $thread->get_field('visible');

		$post['forumtitle'] = $forum->get_field('title');

		$post['posticonid'] = $this_post->get_field('iconid');
		$post['allowicons'] = $forum->allow_icons();
		$post['posticonpath'] = $this_post->get_icon_path();
		$post['posticontitle'] = $this_post->get_icon_title();
		$post['posticon'] = $post ['allowicons'] and $post ['posticonpath'];
		$show['deleted'] = false;
		$post['prefixid'] = $thread->get_field('prefixid');
		return $post;

	}
コード例 #21
0
ファイル: misc.php プロジェクト: hungnv0789/vhtm
	print_form_header('misc', 'lostusers');
	print_table_header($vbphrase['fix_broken_user_profiles']);
	print_description_row($vbphrase['finds_users_without_complete_entries']);
	print_submit_row($vbphrase['fix_broken_user_profiles']);

	print_form_header('misc', 'doindextypes');
	print_table_header($vbphrase['rebuild_search_index'], 2, 0);
	print_description_row(construct_phrase($vbphrase['note_reindexing_empty_indexes_x'], $vbulletin->session->vars['sessionurl']));

	// Get the current types
	require_once(DIR . '/vb/search/core.php');
	$indexer = vB_Search_Core::get_instance();

	//don't use array_merge, it will (incorrectly) assume that the keys are index values
	//instead of meaningful numeric keys and renumber them.
	$types = array ( 0 => $vbphrase['all']) + vB_Search_Searchtools::get_type_options();

	print_select_row($vbphrase['search_content_type_to_index'], 'indextypes', $types);
	print_input_row($vbphrase['search_items_batch'], 'perpage', 250);
	print_input_row($vbphrase['search_start_item_id'], 'startat', 0);
	print_input_row($vbphrase['search_items_to_process'], 'doprocess', 0);
	print_yes_no_row($vbphrase['include_automatic_javascript_redirect'], 'autoredirect', 1);
	print_description_row($vbphrase['note_server_intensive']);
	print_submit_row($vbphrase['rebuild_search_index']);

	if ($vbulletin->options['cachemaxage'] > 0)
	{
		print_form_header('misc', 'buildpostcache');
		print_table_header($vbphrase['rebuild_post_cache']);
		print_input_row($vbphrase['number_of_posts_to_process_per_cycle'], 'perpage', 1000);
		print_submit_row($vbphrase['rebuild_post_cache']);
コード例 #22
0
ファイル: post.php プロジェクト: 0hyeah/yurivn
 public function render($current_user, $criteria, $template_name = '')
 {
     global $vbulletin, $vbphrase, $show;
     require_once DIR . '/includes/functions_forumdisplay.php';
     require_once DIR . '/includes/functions_misc.php';
     require_once DIR . '/includes/functions_user.php';
     fetch_phrase_group('search');
     if (!strlen($template_name)) {
         $template_name = 'search_results_postbit';
     }
     /*
     	Post is not a good name for this array, however its what it used to be called
     	(when it wasn't such a bad name) and changing it makes it certain that a lot of
     	hooks are going to break.
     */
     $post = array();
     $thread = $this->post->get_thread();
     $forum = $thread->get_forum();
     $this->set_replydata($this->post->get_field('threadid'), $this->post->get_field('postid'), $current_user);
     if ($this->replydata['mylastpost'] > 0) {
         $post_statusicon[] = 'dot';
     }
     if (!$thread->get_field('open')) {
         $post_statusicon[] = 'lock';
     }
     if ($this->replydata['lastread'] < $thread->get_field('lastpost')) {
         $post_statusicon[] = 'new';
     }
     if (!count($post_statusicon)) {
         $post_statusicon[] = 'old';
     }
     $post_statusicon = implode('_', $post_statusicon);
     $post['postid'] = $this->post->get_field('postid');
     $post['postdateline'] = $this->post->get_field('dateline');
     $post['posttitle'] = vB_Search_Searchtools::stripHtmlTags(htmlspecialchars_decode($this->post->get_display_title()));
     if (empty($post['posttitle'])) {
         $post['posttitle'] = $vbphrase['view_post'];
     }
     $post['visible'] = $this->post->get_field('visible');
     $post['attach'] = $this->post->get_field('attach');
     $post['highlight'] = $criteria->get_highlights();
     $post['userid'] = $this->post->get_field('userid');
     $post['username'] = $this->post->get_field('username');
     $post['threadid'] = $thread->get_field('threadid');
     $post['threadtitle'] = $thread->get_field('title');
     $post['threadiconid'] = $thread->get_field('iconid');
     $post['replycount'] = $thread->get_field('replycount');
     $post['views'] = $thread->get_field('views') > 0 ? $thread->get_field('views') : $thread->get_field('replycount') + 1;
     $post['firstpostid'] = $thread->get_field('firstpostid');
     $post['prefixid'] = $thread->get_field('prefixid');
     $post['taglist'] = $thread->get_field('taglist');
     $post['pollid'] = $thread->get_field('pollid');
     $post['sticky'] = $thread->get_field('sticky');
     $post['open'] = $thread->get_field('open');
     $post['lastpost'] = $thread->get_field('lastpost');
     $post['forumid'] = $thread->get_field('forumid');
     $post['thread_visible'] = $thread->get_field('visible');
     $post['forumtitle'] = $forum->get_field('title');
     $post['posticonid'] = $this->post->get_field('iconid');
     $post['allowicons'] = $forum->allow_icons();
     $post['posticonpath'] = $this->post->get_icon_path();
     $post['posticontitle'] = $this->post->get_icon_title();
     $post['posticon'] = $post['allowicons'] and $post['posticonpath'];
     $lastread = $forum->get_last_read_by_current_user($current_user);
     if ($current_user->hasForumPermission($forum->get_field('forumid'), 'canviewthreads')) {
         if (defined('VB_API') and VB_API === true) {
             $post['pagetext'] = $this->post->get_field('pagetext');
             $post['message_plain'] = build_message_plain($post['pagetext']);
         } else {
             $post['pagetext'] = nl2br($this->post->get_summary(200));
         }
     }
     $show['deleted'] = false;
     if ($current_user->isModerator()) {
         $log = $this->post->get_deletion_log_array();
         if ($log['userid']) {
             $post['del_phrase'] = $vbphrase['message_deleted_by_x'];
         } else {
             $log = $thread->get_deletion_log_array();
             if (!$log['userid']) {
                 $post['del_phrase'] = $vbphrase['thread_deleted_by_x'];
                 $log = false;
             }
         }
         if ($log) {
             $post['del_username'] = $log['username'];
             $post['del_userid'] = $log['userid'];
             $post['del_reason'] = $log['reason'];
             $show['deleted'] = true;
         }
     }
     $post['prefixid'] = $thread->get_field('prefixid');
     if ($post['prefixid']) {
         $post['prefix_plain_html'] = htmlspecialchars_uni($vbphrase["prefix_{$post['prefixid']}_title_plain"]);
         $post['prefix_rich'] = $vbphrase["prefix_{$post['prefixid']}_title_rich"];
     } else {
         $post['prefix_plain_html'] = '';
         $post['prefix_rich'] = '';
     }
     $show['disabled'] = !$this->can_inline_mod($current_user);
     $postuser = $this->post->get_record();
     $post = process_thread_array($post, $lastread, $post['allowicons']);
     ($hook = vBulletinHook::fetch_hook('search_results_postbit')) ? eval($hook) : false;
     $template = vB_Template::create($template_name);
     $template->register('post', $post);
     $template->register('userinfo', $postuser);
     $template->register('threadinfo', $thread->get_record());
     $template->register('dateline', $this->post->get_field('dateline'));
     if ($vbulletin->options['avatarenabled']) {
         $template->register('avatar', fetch_avatar_from_record($this->post->get_record(), true));
     }
     $pageinfo_thread = array();
     $pageinfo_post = array('p' => $post['postid']);
     if (!empty($post['highlight'])) {
         $pageinfo_post['highlight'] = urlencode(implode(' ', $post['highlight']));
         $pageinfo_thread['highlight'] = urlencode(implode(' ', $post['highlight']));
     }
     $template->register('pageinfo_post', $pageinfo_post);
     $template->register('pageinfo_thread', $pageinfo_thread);
     $template->register('post_statusicon', $post_statusicon);
     return $template->render();
 }
コード例 #23
0
ファイル: type.php プロジェクト: hungnv0789/vhtm
	/**
	 * vB_Search_Type::makeSearch()
	 * If we have a new search type this will create a search interface for it.
	 * This assumes we have written search and index controllers
	 *
	 * @param mixed $prefs : the array of user preferences
	 * @param mixed $contenttypeid : the content type for which we are going to
	 *    search
	 * @param array registers : any additional elements to be registered. These are
	 * 	just passed to the template
	 * @param string $template_name : name of the template to use for display. We have
	 *		a default template.
	 * @param boolean $groupable : a flag to tell whether the interface should display
	 * 	grouping option(s).
	 * @return the html for the user interfacae
	 */
	public function listUi($prefs = null, $contenttypeid = null, $registers = null, $template_name = null)
	{
		global $vbulletin, $vbphrase;

		if (is_null($contenttypeid))
		{
			$contenttypeid = vb_Search_Core::get_instance()->get_contenttypeid('vBForum', 'Post');
		}

		if (isset($template_name))
		{
			$template = vB_Template::create($template_name);
		}
		else if ($this->can_group())
		{
			$template = vB_Template::create('search_input_default_groupable');
		}
		else
		{
			$template = vB_Template::create('search_input_default');
		}

		$template->register('securitytoken', $vbulletin->userinfo['securitytoken']);
		$template->register('class', $this->class);
		$template->register('contenttypeid', $this->get_contenttypeid());

		$prefsettings = array(
			'select'=> array('searchdate', 'beforeafter', 'starteronly', 'sortby',
				'titleonly', 'order'),
			'cb' => array('nocache', 'exactname'),
		 	'value' => array('query', 'searchuser', 'tag'));

		$this->setPrefs($template, $prefs, $prefsettings);
		vB_Search_Searchtools::searchIntroRegisterHumanVerify($template);

		if (isset($registers) and is_array($registers) )
		{
			foreach($registers as $key => $value)
			{
				$template->register($key, htmlspecialchars_uni($value));
			}
		}
		return $template->render();
	}
コード例 #24
0
ファイル: blogcomment.php プロジェクト: hungnv0789/vhtm
	public function listUi($prefs)
	{
		$phrase = new vB_Legacy_Phrase();
		$phrase->add_phrase_groups(array('vbblogglobal', 'vbblogcat'));

		global $vbulletin;
		$template = vB_Template::create('search_input_blogcomment');
		$template->register('securitytoken', $vbulletin->userinfo['securitytoken']);
		$template->register('contenttypeid', $this->get_contenttypeid());

		$prefsettings = array(
			'select'=> array('searchdate', 'beforeafter', 'sortby',
				'titleonly', 'sortorder', 'starteronly'),
			'cb' => array('nocache', 'exactname'),
		 	'value' => array('query', 'searchuser')
		);

		$this->setPrefs($template, $prefs, $prefsettings);
		vB_Search_Searchtools::searchIntroRegisterHumanVerify($template);
		return $template->render();	}