コード例 #1
0
ファイル: bbcode.php プロジェクト: benyamin20/vbregistration
        $parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
        $parsed_code = $parser->do_parse($bbcode['bbcodeexample'], false, false, true, false, true);
        echo $parsed_code;
    }
}
// ####################################### MODIFY #####################################
if ($_REQUEST['do'] == 'modify') {
    $parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    $bbcodes = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "bbcode");
    print_form_header('bbcode', 'add');
    print_table_header($vbphrase['bb_code_manager'], 6);
    print_cells_row(array($vbphrase['title'], $vbphrase['bb_code'], $vbphrase['html'], $vbphrase['replacement'], $vbphrase['button_image'], $vbphrase['controls']), 1, '', -5);
    while ($bbcode = $db->fetch_array($bbcodes)) {
        $class = fetch_row_bgclass();
        $altclass = iif($class == 'alt1', 'alt2', 'alt1');
        $parsed_code = $parser->do_parse($bbcode['bbcodeexample'], false, false, true, false, true);
        $cell = array("<b>{$bbcode['title']}</b>", "<div class=\"{$altclass}\" style=\"padding:2px; border:solid 1px; width:200px; height:75px; overflow:auto\"><span class=\"smallfont\">" . htmlspecialchars_uni($bbcode['bbcodeexample']) . '</span></div>', "<div class=\"{$altclass}\" style=\"padding:2px; border:solid 1px; width:200px; height:75px; overflow:auto\"><span class=\"smallfont\">" . htmlspecialchars_uni($parsed_code) . '</span></div>', '<iframe src="bbcode.php?do=previewbbcode&amp;bbcodeid=' . $bbcode['bbcodeid'] . '" style="width:200px; height:75px;"></iframe>');
        if ($bbcode['buttonimage']) {
            $src = $bbcode['buttonimage'];
            if (!preg_match('#^[a-z]+://#i', $src) and $src[0] != '/') {
                $src = "../{$src}";
            }
            $cell[] = "<img style=\"background:buttonface; border:solid 1px highlight\" src=\"{$src}\" alt=\"\" />";
        } else {
            $cell[] = $vbphrase['n_a'];
        }
        $cell[] = construct_link_code($vbphrase['edit'], "bbcode.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&amp;bbcodeid={$bbcode['bbcodeid']}") . construct_link_code($vbphrase['delete'], "bbcode.php?" . $vbulletin->session->vars['sessionurl'] . "do=remove&amp;bbcodeid={$bbcode['bbcodeid']}");
        print_cells_row($cell, 0, $class, -4);
    }
    print_submit_row($vbphrase['add_new_bb_code'], false, 6);
    if (empty($donetest)) {
コード例 #2
0
ファイル: html.php プロジェクト: hungnv0789/vhtm
	/**
	* Parse the string with the selected options
	*
	* @param	string	Unparsed text
	* @param	bool	Whether to allow HTML (true) or not (false)
	* @param	string	HTML State
	*
	* @return	string	Parsed text
	*/
	public function do_parse($pagetext, $do_html = false, $htmlstate = null)
	{
		return parent::do_parse($pagetext, $do_html, true, true, $this->candownload, true, false, $htmlstate);
	}
コード例 #3
0
 /**
  * Parse the string with the selected options
  *
  * @param	string	Unparsed text
  * @param	bool	Whether to allow HTML (true) or not (false)
  *
  * @return	string	Parsed text
  */
 function do_parse($text, $do_html = false, $do_smilies = true, $do_bbcode = true, $do_imgcode = true, $do_nl2br = true, $cachable = false, $htmlstate = null, $minimal = false)
 {
     return parent::do_parse($text, true, false, true, true, false, false, null, true);
 }
コード例 #4
0
ファイル: misc.php プロジェクト: benyamin20/vbregistration
 $show['bbcodecolor'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_COLOR ? true : false;
 $show['bbcodesize'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_SIZE ? true : false;
 $show['bbcodefont'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_FONT ? true : false;
 $show['bbcodealign'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_ALIGN ? true : false;
 $show['bbcodelist'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_LIST ? true : false;
 $show['bbcodeurl'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_URL ? true : false;
 $show['bbcodecode'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_CODE ? true : false;
 $show['bbcodephp'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_PHP ? true : false;
 $show['bbcodehtml'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_HTML ? true : false;
 $show['bbcodesigpic'] = $permissions['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['cansigpic'] ? true : false;
 $template['bbcodebits'] = '';
 $specialbbcode[] = array();
 $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
 $bbcodes = $db->query_read_slave("SELECT * FROM " . TABLE_PREFIX . "bbcode ORDER BY bbcodetag, twoparams");
 while ($bbcode = $db->fetch_array($bbcodes)) {
     $bbcode['output'] = $bbcode_parser->do_parse($bbcode['bbcodeexample'], false, false, true, false, true);
     $bbcode['bbcodeexample'] = htmlspecialchars_uni($bbcode['bbcodeexample']);
     if ($bbcode['twoparams']) {
         $bbcode['tag'] = '[' . $bbcode['bbcodetag'] . '=<span class="highlight">' . $vbphrase['option'] . '</span>]<span class="highlight">' . $vbphrase['value'] . '</span>[/' . $bbcode['bbcodetag'] . ']';
     } else {
         $bbcode['tag'] = '[' . $bbcode['bbcodetag'] . ']<span class="highlight">' . $vbphrase['value'] . '</span>[/' . $bbcode['bbcodetag'] . ']';
     }
     ($hook = vBulletinHook::fetch_hook('misc_bbcode_bit')) ? eval($hook) : false;
     eval('$template[\'bbcodebits\'] .= "' . fetch_template('help_bbcodes_bbcode') . '";');
     eval('$template[\'bbcodelinks\'] .= "' . fetch_template('help_bbcodes_link') . '";');
 }
 $navbits = construct_navbits(array('faq.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['faq'], '' => $vbphrase['bbcode_list']));
 $show['iewidthfix'] = (is_browser('ie') and !is_browser('ie', 6));
 $stylevar['codeblockwidth'] = 'auto';
 $vbulletin->options['allowhtml'] = false;
 $vbulletin->options['allowbbcode'] = true;
コード例 #5
0
ファイル: recentposts.php プロジェクト: hungnv0789/vhtm
	/**
	 * Fetches the array of posts
	 *
	 * @return array				- the post information
	 */
	private function getPosts()
	{
		require_once DIR . "/includes/functions_user.php";
		require_once DIR . "/includes/class_bbcode.php";
		$datecut = TIMENOW - ($this->config['days'] * 86400);

		if (empty(vB::$vbulletin->userinfo['forumpermissions']))
		{
			require_once DIR . "/includes/functions.php";
			cache_permissions($userinfo);
		}
		$postarray = array();
		//we have some existing settings with config['forumchoice'] set to 0=> ''; That's no good
		if (empty($this->config['forumchoice']))
		{
			$this->config['forumchoice'] = array();
		}
		else if (is_array($this->config['forumchoice']) AND ($this->config['forumchoice'][0] == '') )
		{
			unset($this->config['forumchoice'][0]);
		}

		if (is_array($this->config['forumchoice']) AND in_array('subscribed', $this->config['forumchoice']))
		{
			$subscribejoin = " LEFT JOIN " . TABLE_PREFIX .	"subscribeforum AS subscribeforum
				ON (subscribeforum.forumid = forum.forumid AND subscribeforum.userid = " . vB::$vbulletin->userinfo['userid'] .
			" ) ";
		}
		else
		{
			$subscribejoin = '';

		}
		$forumids = array_keys(vB::$vbulletin->forumcache);
		foreach ($forumids AS $forumid)
		{
			$forumperms =& vB::$vbulletin->userinfo['forumpermissions']["$forumid"];
			if ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canview']
				AND ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewothers'])
				AND (($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads']))
				AND verify_forum_password($forumid, vB::$vbulletin->forumcache["$forumid"]['password'], false)
				)
			{
					//Don't include the comments forum.
				if (vB::$vbulletin->options['vbcmsforumid'] AND (intval(vB::$vbulletin->options['vbcmsforumid']) == intval($forumid)))
				{
					continue;
				}
				//Or, if the user selected forums, anything not on the list.
				else if (! empty($this->config['forumchoice']) AND !in_array($forumid, $this->config['forumchoice']))
				{
					continue;
				}
				$forumchoice[] = $forumid;
			}
		}

		if (!empty($forumchoice) )
		{
			$forumsql = " AND (" . (empty($subscribejoin) ? '' : "subscribeforum.forumid IS NOT NULL OR ") . " thread.forumid IN(" . implode(',', $forumchoice) . ")";
			$associatedthread = (vB::$vbulletin->options['vbcmsforumid'] ?
					" AND (thread.forumid <> " . vB::$vbulletin->options['vbcmsforumid'] . ") )" : '');
		}
		else if (! empty($subscribejoin))
		{
			$forumsql = " AND subscribeforum.forumid IS NOT NULL ";
		}
		else
		{
			return $postarray;
		}

		$posts = vB::$vbulletin->db->query_read_slave($sql = "
			SELECT post.dateline, post.pagetext, post.allowsmilie, post.postid,
				thread.threadid, thread.title, thread.prefixid, post.attach, thread.replycount,
				forum.forumid, post.title AS posttitle, post.dateline AS postdateline,
				user.userid, user.username
				" . (vB::$vbulletin->options['avatarenabled'] ? ",avatar.avatarpath,
				(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,
				customavatar.width AS avwidth,customavatar.height AS avheight" : "") .
		 "	FROM " . TABLE_PREFIX . "post AS post
			JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)
			JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
			LEFT JOIN " . TABLE_PREFIX . "user AS user ON (post.userid = user.userid)
			" . (vB::$vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "
			$subscribejoin
			WHERE 1=1
				$forumsql
				$associatedthread
				AND thread.visible = 1
				AND post.visible = 1
				AND thread.open <> 10
				AND post.dateline > $datecut
				$globalignore
				" . ($this->userinfo['ignorelist'] ? "AND post.userid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")": '') . "
			ORDER BY post.dateline DESC
			LIMIT 0," . intval($this->config['count']) . "
		");

		$parser = new vB_BbCodeParser(vB::$vbulletin, fetch_tag_list());
		$optionval = vB::$vbulletin->bf_misc_forumoptions['allowhtml'];
		while ($post = vB::$vbulletin->db->fetch_array($posts))
		{
			$post['title'] = fetch_trimmed_title($post['title'], $this->config['newposts_titlemaxchars']);

			$allow_html = ((vB::$vbulletin->forumcache[$post['forumid']]['options'] & $optionval) AND $this->config['allow_html'] ? 1 : 0);
			$post['previewtext'] = fetch_censored_text($parser->get_preview($post['pagetext'], $this->default_previewlen, $allow_html));
			$post['pagetext'] = fetch_censored_text($parser->do_parse($post['pagetext'], $allow_html));

			$post['url'] = fetch_seo_url('thread', $post, array('p' => $post['postid'])) . '#post' . $post['postid'];
			$post['newposturl'] = fetch_seo_url('thread', $post, array('goto' => 'newpost'));
			$post['date'] = vbdate(vB::$vbulletin->options['dateformat'], $post['dateline'], true);
			$post['time'] = vbdate(vB::$vbulletin->options['timeformat'], $post['dateline']);

			if (intval($post['userid']) AND vB::$vbulletin->options['avatarenabled'])
			{
				$avatar = fetch_avatar_from_record($post);
			}
			else
			{
				$avatar = false;
			}

			$post['avatarurl'] = isset($avatar[0]) ? $avatar[0] : false;
			unset($avatar);
			$postarray[$post['postid']] = $post;
		}

		return $postarray;

	}
コード例 #6
0
 /**
  * Parse the string with the selected options
  *
  * @param	string	Unparsed text
  * @param	bool	Whether to allow HTML -- ignored, always true
  * @param	bool	Whether to parse smilies -- ignored, always false
  * @param	bool	Whether to parse BB code
  * @param	bool	Whether to parse the [img] BB code (independent of $do_bbcode)
  * @param	bool	Whether to run nl2br -- ignored, always false
  * @param	bool	Whether the post text is cachable -- ignored, always false
  *
  * @return	string	Parsed text
  */
 function do_parse($text, $do_html = false, $do_smilies = true, $do_bbcode = true, $do_imgcode = true, $do_nl2br = true, $cachable = false)
 {
     return parent::do_parse($text, $do_html, $do_smilies, $do_bbcode, false, $do_nl2br, $cachable);
 }
コード例 #7
0
ファイル: downloads.php プロジェクト: Kheros/MMOver
     }
 }
 if ($file['size'] == 0) {
     $file['size'] = $vbphrase['dl2_unknown_size'];
 } else {
     $file['size'] = vb_number_format($file['size'], 0, true);
 }
 $file['totaldownloads'] = vb_number_format($file['totaldownloads']);
 if ($file['link']) {
     $show['newwindow'] = true;
 } else {
     $show['newwindow'] = $file['newwindow'] ? true : false;
 }
 require_once DIR . '/includes/class_bbcode.php';
 $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
 $file['description'] = $bbcode_parser->do_parse($file['description'], false, true, true, true, true, $cachable);
 if ($vbulletin->options['dl2allowimages']) {
     $result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "dl2_images WHERE `file` = {$file['id']}");
     while ($image = $db->fetch_array($result)) {
         $show['controls'] = false;
         if ($permissions['downloads2permissions'] & $vbulletin->bf_ugp['downloads2permissions']['caneditallfiles'] or $permissions['downloads2permissions'] & $vbulletin->bf_ugp['downloads2permissions']['caneditownfiles'] and ($image['uploaderid'] == $vbulletin->userinfo['userid'] and $file['uploaderid'] == $vbulletin->userinfo['userid'])) {
             $show['controls'] = true;
         }
         $image['name'] = $dl->url . $image['name'];
         if (file_exists($dl->url . $image['thumb'])) {
             $image['thumb'] = $dl->url . $image['thumb'];
         } else {
             $image['thumb'] = false;
         }
         $templater = vB_Template::create('downloads2_file_imagebit');
         $templater->register('image', $image);
コード例 #8
0
ファイル: class_bbcode_alt.php プロジェクト: hungnv0789/vhtm
	/**
	* Parse the string with the selected options
	*
	* @param	string	Unparsed text
	* @param	bool	Whether to allow HTML (true) or not (false)
	*
	* @return	string	Parsed text
	*/
	function do_parse($text)
	{
		return parent::do_parse($text, true, false, true, true, false, false, null, true);
	}
コード例 #9
0
ファイル: class_bbcode_alt.php プロジェクト: 0hyeah/yurivn
 /**
  * Parse the string with the selected options
  *
  * @param	string	Unparsed text
  * @param	bool	Whether to allow HTML (true) or not (false)
  * @param	bool	Whether to parse smilies or not
  * @param	bool	Whether to parse BB code
  * @param	bool	Whether to parse the [img] BB code (independent of $do_bbcode)
  * @param	bool	Whether to automatically replace new lines with HTML line breaks
  * @param	bool	Whether the post text is cachable
  * @param	string	Switch for dealing with nl2br
  * @param	boolean	do minimal required actions to parse bbcode
  * @param	boolean	added for PHP 5.4 strict standards compliance
  *
  * @return	string	Parsed text
  */
 function do_parse($text, $do_html = true, $do_smilies = false, $do_bbcode = true, $do_imgcode = true, $do_nl2br = false, $cachable = false, $htmlstate = null, $minimal = true, $do_videocode = true)
 {
     return parent::do_parse($text, $do_html, $do_smilies, $do_bbcode, $do_imgcode, $do_nl2br, $cachable, $htmlstate, $minimal);
 }
コード例 #10
0
ファイル: recentthreads.php プロジェクト: hungnv0789/vhtm
	private function getThreads()
	{
		$datecut = TIMENOW - ($this->config['days'] * 86400);

		if (empty(vB::$vbulletin->userinfo['forumpermissions']))
		{
			require_once DIR . "/includes/functions.php";
			cache_permissions($userinfo);
		}

		switch (intval($this->config['threads_type']))
		{
			case 0:
				$ordersql = " thread.dateline DESC";
				$datecutoffsql = " AND thread.dateline > $datecut";
				break;
			case 1:
				$ordersql = " thread.lastpost DESC";
				$datecutoffsql = " AND thread.lastpost > $datecut";
				break;
			case 2:
				$ordersql = " thread.replycount DESC";
				$datecutoffsql = " AND thread.dateline > $datecut";
				break;
			case 3:
				$ordersql = " thread.views DESC";
				$datecutoffsql = " AND thread.dateline > $datecut";
				break;
		}

		//we have some existing settings with config['forumchoice'] set to 0=> ''; That's no good
		if (empty($this->config['forumchoice']))
		{
			$this->config['forumchoice'] = array();
		}
		else if (is_array($this->config['forumchoice']) AND ($this->config['forumchoice'][0] == '') )
		{
			unset($this->config['forumchoice'][0]);
		}
		$subscribejoin = '';

		if (in_array('subscribed', $this->config['forumchoice']))
		{
			$subscribejoin = " INNER JOIN " . TABLE_PREFIX .	"subscribeforum AS subscribeforum
				ON (subscribeforum.forumid = forum.forumid AND subscribeforum.userid = " . vB::$vbulletin->userinfo['userid'] .
			" ) ";
		}

		$forumsql = '';
		$forumids = array_keys(vB::$vbulletin->forumcache);
		$forumchoice = array();
		foreach ($forumids AS $forumid)
		{
			$forumperms =& vB::$vbulletin->userinfo['forumpermissions']["$forumid"];
			if ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canview']
				AND ($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewothers'])
				AND (($forumperms & vB::$vbulletin->bf_ugp_forumpermissions['canviewthreads']))
				AND verify_forum_password($forumid, vB::$vbulletin->forumcache["$forumid"]['password'], false)
				)
			{
				//Don't include the comments forum.
				if (vB::$vbulletin->options['vbcmsforumid'] AND (intval(vB::$vbulletin->options['vbcmsforumid']) == intval($forumid)))
				{
					continue;
				}
				//Or, if the user selected forums, anything not on the list.
				else if (! empty($this->config['forumchoice']) AND !in_array($forumid, $this->config['forumchoice']))
				{
					continue;
				}
				$forumchoice[] = $forumid;
			}
		}
		$threadarray = array();
		if (!empty($forumchoice) )
		{
			$forumsql = " AND (" . (empty($subscribejoin) ? '' : "subscribeforum.forumid IS NOT NULL OR ") .
				" thread.forumid IN(" . implode(',', $forumchoice) . ")";
			$associatedthread = (vB::$vbulletin->options['vbcmsforumid'] ?
					" AND (thread.forumid <> " . vB::$vbulletin->options['vbcmsforumid'] . ") )" : '');
		}
		else if (! empty($subscribejoin))
		{
			$forumsql = " AND subscribeforum.forumid IS NOT NULL ";
		}
		else
		{
			return $threadarray;
		}


		// remove threads from users on the global ignore list if user is not a moderator
		$globalignore = '';
		if (trim(vB::$vbulletin->options['globalignore']) != '')
		{
			require_once(DIR . '/includes/functions_bigthree.php');
			if ($Coventry = fetch_coventry('string'))
			{
				$globalignore = "AND thread.postuserid NOT IN ($Coventry) ";
			}
		}
				// query last threads from visible / chosen forums
		$threads = vB::$vbulletin->db->query_read_slave($sql = "
			SELECT thread.threadid, thread.title, thread.prefixid, post.attach, post.userid AS postuserid, post.username AS postusername,
				thread.postusername, thread.dateline, thread.lastpostid, thread.lastpost, thread.lastposterid, thread.lastposter, thread.replycount,
				forum.forumid, forum.title_clean as forumtitle,
				post.pagetext AS message, post.allowsmilie, post.postid,
				user.userid, user.username, thread.lastposter AS lastpostername
				" . (vB::$vbulletin->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight" : "") . "
			FROM " . TABLE_PREFIX . "thread AS thread
			INNER JOIN " . TABLE_PREFIX . "forum AS forum ON(forum.forumid = thread.forumid)
			LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.firstpostid)
			LEFT JOIN " . TABLE_PREFIX . "user AS user ON (thread.postuserid = user.userid)
			" . (vB::$vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "
			$subscribejoin
			WHERE 1=1
				$forumsql
				AND thread.visible = 1
				AND post.visible = 1
				AND open <> 10
				$datecutoffsql
				$globalignore
				$associatedthread
				" . ($this->userinfo['ignorelist'] ? "AND thread.postuserid NOT IN (" . implode(',', explode(' ', $this->userinfo['ignorelist'])) . ")": '') . "
			ORDER BY $ordersql
			LIMIT 0," . intval($this->config['count']) . "
		");

		require_once(DIR . '/includes/class_bbcode.php');
		$parser = new vB_BbCodeParser(vB::$vbulletin, fetch_tag_list());
		$optionval = vB::$vbulletin->bf_misc_forumoptions['allowhtml'];
		while ($thread = vB::$vbulletin->db->fetch_array($threads))
		{
			$thread['title'] = fetch_trimmed_title($thread['title'], $this->config['threads_titlemaxchars']);

			$thread['url'] = fetch_seo_url('thread', $thread);
			$thread['newposturl'] = fetch_seo_url('thread', $thread, array('goto' => 'newpost'));
			$thread['lastposturl'] = fetch_seo_url('thread', $thread, array('p' => $thread['lastpostid'])) . '#post' . $thread['lastpostid'];
			$thread['date'] = vbdate(vB::$vbulletin->options['dateformat'], $thread['dateline'], true);
			$thread['time'] = vbdate(vB::$vbulletin->options['timeformat'], $thread['dateline']);

			$thread['lastpostdate'] = vbdate(vB::$vbulletin->options['dateformat'], $thread['lastpost'], true);
			$thread['lastposttime'] = vbdate(vB::$vbulletin->options['timeformat'], $thread['lastpost']);
			$forumid = $thread['forumid'];
			$allow_html = ((vB::$vbulletin->forumcache[$forumid]['options'] & $optionval) AND $this->config['allow_html'] ? 1 : 0);
			$thread['previewtext'] = fetch_censored_text($parser->get_preview($thread['message'], $this->default_previewlen, $allow_html));
			$thread['pagetext'] = fetch_censored_text($parser->do_parse($thread['message'], $allow_html));

			// get avatar
			if (intval($thread['userid']) AND vB::$vbulletin->options['avatarenabled'])
			{
				$avatar = fetch_avatar_from_record($thread);
			}

			if (!isset($avatar))
			{
				$avatar = false;
			}
			$thread['avatarurl'] = isset($avatar[0]) ?$avatar[0] : false;
			unset($avatar);
			$threadarray[$thread['threadid']] = $thread;
		}

		return $threadarray;

	}
コード例 #11
0
ファイル: functions.php プロジェクト: holandacz/nb4
function photoplog_process_text($text, $catid, $is_title = false, $add_dots = false)
{
    global $vbulletin, $vbphrase, $photoplog_categoryoptions, $photoplog_ds_catopts;
    static $photoplog_parser = false;
    $do_html = false;
    $do_smilies = false;
    $do_bbcode = false;
    $do_imgcode = false;
    $do_parseurl = false;
    $catid = intval($catid);
    if (!is_array($photoplog_ds_catopts)) {
        $photoplog_ds_catopts = array();
    }
    if (in_array($catid, array_keys($photoplog_ds_catopts))) {
        $photoplog_categorybit = $photoplog_ds_catopts[$catid]['options'];
        $photoplog_catoptions = convert_bits_to_array($photoplog_categorybit, $photoplog_categoryoptions);
        $do_html = $photoplog_catoptions['allowhtml'] ? true : false;
        $do_smilies = $photoplog_catoptions['allowsmilies'] ? true : false;
        $do_bbcode = $photoplog_catoptions['allowbbcode'] ? true : false;
        $do_imgcode = $photoplog_catoptions['allowimgcode'] ? true : false;
        $do_parseurl = $photoplog_catoptions['allowparseurl'] ? true : false;
    }
    $text = fetch_censored_text($text);
    $text = fetch_word_wrapped_string($text);
    require_once DIR . '/includes/functions_newpost.php';
    if ($is_title) {
        $text = fetch_no_shouting_text($text);
        $max_len = 255;
        if (vbstrlen($text) > $max_len) {
            $text = fetch_trimmed_title($text, $max_len);
            $text = photoplog_regexp_text($text);
        }
        if (empty($text)) {
            $text = $vbphrase['photoplog_untitled'];
        }
        $text = htmlspecialchars_uni($text);
        return $text;
    }
    if ($add_dots) {
        $max_len = 100;
        if ($vbulletin->options['lastthreadchars'] != 0) {
            $max_len = $vbulletin->options['lastthreadchars'] * 2;
        }
    } else {
        $max_len = min(vbstrlen($text), 15360000);
        if ($vbulletin->options['postmaxchars'] != 0) {
            $max_len = $vbulletin->options['postmaxchars'];
        }
    }
    if (vbstrlen($text) > $max_len) {
        $text = fetch_trimmed_title($text, $max_len);
        $text = photoplog_regexp_text($text);
    }
    if ($do_parseurl) {
        $text = convert_url_to_bbcode($text);
    }
    if (empty($text)) {
        $text = $vbphrase['photoplog_not_available'];
    }
    $text = fetch_no_shouting_text($text);
    if (!$photoplog_parser) {
        require_once DIR . '/includes/class_bbcode.php';
        $photoplog_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    }
    $text = $photoplog_parser->do_parse($text, $do_html, $do_smilies, $do_bbcode, $do_imgcode, true, false);
    return $text;
}