Beispiel #1
0
function parse_pm_bbcode($bbcode, $smilies = true)
{
    global $vbulletin;
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    return $bbcode_parser->parse($bbcode, 'privatemessage', $smilies);
}
Beispiel #2
0
function parse_usernote_bbcode($bbcode, $smilies = true)
{
	global $vbulletin;

	require_once(DIR . '/includes/class_bbcode.php');
	$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
	return $bbcode_parser->parse($bbcode, 'usernote', $smilies);
}
Beispiel #3
0
 /**
  * Constructor. Sets up the tag permissions list.
  *
  * @param	vB_Registry	Reference to registry object
  * @param	array		The tag_list array for the parent class parser
  * @param	integer		The permssions number for the user from their usergroup  i.e. $vbulletin->userinfo['permissions']
  * @param	integer		The user this signature belongs to. Required
  * @param	boolean		Whether to append custom tags (they will not be parsed anyway)
  */
 function vB_SignatureParser(&$registry, $tag_list, $usergroup_signature_permission, $userid, $append_custom_tags = true)
 {
     parent::vB_BbCodeParser($registry, $tag_list, false);
     $this->userid = intval($userid);
     if (!$this->userid) {
         trigger_error("User ID is 0. A signature cannot be parsed unless it belongs to a user.", E_USER_ERROR);
     }
     $this->permissions =& $usergroup_signature_permission;
     $this->tag_groups = array('b' => 'basic', 'i' => 'basic', 'u' => 'basic', 'color' => 'color', 'size' => 'size', 'font' => 'font', 'left' => 'align', 'center' => 'align', 'right' => 'align', 'indent' => 'align', 'list' => 'list', 'url' => 'link', 'email' => 'link', 'thread' => 'link', 'post' => 'link', 'code' => 'code', 'php' => 'php', 'html' => 'html', 'quote' => 'quote');
     // General, allowed or not
     foreach ($this->tag_groups as $tag => $tag_group) {
         if (isset($this->tag_list['no_option']["{$tag}"])) {
             $this->tag_list['no_option']["{$tag}"]['callback'] = 'check_bbcode_general';
             unset($this->tag_list['no_option']["{$tag}"]['html']);
         }
         if (isset($this->tag_list['option']["{$tag}"])) {
             $this->tag_list['option']["{$tag}"]['callback'] = 'check_bbcode_general';
             unset($this->tag_list['option']["{$tag}"]['html']);
         }
     }
     // Specific functions
     $this->tag_list['option']['size']['callback'] = 'check_bbcode_size';
     $this->tag_list['no_option']['img']['callback'] = 'check_bbcode_img';
     // needs to parse sig pics like any other bb code
     $this->tag_list['no_option']['sigpic'] = array('strip_empty' => false, 'callback' => 'check_bbcode_sigpic');
     if ($append_custom_tags) {
         $this->append_custom_tags();
     }
 }
Beispiel #4
0
 /**
  * Handles BBCode [media] (or whatever $tag is)
  *
  * @param	object		vB_BbCodeParser
  * @param	string		Media URL or attachment ID
  * @param	string		Custom media options
  * 
  * @return	string		Rendered media HTML
  */
 function handle_bbcode_goldbrick(vB_BbCodeParser $parser, $text, $options = '')
 {
     global $vbphrase, $vbulletin;
     if ($parser->registry->userinfo['permissions']['gb_permissions'] & $parser->registry->bf_ugp['gb_permissions']['canuse']) {
         $text = str_replace(array('[', ']'), array('[', ']'), $text);
         $text = strip_bbcode($text, true, true, false);
         if ($parser->is_wysiwyg()) {
             return sprintf('[%1$s%2$s]%3$s[/%1$s]', $parser->registry->options['gb_tag'], $options ? ""{$options}"" : '', $text);
         }
         require_once DIR . '/goldbrick/includes/functions_public.php';
         //$goldbrick = new goldbrick_media($vbulletin);
         $media = goldbrick_start_delivery($text, $options);
         if ($media) {
             return $media;
         } else {
             $media = goldbrick_process_bbcode($text, $options);
             $info = goldbrick_start_delivery($text, $options);
             return $info;
         }
     }
     return $vbphrase['gb_no_permissions'];
 }
 /**
  * Constructor. Sets up the tag permissions list.
  *
  * @param	vB_Registry	Reference to registry object
  * @param	array		The tag_list array for the parent class parser
  * @param	boolean		Whether to append custom tags
  */
 function vB_SocialMessageParser(&$registry, $tag_list, $append_custom_tags = true)
 {
     parent::vB_BbCodeParser($registry, $tag_list, false);
     // Load the information regarding allowed tags from the options
     $this->allow_bbcodes();
     // General, whether allowed or not
     foreach ($this->tag_groupings as $tag => $tag_group) {
         if (isset($this->tag_list['no_option']["{$tag}"])) {
             $this->tag_list['no_option']["{$tag}"]['callback'] = 'check_bbcode_general';
             unset($this->tag_list['no_option']["{$tag}"]['html']);
         }
         if (isset($this->tag_list['option']["{$tag}"])) {
             $this->tag_list['option']["{$tag}"]['callback'] = 'check_bbcode_general';
             unset($this->tag_list['option']["{$tag}"]['html']);
         }
     }
     // lets treat the image tag like a full tag here
     $this->tag_list['no_option']['img']['callback'] = 'check_bbcode_general';
     if ($append_custom_tags) {
         $this->append_custom_tags();
     }
 }
Beispiel #6
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, $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;
}
Beispiel #7
0
// ############################### start reputation ###############################
$show['reputation'] = false;
if ($vbulletin->options['reputationenable']) {
    $vbulletin->options['showuserrates'] = intval($vbulletin->options['showuserrates']);
    $vbulletin->options['showuserraters'] = $permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseeownrep'];
    $reputations = $db->query_read_slave("\r\n\t\tSELECT\r\n\t\t\treputation.whoadded, reputation.postid, reputation.reputation, reputation.reason, reputation.dateline,\r\n\t\t\tuser.userid, user.username, post.threadid, thread.title, thread.threadid\r\n\t\tFROM " . TABLE_PREFIX . "reputation AS reputation\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (reputation.postid = post.postid AND post.visible = 1)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid AND thread.visible = 1)\r\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = reputation.whoadded)\r\n\t\tWHERE reputation.userid = " . $vbulletin->userinfo['userid'] . "\r\n\t\t\t" . iif($vbulletin->options['showuserraters'] and trim($vbulletin->userinfo['ignorelist']), " AND reputation.whoadded NOT IN (0," . str_replace(' ', ',', trim($vbulletin->userinfo['ignorelist'])) . ")") . "\r\n\t\tORDER BY reputation.dateline DESC\r\n\t\tLIMIT 0, " . $vbulletin->options['showuserrates']);
    $reputationcommentbits = '';
    if ($vbulletin->options['showuserraters']) {
        $reputationcolspan = 5;
        $reputationbgclass = 'alt2';
    } else {
        $reputationcolspan = 4;
        $reputationbgclass = 'alt1';
    }
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    while ($reputation = $db->fetch_array($reputations)) {
        if ($reputation['reputation'] > 0) {
            $posneg = 'pos';
        } else {
            if ($reputation['reputation'] < 0) {
                $posneg = 'neg';
            } else {
                $posneg = 'balance';
            }
        }
        $reputation['timeline'] = vbdate($vbulletin->options['timeformat'], $reputation['dateline']);
        $reputation['dateline'] = vbdate($vbulletin->options['dateformat'], $reputation['dateline']);
        $reputation['reason'] = $bbcode_parser->parse($reputation['reason']);
        $threadinfo = array('threadid' => $reputation['threadid'], 'title' => $reputation['title']);
        if (vbstrlen($reputation['title']) > 25) {
Beispiel #8
0
function parse_post($text, $allowsmilie = false)
{
    global $nuke_quotes, $fr_platform, $images;
    $images = array();
    if (is_ipb()) {
        // Replace <br.*/> with \n
        $text = preg_replace('#<br.*?/>#is', "\n", $text);
    }
    $smilies = false;
    $v = process_input(array('smilies' => BOOLEAN));
    if (isset($v['smilies'])) {
        $smilies = $v['smilies'] === true;
    }
    // Trim each line
    $lines = preg_split("/\n/", $text);
    for ($i = 0; $i < count($lines); $i++) {
        $lines[$i] = trim($lines[$i]);
    }
    $text = join("\n", $lines);
    $text = prepare_utf8_string($text, false);
    $bbcode = new StringParser_BBCode();
    $bbcode->setGlobalCaseSensitive(false);
    // Handle default BBCode
    $bbcode->addCode('quote', 'callback_replace', 'handle_quotes', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('url', 'usecontent?', 'handle_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link'));
    $bbcode->addCode('source', 'usecontent?', 'handle_url', array('usecontent_param' => 'default'), 'link', array('listitem', 'block', 'inline'), array('link'));
    if (!is_mybb()) {
        // myBB wonky attachment codes are already handled
        $bbcode->addCode('attach', 'callback_replace', 'handle_attach', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    }
    $bbcode->addCode('attach', 'callback_replace', 'handle_attach', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('img', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('imgl', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('imgr', 'callback_replace', 'handle_image', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    //$bbcode->addCode('spoiler', 'callback_replace', 'handle_spoiler', array(), 'inline',
    //array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('b', 'callback_replace', 'handle_bbcode_bold', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array());
    $bbcode->addCode('i', 'callback_replace', 'handle_bbcode_italic', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array());
    $bbcode->addCode('color', 'callback_replace', 'handle_bbcode_color', array('usecontent_param' => array('default')), 'inline', array('listitem', 'block', 'inline', 'link'), array());
    $bbcode->setCodeFlag('color', 'closetag', BBCODE_CLOSETAG_MUSTEXIST);
    // Video Link BBCode
    $bbcode->addCode('yt', 'callback_replace', 'fr_handle_youtube', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('youtube', 'callback_replace', 'fr_handle_youtube', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('video', 'callback_replace', 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('ame', 'callback_replace', 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('media', 'callback_replace', is_xen() ? 'handle_xen_media' : 'handle_video', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    $bbcode->addCode('tex', 'callback_replace', 'fr_handle_tex', array(), 'inline', array('listitem', 'block', 'inline', 'link'), array(''));
    if (function_exists('fr_branded_bbcode_handler')) {
        @fr_branded_bbcode_handler($bbcode);
    }
    if (is_mybb()) {
        $bbcode->setMixedAttributeTypes(true);
    }
    $nuked_quotes = $text;
    $text = htmlspecialchars_uni($text);
    $nuke_quotes = true;
    $nuked_quotes = $bbcode->parse($nuked_quotes);
    if (is_ipb()) {
        $nuked_quotes = ipb_handle_attachments($nuked_quotes);
    }
    $nuke_quotes = false;
    $text = $bbcode->parse($text);
    if (is_ipb()) {
        $text = ipb_handle_attachments($text);
    }
    // Snag out images
    preg_match_all('#\\[IMG\\](.*?)\\[/IMG\\]#is', $text, $matches);
    $text = preg_replace("#\\[IMG\\](.*?)\\[/IMG\\]#is", '', $text);
    $nuked_quotes = preg_replace("#\\[IMG\\](.*?)\\[/IMG\\]#is", '', $nuked_quotes);
    if ($smilies) {
        if (is_vb()) {
            global $vbulletin;
            $parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
            $text = $parser->parse_smilies($text, false);
            $text = preg_replace_callback('#img src="(.*?)"#is', parse_post_callback, $text);
        }
    }
    $text = preg_replace("#\n\n\n+#", "\n\n", $text);
    $text = preg_replace("#\n#", "<br/>", $text);
    $text = remove_bbcode($text);
    $nuked_quotes = preg_replace("#\n\n\n+#", "\n\n", $nuked_quotes);
    $nuked_quotes = remove_bbcode($nuked_quotes);
    return array($text, $nuked_quotes, $images);
}
Beispiel #9
0
         $show['allowratefile'] = true;
     }
 }
 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');
Beispiel #10
0
    $donetest = 1;
    $_REQUEST['do'] = 'modify';
}
// ########################################################################
if ($_REQUEST['do'] == 'previewbbcode') {
    define('NO_CP_COPYRIGHT', true);
    $vbulletin->input->clean_array_gpc('r', array('bbcodeid' => TYPE_UINT));
    if ($bbcode = $vbulletin->db->query_first("SELECT * FROM " . TABLE_PREFIX . "bbcode WHERE bbcodeid = " . $vbulletin->GPC['bbcodeid'])) {
        $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=\"\" />";
Beispiel #11
0
	/**
	* Parses the post for BB code.
	*/
	function parse_bbcode()
	{
		$this->post['message'] = $this->bbcode_parser->parse(
			$this->post['pagetext'],
			$this->forum['forumid'],
			$this->post['allowsmilie'],
			false,
			'',
			3,
			false,
			$this->post['htmlstate']
		);
	}
Beispiel #12
0
}
// #############################################################################
if ($_POST['do'] == 'preview') {
    require_once DIR . '/includes/class_rss_poster.php';
    require_once DIR . '/includes/functions_wysiwyg.php';
    $xml = new vB_RSS_Poster($vbulletin);
    $xml->fetch_xml($vbulletin->GPC['url']);
    if (empty($xml->xml_string)) {
        print_stop_message('unable_to_open_url');
    } else {
        if ($xml->parse_xml() === false) {
            print_stop_message('xml_error_x_at_line_y', $xml->feedtype == 'unknown' ? 'Unknown Feed Type' : $xml->xml_object->error_string(), $xml->xml_object->error_line());
        }
    }
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    $output = '';
    $count = 0;
    foreach ($xml->fetch_items() as $item) {
        if ($vbulletin->GPC['maxresults'] and $count++ >= $vbulletin->GPC['maxresults']) {
            break;
        }
        if (!empty($item['content:encoded'])) {
            $content_encoded = true;
        }
        $title = $bbcode_parser->parse(strip_bbcode(convert_wysiwyg_html_to_bbcode($xml->parse_template($vbulletin->GPC['titletemplate'], $item))), 0, false);
        if ($vbulletin->GPC['options']['html2bbcode']) {
            $body_template = nl2br($vbulletin->GPC['bodytemplate']);
        } else {
            $body_template = $vbulletin->GPC['bodytemplate'];
        }
 /**
  * Constructor. Sets up the tag list.
  *
  * @param	vB_Registry	Reference to registry object
  * @param	array		List of tags to parse
  * @param	boolean		Whether to append custom tags (they will not be parsed anyway)
  */
 function vB_BbCodeParser_PlainText(&$registry, $tag_list = array(), $append_custom_tags = true)
 {
     parent::vB_BbCodeParser($registry, $tag_list, $append_custom_tags);
     // add thread and post tags as parsed -- this can't be done above
     // because I need to use a variable in $registry
     $this->plaintext_tags['option']['thread'] = array('html' => '%1$s (' . $registry->options['bburl'] . '/showthread.php?t=%2$s)', 'option_regex' => '#^\\d+$#', 'strip_empty' => true);
     $this->plaintext_tags['no_option']['thread'] = array('html' => $registry->options['bburl'] . '/showthread.php?t=%1$s', 'data_regex' => '#^\\d+$#', 'strip_empty' => true);
     $this->plaintext_tags['option']['post'] = array('html' => '%1$s (' . $registry->options['bburl'] . '/showthread.php?p=%2$s#post%2$s)', 'option_regex' => '#^\\d+$#', 'strip_empty' => true);
     $this->plaintext_tags['no_option']['post'] = array('html' => $registry->options['bburl'] . '/showthread.php?p=%1$s#post%1$s', 'data_regex' => '#^\\d+$#', 'strip_empty' => true);
     // update all parsable tags to their new value and make unparsable tags disappear
     foreach ($this->tag_list['option'] as $tagname => $info) {
         if (!isset($this->plaintext_tags['option']["{$tagname}"])) {
             $this->tag_list['option']["{$tagname}"]['html'] = '%1$s';
             unset($this->tag_list['option']["{$tagname}"]['callback']);
         } else {
             if ($this->plaintext_tags['option']["{$tagname}"] !== false) {
                 $this->tag_list['option']["{$tagname}"] = $this->plaintext_tags['option']["{$tagname}"];
             }
         }
     }
     foreach ($this->tag_list['no_option'] as $tagname => $info) {
         if (!isset($this->plaintext_tags['no_option']["{$tagname}"])) {
             $this->tag_list['no_option']["{$tagname}"]['html'] = '%1$s';
             unset($this->tag_list['no_option']["{$tagname}"]['callback']);
         } else {
             if ($this->plaintext_tags['no_option']["{$tagname}"] !== false) {
                 $this->tag_list['no_option']["{$tagname}"] = $this->plaintext_tags['no_option']["{$tagname}"];
             }
         }
     }
 }
Beispiel #14
0
	{ // is this your own post?

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

		$postreputations = $db->query_read_slave("
			SELECT reputation, reason
			FROM " . TABLE_PREFIX . "reputation
			WHERE postid = $postid
			ORDER BY dateline DESC
		");

		if ($db->num_rows($postreputations) > 0)
		{

			require_once(DIR . '/includes/class_bbcode.php');
			$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());

			while ($postreputation = $db->fetch_array($postreputations))
			{
				$total += $postreputation['reputation'];
				if ($postreputation['reputation'] > 0)
				{
					$posneg = 'pos';
				}
				else if ($postreputation['reputation'] < 0)
				{
					$posneg = 'neg';
				}
				else
				{
					$posneg = 'balance';
Beispiel #15
0
if ($_REQUEST['do'] == 'managepost') {
    if ($postinfo['postid'] == $threadinfo['firstpostid']) {
        // first post
        // redirect to edit thread
        $_REQUEST['do'] = 'editthread';
    } else {
        if (!can_moderate($threadinfo['forumid'], 'candeleteposts')) {
            print_no_permission();
        }
        verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
        $show['undeleteoption'] = iif($postinfo['isdeleted'] and (can_moderate($threadinfo['forumid'], 'canremoveposts') or can_moderate($threadinfo['forumid'], 'candeleteposts')), true, false);
        if (!$show['undeleteoption']) {
            standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']));
        }
        require_once DIR . '/includes/class_bbcode.php';
        $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
        $postinfo['pagetext'] = $bbcode_parser->parse($postinfo['pagetext'], $forumid);
        $postinfo['postdate'] = vbdate($vbulletin->options['dateformat'], $postinfo['dateline'], 1);
        $postinfo['posttime'] = vbdate($vbulletin->options['timeformat'], $postinfo['dateline']);
        $visiblechecked = iif($postinfo['visible'], 'checked="checked"');
        // draw nav bar
        $navbits = construct_postings_nav($foruminfo, $threadinfo);
    }
    ($hook = vBulletinHook::fetch_hook('threadmanage_managepost')) ? eval($hook) : false;
    $page_templater = vB_Template::create('threadadmin_managepost');
    $page_templater->register('postid', $postid);
    $page_templater->register('postinfo', $postinfo);
    $page_templater->register('threadid', $threadid);
    $remove_temp_render = $page_templater->render();
}
// ############################### start edit thread ###############################
Beispiel #16
0
	if (($vbulletin->userinfo['maxposts'] != -1) AND ($vbulletin->userinfo['maxposts']))
	{
		$vbulletin->options['maxposts'] = $vbulletin->userinfo['maxposts'];
	}

	if ($Coventry = fetch_coventry('string'))
	{
		$globalignore = "AND post.userid NOT IN ($Coventry) ";
	}
	else
	{
		$globalignore = '';
	}

	require_once(DIR . '/includes/class_bbcode.php');
	$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());


	$posts = $db->query_read_slave("
		SELECT post.*, IF(post.userid = 0, post.username, user.username) AS username
		FROM " . TABLE_PREFIX . "post AS post
		LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)
		WHERE post.visible = 1
			$globalignore
			AND post.threadid = $threadinfo[threadid]
		ORDER BY dateline DESC, postid DESC
		LIMIT " . ($vbulletin->options['maxposts'] + 1)
	);
	while ($post = $db->fetch_array($posts))
	{
		if ($postcounter++ < $vbulletin->options['maxposts'])
Beispiel #17
0
		);

		$stylelist["$style[styleid]"]['idlist'] = array(
			'bbcode_code'  => intval($tlist['bbcode_code_styleid']),
			'bbcode_quote' => intval($tlist['bbcode_quote_styleid']),
			'bbcode_php'   => intval($tlist['bbcode_php_styleid']),
			'bbcode_html'  => intval($tlist['bbcode_html_styleid']),
			'bbcode_video' => intval($tlist['bbcode_video_styleid']),
		);

		$stylelist["$style[styleid]"]['newstylevars'] = unserialize($style['newstylevars']);
	}
	$stylelist["0"] =& $stylelist["{$vbulletin->options['styleid']}"];

	require_once(DIR . '/includes/class_bbcode.php');
	$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());

	if (empty($vbulletin->GPC['perpage']))
	{
		$vbulletin->GPC['perpage'] = 1000;
	}

	if ($vbulletin->GPC['startat'] == 0)
	{
		$db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "postparsed");
		$firstpost = $db->query_first("SELECT MIN(postid) AS min FROM " . TABLE_PREFIX . "post");
		$vbulletin->GPC['startat'] = intval($firstpost['min']);
	}

	echo '<p>' . $vbphrase['building_post_cache'] . '</p>';
Beispiel #18
0
	{
		$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');
 private function _parseBB($text, $type = 'pm')
 {
     include_once DIR . '/includes/class_dle_parse.php';
     $parse = new DLE_ParseFilter();
     $parse->safe_mode = true;
     //        $parse->allow_url = false;
     //        $parse->allow_image = false;
     $bbparser = new vB_BbCodeParser($this->vbulletin, fetch_tag_list());
     $this->_fetch_home_url();
     $text = $bbparser->parse_smilies($text);
     $text = preg_replace('#<img .*?src=[\'"]([^h].+?)[\'"] .*?/>#si', "[img]{$this->vbulletin->basepath}\\1[/img]", $text);
     $text = $parse->process($text);
     if ($type == 'pm') {
         $quote = 'Цитата';
         if (strtolower($this->vbulletin->userinfo['lang_charset']) != 'utf-8') {
             $quote = iconv('utf-8', $this->vbulletin->userinfo['lang_charset'], $quote);
         }
         $text = preg_replace('#\\[QUOTE\\]#si', "<!--QuoteBegin--><div class=\"quote\"><!--QuoteEBegin-->", $text);
         $text = preg_replace('#\\[quote=(.+?)\\]#si', "<!--QuoteBegin \\1 --><div class=\"title_quote\">{$quote}: \\1</div><div class=\"quote\"><!--QuoteEBegin-->", $text);
         $text = preg_replace('#\\[/quote\\]#si', "<!--QuoteEnd--></div><!--QuoteEEnd-->", $text);
         $text = preg_replace('#\\[post\\]([0-9]+)\\[/post\\]#si', "<a href='" . $this->vbulletin->basepath . "showthread.php?p=\\1#post\\1'>" . $this->vbulletin->basepath . "showthread.php?p=\\1</a>", $text);
     } else {
         if ($type == 'signature') {
             $text = strip_tags($text);
             if ($this->vbulletin->options['usefileavatar']) {
                 $sigpic_url = $this->vbulletin->options['sigpicurl'] . '/sigpic' . $this->vbulletin->userinfo['userid'] . '_' . $this->vbulletin->userinfo['sigpicrevision'] . '.gif';
             } else {
                 $sigpic_url = 'image.php?u=' . $this->vbulletin->userinfo['userid'] . "&amp;type=sigpic&amp;dateline=" . $userinfo_sigpic['sigpicdateline'];
             }
             $text = preg_replace('#\\[SIGPIC\\]\\[/SIGPIC\\]#si', "[img]{$this->vbulletin->basepath}{$sigpic_url}[/img]", $text);
             $text = preg_replace('#\\[SIGPIC\\](.+?)\\[/SIGPIC\\]#si', "[img=|\\1]{$this->vbulletin->basepath}{$sigpic_url}[/img]", $text);
         }
     }
     $text = preg_replace("#\\[size=&quot;([^&]+)&quot;\\]#is", "[size=\\1]", $text);
     $text = preg_replace("#\\[font=&quot;([^&]+)&quot;\\]#is", "[font=\\1]", $text);
     $text = $parse->BB_Parse($text, false);
     //        $text = preg_replace('#\[.+?\]#si', "", $text);
     return $text;
 }
 /**
  * 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);
 }
Beispiel #21
0
function do_get_post()
{
    global $vbulletin, $db, $foruminfo, $threadinfo, $postid, $postinfo;
    $vbulletin->input->clean_array_gpc('r', array('type' => TYPE_STR));
    $type = 'html';
    if ($vbulletin->GPC['type']) {
        $type = $vbulletin->GPC['type'];
    }
    if (!$postinfo['postid']) {
        standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']));
    }
    if ((!$postinfo['visible'] or $postinfo['isdeleted']) and !can_moderate($threadinfo['forumid'])) {
        standard_error(fetch_error('invalidid', $vbphrase['post'], $vbulletin->options['contactuslink']));
    }
    if ((!$threadinfo['visible'] or $threadinfo['isdeleted']) and !can_moderate($threadinfo['forumid'])) {
        standard_error(fetch_error('invalidid', $vbphrase['thread'], $vbulletin->options['contactuslink']));
    }
    $forumperms = fetch_permissions($threadinfo['forumid']);
    if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])) {
        json_error(ERR_NO_PERMISSION);
    }
    if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) and ($threadinfo['postuserid'] != $vbulletin->userinfo['userid'] or $vbulletin->userinfo['userid'] == 0)) {
        json_error(ERR_NO_PERMISSION);
    }
    // check if there is a forum password and if so, ensure the user has it set
    verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
    $postbit_factory = new vB_Postbit_Factory();
    $postbit_factory->registry =& $vbulletin;
    $postbit_factory->forum =& $foruminfo;
    $postbit_factory->cache = array();
    $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    $post = $db->query_first_slave("\n\tSELECT\n\tpost.*, post.username AS postusername, post.ipaddress AS ip, IF(post.visible = 2, 1, 0) AS isdeleted,\n\t    user.*, userfield.*, usertextfield.*,\n\t    " . iif($foruminfo['allowicons'], 'icon.title as icontitle, icon.iconpath,') . "\n\t    IF(user.displaygroupid=0, user.usergroupid, user.displaygroupid) AS displaygroupid, infractiongroupid,\n\t\t" . iif($vbulletin->options['avatarenabled'], 'avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight,') . "\n\t\t" . ((can_moderate($threadinfo['forumid'], 'canmoderateposts') or can_moderate($threadinfo['forumid'], 'candeleteposts')) ? 'spamlog.postid AS spamlog_postid,' : '') . "\n\t\teditlog.userid AS edit_userid, editlog.username AS edit_username, editlog.dateline AS edit_dateline, editlog.reason AS edit_reason, editlog.hashistory,\n\t\tpostparsed.pagetext_html, postparsed.hasimages,\n\t\tsigparsed.signatureparsed, sigparsed.hasimages AS sighasimages,\n\t\tsigpic.userid AS sigpic, sigpic.dateline AS sigpicdateline, sigpic.width AS sigpicwidth, sigpic.height AS sigpicheight\n\t\t" . iif(!($permissions['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehiddencustomfields']), $vbulletin->profilefield['hidden']) . "\n\t\t{$hook_query_fields}\n\t\tFROM " . TABLE_PREFIX . "post AS post\n\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON(user.userid = post.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "userfield AS userfield ON(userfield.userid = user.userid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "usertextfield AS usertextfield ON(usertextfield.userid = user.userid)\n\t\t" . iif($foruminfo['allowicons'], "LEFT JOIN " . TABLE_PREFIX . "icon AS icon ON(icon.iconid = post.iconid)") . "\n\t\t" . iif($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)") . "\n\t\t" . ((can_moderate($threadinfo['forumid'], 'canmoderateposts') or can_moderate($threadinfo['forumid'], 'candeleteposts')) ? "LEFT JOIN " . TABLE_PREFIX . "spamlog AS spamlog ON(spamlog.postid = post.postid)" : '') . "\n\t\tLEFT JOIN " . TABLE_PREFIX . "editlog AS editlog ON(editlog.postid = post.postid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = " . intval(STYLEID) . " AND postparsed.languageid = " . intval(LANGUAGEID) . ")\n\t\tLEFT JOIN " . TABLE_PREFIX . "sigparsed AS sigparsed ON(sigparsed.userid = user.userid AND sigparsed.styleid = " . intval(STYLEID) . " AND sigparsed.languageid = " . intval(LANGUAGEID) . ")\n\t\tLEFT JOIN " . TABLE_PREFIX . "sigpic AS sigpic ON(sigpic.userid = post.userid)\n\t\t{$hook_query_joins}\n\t\tWHERE post.postid = {$postid}\n    ");
    $types = vB_Types::instance();
    $contenttypeid = $types->getContentTypeID('vBForum_Post');
    $attachments = $db->query_read_slave("\n\t\tSELECT\n\t\t\tfd.thumbnail_dateline, fd.filesize, IF(fd.thumbnail_filesize > 0, 1, 0) AS hasthumbnail, fd.thumbnail_filesize,\n\t\t\ta.dateline, a.state, a.attachmentid, a.counter, a.contentid AS postid, a.filename,\n\t\t\ttype.contenttypes\n\t\tFROM " . TABLE_PREFIX . "attachment AS a\n\t\tINNER JOIN " . TABLE_PREFIX . "filedata AS fd ON (a.filedataid = fd.filedataid)\n\t\tLEFT JOIN " . TABLE_PREFIX . "attachmenttype AS type ON (fd.extension = type.extension)\n\t\tWHERE\n\t\t\ta.contentid = {$postid}\n\t\t\t\tAND\n\t\t\ta.contenttypeid = {$contenttypeid}\n\t\tORDER BY a.attachmentid\n\t");
    $fr_images = array();
    while ($attachment = $db->fetch_array($attachments)) {
        $lfilename = strtolower($attachment['filename']);
        if (strpos($lfilename, '.jpe') !== false || strpos($lfilename, '.png') !== false || strpos($lfilename, '.gif') !== false || strpos($lfilename, '.jpg') !== false || strpos($lfilename, '.jpeg') !== false) {
            $tmp = array('img' => $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid']);
            if ($vbulletin->options['attachthumbs']) {
                $tmp['tmb'] = $vbulletin->options['bburl'] . '/attachment.php?attachmentid=' . $attachment['attachmentid'] . '&stc=1&thumb=1';
            }
            $fr_images[] = $tmp;
        }
    }
    $postbits = '';
    $postbit_obj =& $postbit_factory->fetch_postbit('post');
    $postbit_obj->cachable = $post_cachable;
    $postbits .= $postbit_obj->construct_postbit($post);
    if ($type == 'html') {
        $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
        $vbulletin->templatecache['bbcode_quote'] = '
<div style=\\"margin:0px; margin-top:0px;\\">
	<table cellpadding=\\"$stylevar[cellpadding]\\" cellspacing=\\"0\\" border=\\"0\\" width=\\"100%\\">
	<tr>
		<td class=\\"alt2\\" style=\\"border:1px solid #777777;\\">
			".(($show[\'username\']) ? ("
				<div>
					" . construct_phrase("$vbphrase[originally_posted_by_x]", "$username") . "
				</div>
				<div style=\\"font-style:italic\\">$message</div>
			") : ("
				$message
			"))."
		</td>
	</tr>
	</table>
</div>
	';
        $css = <<<EOF
<style type="text/css">
body {
  margin: 0;
  padding: 3;
  font: 13px Arial, Helvetica, sans-serif;
}
.alt2 {
  background-color: #e6edf5;
  font: 13px Arial, Helvetica, sans-serif;
}
html {
    -webkit-text-size-adjust: none;
}
</style>
EOF;
        $html = $css . $bbcode_parser->parse($post['pagetext']);
        $image = '';
    } else {
        if ($type == 'facebook') {
            $html = fetch_censored_text(strip_bbcode(strip_quotes($post['pagetext']), false, true));
            if (count($fr_images)) {
                $image = $fr_images[0]['img'];
            }
        }
    }
    // Figure out if we can post
    $canpost = true;
    if ($threadinfo['isdeleted'] or !$threadinfo['visible'] and !can_moderate($threadinfo['forumid'], 'canmoderateposts')) {
        $canpost = false;
    }
    if (!$foruminfo['allowposting'] or $foruminfo['link'] or !$foruminfo['cancontainthreads']) {
        $canpost = false;
    }
    if (!$threadinfo['open']) {
        if (!can_moderate($threadinfo['forumid'], 'canopenclose')) {
            $canpost = false;
        }
    }
    if (($vbulletin->userinfo['userid'] != $threadinfo['postuserid'] or !$vbulletin->userinfo['userid']) and (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyothers']))) {
        $canpost = false;
    }
    if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads']) or !($forumperms & $vbulletin->bf_ugp_forumpermissions['canreplyown']) and $vbulletin->userinfo['userid'] == $threadinfo['postuserid']) {
        $canpost = false;
    }
    // Avatar work
    $avatarurl = '';
    if ($post['avatarurl']) {
        $avatarurl = process_avatarurl($post['avatarurl']);
    }
    // Get post date/time
    $postdate = vbdate($vbulletin->options['dateformat'], $post['dateline'], 1);
    $posttime = vbdate($vbulletin->options['timeformat'], $post['dateline']);
    // Parse the post for quotes and inline images
    list($text, $nuked_quotes, $images) = parse_post($post['pagetext'], $post['allowsmilie'] && $usesmilies);
    $out = array('html' => prepare_utf8_string($html), 'post_id' => $post['postid'], 'thread_id' => $post['threadid'], 'forum_id' => $foruminfo['forumid'], 'forum_title' => prepare_utf8_string($foruminfo['title_clean']), 'username' => prepare_utf8_string(strip_tags($post['username'])), 'joindate' => prepare_utf8_string($post['joindate']), 'usertitle' => prepare_utf8_string(strip_tags($post['usertitle'])), 'numposts' => $post['posts'] ? (string) $post['posts'] : '0', 'userid' => $post['userid'], 'title' => prepare_utf8_string($post['title']), 'post_timestamp' => prepare_utf8_string(date_trunc($postdate) . ' ' . $posttime), 'canpost' => $canpost, 'quotable' => $nuked_quotes, 'canattach' => $forumperms & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] and $vbulletin->userinfo['userid'], 'edittext' => prepare_utf8_string($post['pagetext']));
    if ($avatarurl != '') {
        $out['avatarurl'] = $avatarurl;
    }
    if ($post['editlink']) {
        $out['canedit'] = true;
    }
    if ($image != '') {
        $out['image'] = $image;
    }
    return $out;
}
    if (verify_id('user', $pm['fromuserid'], false)) {
        print_label_row($vbphrase['rcd_pm_log_dump_from'], "<a target=\"_blank\" href=\"" . $admincpdir . "/user.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&u=" . $pm['fromuserid'] . "\"><b>" . $pm['fromusername'] . "</b></a> (" . $emailline . ", " . $ipline . ")");
    } else {
        print_label_row($vbphrase['rcd_pm_log_dump_from'], "<b>" . $pm['fromusername'] . " (" . $emailline . ", " . $ipline . ")</b>");
    }
    // show linked username only for existing users
    $emailline = $vbphrase['email'] . ": " . $pm['touseremail'];
    if (verify_id('user', $pm['touserid'], false)) {
        print_label_row($vbphrase['rcd_pm_log_dump_to'], "<a target=\"_blank\" href=\"" . $admincpdir . "/user.php?" . $vbulletin->session->vars['sessionurl'] . "do=edit&u=" . $pm['touserid'] . "\"><b>" . $pm['tousername'] . "</b></a> (" . $emailline . ")");
    } else {
        print_label_row($vbphrase['rcd_pm_log_dump_to'], "<b>" . $pm['tousername'] . " (" . $emailline . ")</b>");
    }
    print_label_row($vbphrase['rcd_pm_log_sent_date'], vbdate($vbulletin->options['logdateformat'], $pm['dateline']));
    print_label_row($vbphrase['subject'], $pm['title']);
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    // force to not allow html and images
    print_description_row(html_entity_decode($bbcode_parser->parse($pm['message'], 'privatemessage')), false, 2);
    /*
     print_description_row( $pm['message'], true, 2 );
    */
    print_table_footer(2);
}
print_cp_footer();
// ############## SOME FUNCTIONS ##########################################
function user_name_cell($user_name, $user_id = 0)
{
    global $vbulletin, $usermenus, $vbphrase, $user_name_tags;
    static $users;
    if (empty($users) or is_array($users) and !array_key_exists($user_name, $users)) {
        $users[$user_name] = verify_id('user', $user_id, false);
/**
* Parse message content for preview
*
* @param	array		Message and disablesmilies options
*
* @return	string	Eval'd html for display as the preview message
*/
function process_visitor_message_preview($message)
{
    global $vbulletin, $vbphrase, $show;
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    $previewhtml = '';
    if ($previewmessage = $bbcode_parser->parse($message['message'], 'socialmessage', $message['disablesmilies'] ? 0 : 1)) {
        $templater = vB_Template::create('visitormessage_preview');
        $templater->register('errorlist', $errorlist);
        $templater->register('message', $message);
        $templater->register('newpost', $newpost);
        $templater->register('previewmessage', $previewmessage);
        $previewhtml = $templater->render();
    }
    return $previewhtml;
}
Beispiel #24
0
	/**
	* Parse an input string with BB code to a final output string of HTML
	*
	* @param	string	Input Text (BB code)
	* @param	bool	Whether to parse smilies
	* @param	bool	Whether to parse img (for the video bbcodes)
	* @param	bool	Whether to allow HTML (for smilies)
	*
	* @return	string|false	String output Text (HTML) if a valid page, false if invalid page
	*/
	function parse_bbcode($input_text, $do_smilies, $do_imgcode, $do_html = false)
	{
		if ($this->output_page)
		{
			$this->current_page = 1;
			$this->pages = array(1 => array('title' => ''));
		}
		else
		{
			$this->current_page = 0;
			$this->pages = array();
		}

		if (!$this->candownload)
		{
			$do_imgcode = false;
		}

		$last_page_text = parent::parse_bbcode($input_text, $do_smilies, $do_imgcode, $do_html);

		$this->parse_output = '';
		$this->fetched_valid_page = true;

		if ($this->output_page)
		{
			if ($this->output_page == $this->current_page)
			{
				return $last_page_text;
			}
			else if (isset($this->pages[$this->output_page]))
			{
				return $this->pages[$this->output_page]['text'];
			}
			else
			{
				$this->fetched_valid_page = false;
				return '';
			}
		}
		else
		{
			return $last_page_text;
		}
	}
	/**
	* Prepare the text for display
	*/
	function process_text()
	{
		$this->message['message'] = $this->bbcode->parse(
			$this->message['pagetext'],
			'visitormessage',
			$this->message['allowsmilie']
		);
		$this->parsed_cache =& $this->bbcode->cached;

		if (!empty($this->message['del_reason']))
		{
			$this->message['del_reason'] = fetch_censored_text($this->message['del_reason']);
		}
	}
Beispiel #26
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)
	{
		return parent::do_parse($text, true, false, true, true, false, false, null, true);
	}
Beispiel #27
0
 /**
  * Prepare any data needed for the output
  *
  * @param	string	The id of the block
  * @param	array	Options specific to the block
  */
 function prepare_output($id = '', $options = array())
 {
     global $show, $vbphrase, $vbulletin, $userperms, $permissions;
     if ($vbulletin->options['reputationenable'] and ($this->profile->userinfo['showreputation'] or !($userperms['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canhiderep']))) {
         $reputations = $vbulletin->db->query_read_slave("\n\t\t\t\tSELECT user.username, reputation.whoadded, reputation.postid, thread.title, thread.forumid, post.threadid,\n\t\t\t\treputation.reputation, reputation.reason, reputation.dateline, thread.postuserid, reputation.reputationid\n\t\t\t\tFROM " . TABLE_PREFIX . "reputation AS reputation\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post USING (postid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread USING (threadid)\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = reputation.whoadded)\n\t\t\t\tWHERE reputation.userid = " . $this->profile->userinfo['userid'] . "\n\t\t\t\tAND thread.visible = 1 AND post.visible = 1\n\t\t\t\tORDER BY reputation.dateline DESC\n\t\t\t");
         $this->block_data['reputation'] = array();
         if ($vbulletin->userinfo['userid'] == $this->profile->userinfo['userid']) {
             $options['showraters'] = true;
         }
         require_once DIR . '/includes/class_bbcode.php';
         $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
         while ($reputation = $vbulletin->db->fetch_array($reputations) and $this->count < $options['comments']) {
             $forumperms = fetch_permissions($reputation['forumid']);
             if ($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'] and $forumperms & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and ($forumperms & $vbulletin->bf_ugp_forumpermissions['canviewothers'] or $reputation['postuserid'] == $vbulletin->userinfo['userid'])) {
                 $this->count++;
                 if ($reputation['reputation'] > 0) {
                     $reputation['posneg'] = 'pos';
                 } else {
                     if ($reputation['reputation'] < 0) {
                         $reputation['posneg'] = 'neg';
                     } else {
                         $reputation['posneg'] = 'balance';
                     }
                 }
                 $reputation['postinfo'] = array('p' => $reputation['postid']);
                 $reputation['threadinfo'] = array('title' => $reputation['title'], 'threadid' => $reputation['threadid']);
                 $reputation['timestamp'] = $reputation['dateline'];
                 $reputation['showraters'] = $options['showraters'];
                 $reputation['timeline'] = vbdate($vbulletin->options['timeformat'], $reputation['dateline']);
                 $reputation['dateline'] = vbdate($vbulletin->options['dateformat'], $reputation['dateline']);
                 $reputation['reason'] = $bbcode_parser->parse($reputation['reason']);
                 $reputation['username'] = $reputation['username'] ? $reputation['username'] : $vbphrase['n_a'];
                 if (empty($reputation['reason'])) {
                     $reputation['reason'] = $vbphrase['no_comment'];
                 }
                 ($hook = vBulletinHook::fetch_hook('member_profileblock_reputationbit')) ? eval($hook) : false;
                 $this->block_data['reputation'][] = $reputation;
             }
         }
     }
 }
Beispiel #28
0
	/**
	 * 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;

	}
Beispiel #29
0
}
$threadinfo['threadview'] = intval($threadview);
$displayed_dateline = 0;
################################################################################
############################### SHOW POLL ######################################
################################################################################
$poll = '';
if ($thread['pollid']) {
    $pollbits = '';
    $counter = 1;
    $pollid = $thread['pollid'];
    $show['editpoll'] = iif(can_moderate($threadinfo['forumid'], 'caneditpoll'), true, false);
    // get poll info
    $pollinfo = $db->query_first_slave("\n\t\tSELECT *\n\t\tFROM " . TABLE_PREFIX . "poll\n\t\tWHERE pollid = {$pollid}\n\t");
    require_once DIR . '/includes/class_bbcode.php';
    $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list());
    $pollinfo['question'] = $bbcode_parser->parse(unhtmlspecialchars($pollinfo['question']), $forum['forumid'], true);
    $splitoptions = explode('|||', $pollinfo['options']);
    $splitoptions = array_map('rtrim', $splitoptions);
    $splitvotes = explode('|||', $pollinfo['votes']);
    $showresults = 0;
    $uservoted = 0;
    if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canvote'])) {
        $nopermission = 1;
    }
    if (!$pollinfo['active'] or !$thread['open'] or $pollinfo['dateline'] + $pollinfo['timeout'] * 86400 < TIMENOW and $pollinfo['timeout'] != 0 or $nopermission) {
        //thread/poll is closed, ie show results no matter what
        $showresults = 1;
    } else {
        //get userid, check if user already voted
        $voted = intval(fetch_bbarray_cookie('poll_voted', $pollid));
Beispiel #30
0
 ($hook = vBulletinHook::fetch_hook('misc_bbcode_start')) ? eval($hook) : false;
 require_once DIR . '/includes/class_bbcode.php';
 $show['bbcodebasic'] = $vbulletin->options['allowedbbcodes'] & ALLOW_BBCODE_BASIC ? true : false;
 $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));