Exemplo n.º 1
0
/**
* Parses the user's blog description
*
* @param	array	$userinfo array from fetch_userinfo()
*
* @return	array
*/
function parse_blog_description(&$userinfo, $blockinfo = null)
{
	global $vbphrase, $vbulletin, $show;
	$blogheader = array();

	require_once(DIR . '/includes/class_bbcode_blog.php');
	$bbcode = new vB_BbCodeParser_Blog($vbulletin, fetch_tag_list());
	$bbcode->set_parse_userinfo($userinfo, $userinfo['permissions']);

	$blogheader['title'] = $userinfo['blog_title'];
	$blogheader['userid'] = $userinfo['bloguserid'];
	if (!empty($userinfo['blog_description']))
	{
		require_once(DIR . '/includes/class_blog_response.php');
		$blogheader['description'] = $bbcode->parse($userinfo['blog_description'], 'blog_user', $userinfo['blog_allowsmilie'] ? 1 : 0);
	}

	if (!empty($userinfo['custompages']['top']) AND $userinfo['permissions']['vbblog_custompages'])
	{
		$count = 1;
		foreach ($userinfo['custompages']['top'] AS $page)
		{
			$show['cplink'] = (!$blockinfo OR $blockinfo['customblockid'] != $page['i']);
			if (!$show['cplink'])
			{
				$show['cpbloglink'] = true;
			}
			$show['divider'] = ($count != count($userinfo['custompages']['top']));
			$templater = vB_Template::create('blog_header_custompage_link');
				$templater->register('page', $page);
			$blogheader['custompages'] .= $templater->render();
			$count++;
		}
	}

	return $blogheader;
}
Exemplo n.º 2
0
    $blockinfo = verify_blog_customblock($vbulletin->GPC['cp'], 'page');
    if ($blockinfo['type'] == 'block' and !$blockinfo['userinfo']['permissions']['vbblog_customblocks'] or $blockinfo['type'] == 'page' and !$blockinfo['userinfo']['permissions']['vbblog_custompages']) {
        if (!can_moderate_blog('caneditcustomblocks')) {
            print_no_permission();
        }
        $show['reportlink'] = false;
    } else {
        $show['reportlink'] = true;
    }
    track_blog_visit($blockinfo['userinfo']['userid']);
    $show['reportlink'] = ($show['reportlink'] and $vbulletin->userinfo['userid'] and ($vbulletin->options['rpforumid'] or $vbulletin->options['enableemail'] and $vbulletin->options['rpemail']));
    $show['edit'] = (can_moderate_blog('caneditcustomblocks') or $vbulletin->userinfo['userid'] == $blockinfo['userid']);
    // Parse Content here
    require_once DIR . '/includes/class_bbcode_blog.php';
    $bbcode = new vB_BbCodeParser_Blog($vbulletin, fetch_tag_list());
    $bbcode->set_parse_userinfo($blockinfo['userinfo'], $blockinfo['userinfo']['permissions']);
    $blockinfo['page'] = $bbcode->parse($blockinfo['pagetext'], 'blog_user', $blockinfo['allowsmilie'] ? 1 : 0);
    $blogheader = parse_blog_description($blockinfo['userinfo'], $blockinfo);
    $sidebar =& build_user_sidebar($blockinfo['userinfo']);
    $navbits[] = $blockinfo['title'];
    $templater = vB_Template::create('blog_custompage');
    $templater->register('blogheader', $blogheader);
    $templater->register('blockinfo', $blockinfo);
    $content = $templater->render();
}
// build navbar
if (empty($navbits)) {
    $navbits = array('blog.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['blogs'], '' => '');
} else {
    $navbits = array_merge(array('blog.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['blogs']), $navbits);
}
Exemplo n.º 3
0
/**
* Parse message content for preview
*
* @param	array		Message and disablesmilies options
* @param	string	Parse Type (user, post or comment)
*/
function process_blog_preview($blog, $type, $attachments = NULL)
{
	global $vbulletin, $vbphrase, $show;

	require_once(DIR . '/includes/class_bbcode_blog.php');
	$bbcode_parser = new vB_BbCodeParser_Blog($vbulletin, fetch_tag_list());
	$bbcode_parser->set_parse_userinfo($vbulletin->userinfo, $vbulletin->userinfo['permissions']);
	$bbcode_parser->attachments = $attachments;

	$postpreview = '';
	if ($previewmessage = $bbcode_parser->parse(
		$blog['message'],
		'blog_' . $type,
		$blog['disablesmilies'] ? 0 : 1,
		false,
		'',
		3,
		false,
		$blog['htmlstate']
	))
	{
		switch ($type)
		{
			case 'user':
				$templater = vB_Template::create('blog_cp_modify_profile_preview');
					$templater->register('errorlist', $errorlist);
					$templater->register('newpost', $newpost);
					$templater->register('previewmessage', $previewmessage);
				$postpreview = $templater->render();
				break;
			case 'entry':
			case 'comment':
			case 'usercomment':
				$templater = vB_Template::create('blog_entry_editor_preview');
					$templater->register('blog', $blog);
					$templater->register('previewmessage', $previewmessage);
				$postpreview = $templater->render();
				break;
		}
	}

	return $postpreview;
}