Example #1
0
/**
 * 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, $attachmentinfo = NULL)
{
    global $vbphrase, $checked, $rate, $previewpost, $stylevar, $foruminfo, $vbulletin, $show;
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
    if ($attachmentinfo) {
        $bbcode_parser->attachments =& $attachmentinfo;
    }
    $previewpost = 1;
    $bbcode_parser->unsetattach = true;
    $previewmessage = $bbcode_parser->parse($newpost['message'], $foruminfo['forumid'], iif($newpost['disablesmilies'], 0, 1));
    $post = array('userid' => $postuserid ? $postuserid : $vbulletin->userinfo['userid']);
    if (!empty($attachmentinfo)) {
        require_once DIR . '/includes/class_postbit.php';
        $post['attachments'] =& $attachmentinfo;
        $postbit_factory =& new vB_Postbit_Factory();
        $postbit_factory->registry =& $vbulletin;
        $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 != '') {
        eval('$postpreview = "' . fetch_template('newpost_preview') . "\";");
    } else {
        $postpreview = '';
    }
    construct_checkboxes($newpost);
    if ($newpost['rating']) {
        $rate["{$newpost['rating']}"] = ' ' . 'selected="selected"';
    }
    return $postpreview;
}
Example #2
0
		($hook = vBulletinHook::fetch_hook('visitor_message_form_start')) ? eval($hook) : false;

		if (defined('MESSAGEPREVIEW'))
		{
			$postpreview =& $preview;
			$message['message'] = htmlspecialchars_uni($message['message']);

			require_once(DIR . '/includes/functions_newpost.php');
			construct_checkboxes($message);
		}
		else if ($messageinfo)
		{
			require_once(DIR . '/includes/functions_newpost.php');
			construct_checkboxes(
				array(
					'disablesmilies' => (!$messageinfo['allowsmilie']),
					'parseurl'       => 1,
				)
			);
			$message['message'] = htmlspecialchars_uni($messageinfo['pagetext']);
		}
		else
		{
			$message['message'] = '';
		}

		$editorid = construct_edit_toolbar(
			$message['message'],
			false,
			'visitormessage',
			$vbulletin->options['allowsmilies'],
			true,
Example #3
0
     $edit['podcastsize'] = $dataman->info['podcastsize'];
 }
 if (sizeof($errors) > 0) {
     // ### POST HAS ERRORS ###
     if ($vbulletin->GPC['ajax']) {
         require_once DIR . '/includes/class_xml.php';
         $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');
         $xml->add_group('errors');
         foreach ($errors as $error) {
             $xml->add_tag('error', $error);
         }
         $xml->close_group();
         $xml->print_xml();
     } else {
         $postpreview = construct_errors($errors);
         construct_checkboxes($edit);
         $previewpost = true;
         $_REQUEST['do'] = 'editpost';
     }
 } else {
     if ($edit['preview']) {
         $attachs = $db->query_read_slave("\n\t\t\tSELECT dateline, thumbnail_dateline, filename, filesize, visible, attachmentid, counter,\n\t\t\t\tIF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail, thumbnail_filesize,\n\t\t\t\tattachmenttype.thumbnail AS build_thumbnail, attachmenttype.newwindow\n\t\t\tFROM " . TABLE_PREFIX . "attachment\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype USING (extension)\n\t\t\tWHERE postid = {$postinfo['postid']}\n\t\t\tORDER BY attachmentid\n\t\t");
         while ($attachment = $db->fetch_array($attachs)) {
             if (!$attachment['build_thumbnail']) {
                 $attachment['hasthumbnail'] = false;
             }
             $postattach["{$attachment['attachmentid']}"] = $attachment;
         }
         // Attachments added since the edit began.
         $attachs = $db->query_read("\n\t\t\tSELECT dateline, thumbnail_dateline, filename, filesize, visible, attachmentid, counter,\n\t\t\t\tIF(thumbnail_filesize > 0, 1, 0) AS hasthumbnail, thumbnail_filesize,\n\t\t\t\tattachmenttype.thumbnail AS build_thumbnail, attachmenttype.newwindow\n\t\t\tFROM " . TABLE_PREFIX . "attachment AS attachment\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "attachmenttype AS attachmenttype USING (extension)\n\t\t\tWHERE posthash = '" . $db->escape_string($posthash) . "'\n\t\t\t\tAND (userid = " . $vbulletin->userinfo['userid'] . " OR userid = {$postinfo['userid']})\n\t\t\tORDER BY attachmentid\n\t\t");
         while ($attachment = $db->fetch_array($attachs)) {
Example #4
0
                 $user = array_merge($user, convert_bits_to_array($user['options'], $vbulletin->bf_misc_useroptions));
                 cache_permissions($user, false);
                 if (!($vbulletin->userinfo['permissions']['adminpermissions'] & $vbulletin->bf_ugp_adminpermissions['cancontrolpanel']) and (!$user['receivepm'] or !$user['permissions']['pmquota'] or $user['receivepmbuddies'] and !can_moderate() and $user['type'] != 'buddy')) {
                     eval(standard_error(fetch_error('pmrecipturnedoff', $user['username'])));
                 }
                 $recipients[] = $user['username'];
             }
             if (empty($recipients)) {
                 $pm['recipients'] = '';
             } else {
                 $pm['recipients'] = implode(' ; ', $recipients);
             }
         }
         ($hook = vBulletinHook::fetch_hook('private_newpm_blank')) ? eval($hook) : false;
     }
     construct_checkboxes(array('savecopy' => true, 'parseurl' => true, 'signature' => iif($vbulletin->userinfo['signature'] !== '', true)));
     $show['bcclink'] = true;
 }
 $folderjump = construct_folder_jump(0, $pm['folderid']);
 $posticons = construct_icons($pm['iconid'], $vbulletin->options['privallowicons']);
 require_once DIR . '/includes/functions_editor.php';
 // set message box width to usercp size
 $stylevar['messagewidth'] = $stylevar['messagewidth_usercp'];
 $editorid = construct_edit_toolbar($pm['message'], 0, 'privatemessage', iif($vbulletin->options['privallowsmilies'], 1, 0));
 // generate navbar
 if ($pm['pmid']) {
     $navbits['private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid={$pm['folderid']}"] = $foldernames["{$pm['folderid']}"];
     $navbits['private.php?' . $vbulletin->session->vars['sessionurl'] . "do=showpm&pmid={$pm['pmid']}"] = $pm['title'];
     $navbits[''] = iif($pm['forward'], $vbphrase['forward_message'], $vbphrase['reply_to_private_message']);
 } else {
     $navbits[''] = $vbphrase['post_new_private_message'];
Example #5
0
		if ($sidebarinfo)
		{
			$customblock['message'] = htmlspecialchars_uni($sidebarinfo['pagetext']);
			$title = $sidebarinfo['title'];
			$location["$sidebarinfo[location]"] = 'selected="selected"';
		}
		else
		{
			$title = '';
			$customblock['message'] = '';
			$location['side'] = 'selected="selected"';
		}

		construct_checkboxes(
			array(
				'parseurl'       => true,
				'disablesmilies' => ($sidebarinfo AND !$sidebarinfo['allowsmilie'])
		));
	}

	if ($sidebarinfo)
	{
		$show['delete'] = true;
		$show['edit'] = true;
	}

	$editorid = construct_edit_toolbar(
		$customblock['message'],
		false,
		'blog_entry',
		$userinfo['permissions']['vbblog_entry_permissions'] & $vbulletin->bf_ugp_vbblog_entry_permissions['blog_allowsmilies'],
Example #6
0
     $newpost['emailupdate'] =& $vbulletin->GPC['emailupdate'];
 } else {
     $newpost['emailupdate'] = array_pop($array = array_keys(fetch_emailchecked(array(), $vbulletin->userinfo)));
 }
 if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
     $newpost['emailupdate'] = 0;
 }
 if (!$vbulletin->GPC['subscribe']) {
     $newpost['emailupdate'] = 9999;
 }
 build_new_post('thread', $foruminfo, array(), array(), $newpost, $errors);
 if (sizeof($errors) > 0) {
     // ### POST HAS ERRORS ###
     $postpreview = construct_errors($errors);
     // this will take the preview's place
     construct_checkboxes($newpost);
     $_REQUEST['do'] = 'newthread';
     $newpost['message'] = htmlspecialchars_uni($newpost['message']);
     $podcasturl = htmlspecialchars_uni($newpost['podcasturl']);
     $podcastsize = $newpost['podcastsize'] ? $newpost['podcastsize'] : '';
     $podcastkeywords = htmlspecialchars_uni($newpost['podcastkeywords']);
     $podcastsubtitle = htmlspecialchars_uni($newpost['podcastsubtitle']);
     $podcastauthor = htmlspecialchars_uni($newpost['podcastauthor']);
     $explicitchecked = $newpost['podcastexplicit'] ? 'checked="checked"' : '';
 } else {
     if ($newpost['preview']) {
         if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] and $vbulletin->userinfo['userid'] and !empty($vbulletin->userinfo['attachmentextensions'])) {
             require_once DIR . '/packages/vbattach/attach.php';
             $attach = new vB_Attach_Display_Content($vbulletin, 'vBForum_Post');
             $postattach = $attach->fetch_postattach($posthash);
         }
Example #7
0
             }
         }
     }
 }
 if ($_GET['do'] == 'message') {
     require_once DIR . '/includes/functions_editor.php';
     ($hook = vBulletinHook::fetch_hook('picture_comment_form_start')) ? eval($hook) : false;
     if (defined('MESSAGEPREVIEW')) {
         $postpreview =& $preview;
         $message['message'] = htmlspecialchars_uni($message['message']);
         require_once DIR . '/includes/functions_newpost.php';
         construct_checkboxes($message);
     } else {
         if ($commentinfo) {
             require_once DIR . '/includes/functions_newpost.php';
             construct_checkboxes(array('disablesmilies' => !$commentinfo['allowsmilie'], 'parseurl' => 1));
             $message['message'] = htmlspecialchars_uni($commentinfo['pagetext']);
         } else {
             $message['message'] = '';
         }
     }
     $editorid = construct_edit_toolbar($message['message'], false, 'picturecomment', $vbulletin->options['allowsmilies'], true, false, 'fe', '', array(), 'content', 'vBForum_PictureComment', $commentinfo['commentid'] ? $commentinfo['commentid'] : 0, $commentinfo ? 0 : $pictureinfo['attachmentid'], defined('MESSAGEPREVIEW'));
     $usernamecode = vB_Template::create('newpost_usernamecode')->render();
     // auto-parse URL
     if (!isset($checked['parseurl'])) {
         $checked['parseurl'] = 'checked="checked"';
     }
     $show['parseurl'] = $vbulletin->options['allowbbcode'];
     $show['misc_options'] = ($show['parseurl'] or !empty($disablesmiliesoption));
     $show['additional_options'] = ($show['misc_options'] or !empty($attachmentoption));
     $show['physicaldeleteoption'] = can_moderate(0, 'canremovepicturecomments');
Example #8
0
/**
 * 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, $attachmentinfo = 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 ($attachmentinfo)
	{
		$bbcode_parser->attachments =& $attachmentinfo;
	}

	$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($attachmentinfo))
	{
		require_once(DIR . '/includes/class_postbit.php');
		$post['attachments'] =& $attachmentinfo;
		$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("
			SELECT signature
			FROM " . TABLE_PREFIX . "usertextfield
			WHERE userid = $postuserid
		");
		$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("
			SELECT title as title, iconpath
			FROM " . TABLE_PREFIX . "icon
			WHERE iconid = " . intval($newpost['iconid']) . "
		"))
		{
			$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;
}
Example #9
0
	// get attachment options
	require_once(DIR . '/includes/functions_file.php');
	$inimaxattach = fetch_max_upload_size();
	$maxattachsize = vb_number_format($inimaxattach, 1, true);
	$attachcount = 0;
	$attachment_js = '';

	$attachmentoption = '';

	if (defined('COMMENTPREVIEW'))
	{
		$postpreview =& $preview;
		$blog['message'] = htmlspecialchars_uni($blog['message']);
		$title = $blog['title'];
		$reason = $blog['reason'];
		construct_checkboxes($blog);
		$notification = array($vbulletin->GPC['emailupdate'] => 'selected="selected"');
		$previewpost = true;
	}
	else
	{ // defaults in here if we're doing a quote etc
		if ($bloginfo['issubscribed'])
		{
			$notification = array($bloginfo['emailupdate'] => 'selected="selected"');
		}
		else
		{
			$notification = array($vbulletin->userinfo['blog_subscribeothers'] => 'selected="selected"');
		}

		// Handle Quote