コード例 #1
0
ファイル: functions_newpost.php プロジェクト: 0hyeah/yurivn
/**
 * Generates a Preview of a post
 *
 * @param	array	Information regarding the new post
 * @param	integer	The User ID posting
 * @param	array	Information regarding attachments
 *
 * @return	string	The Generated Preview
 *
 */
function process_post_preview(&$newpost, $postuserid = 0, $attachment_bycontent = NULL, $attachment_byattachment = NULL)
{
    global $vbphrase, $checked, $rate, $previewpost, $foruminfo, $threadinfo, $vbulletin, $show;
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    if ($attachment_byattachment) {
        $bbcode_parser->attachments =& $attachment_byattachment;
        $bbcode_parser->containerid = $newpost['postid'] ? $newpost['postid'] : 0;
    }
    $previewpost = 1;
    $bbcode_parser->unsetattach = true;
    $previewmessage = $bbcode_parser->parse($newpost['message'], $foruminfo['forumid'], $newpost['disablesmilies'] ? 0 : 1, false, '', 3, false, $newpost['htmlstate']);
    $post = array('userid' => $postuserid ? $postuserid : $vbulletin->userinfo['userid']);
    if (!empty($attachment_byattachment)) {
        require_once DIR . '/includes/class_postbit.php';
        $post['attachments'] = $attachment_byattachment;
        $post['allattachments'] = $attachment_bycontent;
        $postbit_factory = new vB_Postbit_Factory();
        $postbit_factory->registry =& $vbulletin;
        $postbit_factory->thread =& $threadinfo;
        $postbit_factory->forum =& $foruminfo;
        $postbit_obj =& $postbit_factory->fetch_postbit('post');
        $postbit_obj->post =& $post;
        $postbit_obj->process_attachments();
    }
    if ($post['userid'] != $vbulletin->userinfo['userid']) {
        $fetchsignature = $vbulletin->db->query_first("\n\t\t\tSELECT signature\n\t\t\tFROM " . TABLE_PREFIX . "usertextfield\n\t\t\tWHERE userid = {$postuserid}\n\t\t");
        $signature =& $fetchsignature['signature'];
    } else {
        $signature = $vbulletin->userinfo['signature'];
    }
    $show['signature'] = false;
    if ($newpost['signature'] and trim($signature)) {
        $userinfo = fetch_userinfo($post['userid'], FETCH_USERINFO_SIGPIC);
        if ($post['userid'] != $vbulletin->userinfo['userid']) {
            cache_permissions($userinfo, false);
        } else {
            $userinfo['permissions'] =& $vbulletin->userinfo['permissions'];
        }
        if ($userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canusesignature']) {
            $bbcode_parser->set_parse_userinfo($userinfo);
            $post['signature'] = $bbcode_parser->parse($signature, 'signature');
            $bbcode_parser->set_parse_userinfo(array());
            $show['signature'] = true;
        }
    }
    if ($foruminfo['allowicons'] and $newpost['iconid']) {
        if ($icon = $vbulletin->db->query_first_slave("\n\t\t\tSELECT title as title, iconpath\n\t\t\tFROM " . TABLE_PREFIX . "icon\n\t\t\tWHERE iconid = " . intval($newpost['iconid']) . "\n\t\t")) {
            $newpost['iconpath'] = $icon['iconpath'];
            $newpost['icontitle'] = $icon['title'];
        }
    } else {
        if ($vbulletin->options['showdeficon'] != '') {
            $newpost['iconpath'] = $vbulletin->options['showdeficon'];
            $newpost['icontitle'] = $vbphrase['default'];
        }
    }
    $show['messageicon'] = iif($newpost['iconpath'], true, false);
    $show['errors'] = false;
    ($hook = vBulletinHook::fetch_hook('newpost_preview')) ? eval($hook) : false;
    if ($previewmessage != '') {
        $templater = vB_Template::create('newpost_preview');
        $templater->register('errorlist', $errorlist);
        $templater->register('newpost', $newpost);
        $templater->register('post', $post);
        $templater->register('previewmessage', $previewmessage);
        $templater->register('content_type', 'forumcontent');
        $postpreview = $templater->render();
    } else {
        $postpreview = '';
    }
    construct_checkboxes($newpost);
    if ($newpost['rating']) {
        $rate["{$newpost['rating']}"] = ' selected="selected"';
    }
    return $postpreview;
}
コード例 #2
0
ファイル: class_postbit.php プロジェクト: hungnv0789/vhtm
	function process_signature()
	{
		if ($this->post['showsignature']
			AND trim($this->post['signature']) != ''
			AND (!$this->registry->userinfo['userid'] OR $this->registry->userinfo['showsignatures'])
			AND $this->cache['perms'][$this->post['userid']]['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canusesignature']
		)
		{
			if (isset($this->cache['sig'][$this->post['userid']]))
			{
				// already fully parsed
				$this->post['signature'] = $this->cache['sig'][$this->post['userid']];
			}
			else
			{
				// have a mostly parsed version or no parsed version
				$this->bbcode_parser->set_parse_userinfo($this->post, $this->cache['perms'][$this->post['userid']]);
				$this->post['signature'] = $this->bbcode_parser->parse(
					$this->post['signature'],
					'signature',
					true,
					false,
					$this->post['signatureparsed'],
					$this->post['sighasimages'],
					true
				);
				$this->bbcode_parser->set_parse_userinfo(array());
				if ($this->post['signatureparsed'] === null)
				{
					$this->sig_cache = $this->bbcode_parser->cached;
				}

				$this->cache['sig'][$this->post['userid']] = $this->post['signature'];
			}
		}
		else
		{
			$this->post['signature'] = '';
		}
	}
コード例 #3
0
ファイル: profile.php プロジェクト: hungnv0789/vhtm
		$signature = $vbulletin->userinfo['signature'];
	}

	// Free the memory, unless we need it below.
	if (!$signature)
	{
		unset($sig_parser);
	}

	if ($signature)
	{
		if (!$previewmessage)
		{
			require_once(DIR . '/includes/class_bbcode.php');
			$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
			$bbcode_parser->set_parse_userinfo(fetch_userinfo($vbulletin->userinfo['userid'], FETCH_USERINFO_SIGPIC), $vbulletin->userinfo['permissions']);
			$previewmessage = $bbcode_parser->parse($signature, 'signature');
		}

		// save a conditional by just overwriting the phrase
		$vbphrase['submit_message'] =& $vbphrase['save_signature'];
		$templater = vB_Template::create('newpost_preview');
			$templater->register('errorlist', $errorlist);
			$templater->register('newpost', $newpost);
			$templater->register('post', $post);
			$templater->register('previewmessage', $previewmessage);
		$preview = $templater->render();
	}

	require_once(DIR . '/includes/functions_editor.php');
コード例 #4
0
function fr_post_to_bbcode($node)
{
    require_once DIR . '/includes/class_core.php';
    require_once DIR . '/includes/class_bbcode.php';
    $post = array();
    $bbcode_parser = new vB_BbCodeParser(vB::get_registry(), fetch_tag_list());
    $post['signature'] = '';
    if (!empty($node['content']['signature']['raw'])) {
        $bbcode_parser->set_parse_userinfo($node['content']['userinfo']);
        $post['signature'] = $bbcode_parser->parse($node['content']['signature']['raw'], 'signature', true, false, '', $node['content']['signaturepic'], true);
        $sig = trim(remove_bbcode(strip_tags($post['signature']), true, true), '<a>');
        $sig = str_replace(array("\t", "\r"), array('', ''), $sig);
        $sig = str_replace("\n\n", "\n", $sig);
        $post['signature'] = $sig;
    }
    list($text, , $images) = parse_post($node['content']['rawtext']);
    $post['html'] = $text;
    $post['images'] = $images;
    return $post;
}
コード例 #5
0
ファイル: class_userprofile.php プロジェクト: 0hyeah/yurivn
 /**
  * Prepares the User's Signature
  *
  */
 function prepare_signature()
 {
     global $show;
     if ($this->userinfo['signature'] and $this->userinfo['permissions']['genericpermissions'] & $this->registry->bf_ugp_genericpermissions['canusesignature']) {
         require_once DIR . '/includes/class_bbcode.php';
         $bbcode_parser = new vB_BbCodeParser($this->registry, fetch_tag_list());
         $bbcode_parser->set_parse_userinfo($this->userinfo, $this->userinfo['permissions']);
         $this->prepared['signature'] = $bbcode_parser->parse($this->userinfo['signature'], 'signature');
     }
 }
コード例 #6
0
ファイル: class_blog_entry.php プロジェクト: hungnv0789/vhtm
	/**
	* Prepare the text for display
	*/
	function process_text()
	{
		global $vbphrase;

		$this->bbcode->attachments =& $this->attachments;
		$this->bbcode->unsetattach = true;
		$this->bbcode->set_parse_userinfo($this->blog, $this->factory->perm_cache["{$this->blog['userid']}"]);
		$this->bbcode->containerid = $this->blog['blogid'];
		$this->blog['message'] = $this->bbcode->parse(
			$this->blog['pagetext'],
			'blog_entry',
			$this->blog['allowsmilie'],
			false,
			$this->blog['pagetexthtml'], // fix
			$this->blog['hasimages'], // fix
			$this->cachable,
			$this->blog['htmlstate']
		);
		if ($this->bbcode->createdsnippet !== true)
		{
			$this->parsed_cache =& $this->bbcode->cached;
		}
		$this->readmore = ($this->bbcode->createdsnippet);
	}
コード例 #7
0
	/**
	* Prepare the text for display
	*/
	function process_text()
	{
		$this->bbcode->set_parse_userinfo($this->response, $this->factory->perm_cache["{$this->response['userid']}"]);
		$this->response['message'] = $this->bbcode->parse(
			$this->response['pagetext'],
			($this->bloginfo['firstblogtextid'] == $this->response['blogtextid']) ? 'blog_entry' : 'blog_comment',
			$this->response['allowsmilie'], // fix
			false,
			$this->response['pagetexthtml'], // fix
			$this->response['hasimages'], // fix
			$this->cachable
		);
		$this->parsed_cache =& $this->bbcode->cached;
		$this->readmore = ($this->bbcode->createdsnippet);
	}