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); }
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); }
} 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); } // show linked username only for existing users
/** * 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); }
/** * 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; }
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; }
$saveparsed = ''; while ($post = $db->fetch_array($posts)) { # Only cache posts for the chosen style if this post belongs to a forum with a styleoverride if ($vbulletin->forumcache["$post[forumid]"]['options'] & $vbulletin->bf_misc_forumoptions['styleoverride']) { $styleid = $vbulletin->forumcache["$post[forumid]"]['styleid']; $vbulletin->templatecache =& $stylelist["$styleid"]['templatelist']; // The fact that we use $userinfo here means that if you were to use any language specific stylevars in these templates (which we don't do by default), they would be of this user's language // The only remedy for this is to create even more scenarios in the post parsed table with left -> right, right -> left and the imageoverride folder :eek: $vbulletin->stylevars = $stylelist["$styleid"]['newstylevars']; fetch_stylevars($stylelist["$styleid"], $vbulletin->userinfo); $parsedtext = $bbcode_parser->parse($post['pagetext'], $post['forumid'], $post['allowsmilie'], false, '', false, true); $saveparsed .= ", ($post[postid], " . intval($post['lastpost']) . ", " . intval($bbcode_parser->cached['has_images']) . ", '" . $db->escape_string($bbcode_parser->cached['text']) . "', " . intval($styleid) . ", " . intval(LANGUAGEID) . " )"; echo construct_phrase($vbphrase['processing_x'], $post['postid']) . "<br />\n"; } else { echo construct_phrase($vbphrase['processing_x'], $post['postid']) . "\n"; $count = 0;
} 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) { $reputation['title'] = fetch_trimmed_title($reputation['title'], 24); } ($hook = vBulletinHook::fetch_hook('usercp_reputationbit')) ? eval($hook) : false; $pageinfo = array('p' => $reputation['postid']); $templater = vB_Template::create('usercp_reputationbits'); $templater->register('pageinfo', $pageinfo); $templater->register('posneg', $posneg); $templater->register('reputation', $reputation); $templater->register('reputationbgclass', $reputationbgclass); $templater->register('threadinfo', $threadinfo); $reputationcommentbits .= $templater->render(); $show['reputation'] = true; }
function fr_parse_pm_bbcode($bbcode, $smilies = true) { require_once DIR . '/includes/class_core.php'; require_once DIR . '/includes/class_bbcode.php'; $bbcode_parser = new vB_BbCodeParser(vB::get_registry(), fetch_tag_list()); return $bbcode_parser->parse($bbcode, 'privatemessage', $smilies); }
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; }
/** * Prepare the text for display */ function process_text() { $this->note['message'] = $this->bbcode->parse($this->note['pagetext'], 'pt'); }
/** * 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'); } }
function parse_calendar_bbcode($bbcode, $smilies = true) { global $calendarinfo, $vbulletin; require_once DIR . '/includes/class_bbcode.php'; $bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $bbcode = $bbcode_parser->parse($bbcode, 'calendar', $smilies); return $bbcode; }
/** * 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); }
/** * 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; } } } }
/** * Collect parser options and misc data and fully parse the string into an HTML version- disable images * * @param string Unparsed text * * @return string Parsed text * @param int|str ID number of the forum whose parsing options should be used or a "special" string */ function parse($text, $forumid = 0) { return parent::parse($text, $forumid, false, false, '', false); }
if ($bbcode['twoparams']) { $bbcode['tag'] = '[' . $bbcode['bbcodetag'] . '=<span class="highlight">' . $vbphrase['option'] . '</span>]<span class="highlight">' . $vbphrase['value'] . '</span>[/' . $bbcode['bbcodetag'] . ']'; } else { $bbcode['tag'] = '[' . $bbcode['bbcodetag'] . ']<span class="highlight">' . $vbphrase['value'] . '</span>[/' . $bbcode['bbcodetag'] . ']'; } ($hook = vBulletinHook::fetch_hook('misc_bbcode_bit')) ? eval($hook) : false; eval('$template[\'bbcodebits\'] .= "' . fetch_template('help_bbcodes_bbcode') . '";'); eval('$template[\'bbcodelinks\'] .= "' . fetch_template('help_bbcodes_link') . '";'); } $navbits = construct_navbits(array('faq.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['faq'], '' => $vbphrase['bbcode_list'])); $show['iewidthfix'] = (is_browser('ie') and !is_browser('ie', 6)); $stylevar['codeblockwidth'] = 'auto'; $vbulletin->options['allowhtml'] = false; $vbulletin->options['allowbbcode'] = true; // ### CODE tag $specialbbcode['code'] = $bbcode_parser->parse("[code]<script type=\"text/javascript\">\n<!--\n\talert(\"Hello world!\");\n//-->\n</script>[/code]", 0, false); // ### HTML Tag $specialbbcode['html'] = $bbcode_parser->parse("[html]<img src=\"image.gif\" alt=\"image\" />\n<a href=\"testing.html\" target=\"_blank\">Testing</a>[/html]", 0, false); // ### PHP Tag $specialbbcode['php'] = $bbcode_parser->parse("[php]\$myvar = 'Hello World!';\nfor (\$i = 0; \$i < 10; \$i++)\n{\n\techo \$myvar . \"\\n\";\n}[/php]", 0, false); // ### Quote Tag $specialbbcode['quote1'] = $bbcode_parser->parse("[quote]Lorem ipsum dolor sit amet[/quote]", 0, false); $specialbbcode['quote2'] = $bbcode_parser->parse("[quote=John Doe]Lorem ipsum dolor sit amet[/quote]", 0, false); $max_post = $db->query_first_slave("SELECT MAX(postid) AS maxpostid FROM " . TABLE_PREFIX . "post"); $max_post['maxpostid'] = intval($max_post['maxpostid']); $specialbbcode['quote3'] = $bbcode_parser->parse("[quote=John Doe;{$max_post['maxpostid']}]Lorem ipsum dolor sit amet[/quote]", 0, false); // ### Special URL for Image if (preg_match('#^[a-z0-9]+://#si', $stylevar['imgdir_statusicon'])) { $statusicon_dir = $stylevar['imgdir_statusicon']; } else { $statusicon_dir = $vbulletin->options['bburl'] . '/' . $stylevar['imgdir_statusicon'];
while ($post = $db->fetch_array($posts)) { if ($postcounter++ < $vbulletin->options['maxposts']) { exec_switch_bg(); $posttime = vbdate($vbulletin->options['timeformat'], $post['dateline']); $postdate = vbdate($vbulletin->options['dateformat'], $post['dateline'], 1); $username = $post['username']; if ($ignore["$post[userid]"]) { $reviewmessage = $ignoreduser; } else { $reviewmessage = $bbcode_parser->parse($post['pagetext'], $foruminfo['forumid'], $post['allowsmilie']); } // do word wrap $reviewtitle = ($vbulletin->options['wordwrap'] ? fetch_word_wrapped_string($post['title']) : ''); $reviewtitle = fetch_censored_text($reviewtitle); ($hook = vBulletinHook::fetch_hook('newreply_form_reviewbit')) ? eval($hook) : false; $templater = vB_Template::create('newreply_reviewbit'); $templater->register('post', $post); $templater->register('postdate', $postdate); $templater->register('posttime', $posttime); $templater->register('reviewmessage', $reviewmessage); $templater->register('reviewtitle', $reviewtitle); $templater->register('username', $username);
/** * 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; }
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 ############################### if ($_REQUEST['do'] == 'editthread') {
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']; } $body = $xml->parse_template($body_template, $item); if ($vbulletin->GPC['options']['html2bbcode']) { $body = convert_wysiwyg_html_to_bbcode($body, false, true); } $body = $bbcode_parser->parse($body, 0, false); $output .= '<div class="alt2" style="border:inset 1px; padding:5px; width:400px; height: 175px; margin:10px; overflow: auto;"><h3><em>' . $title . '</em></h3>' . $body . '</div>'; } $feed = array(); foreach ($input_vars as $varname => $foo) { $feed["{$varname}"] = $vbulletin->GPC["{$varname}"];
$total += $postreputation['reputation']; if ($postreputation['reputation'] > 0) { $posneg = 'pos'; } else if ($postreputation['reputation'] < 0) { $posneg = 'neg'; } else { $posneg = 'balance'; } if (!empty($postreputation['reason'])) { $reason = $bbcode_parser->parse($postreputation['reason']); } else { $reason = $vbphrase['n_a']; } exec_switch_bg(); ($hook = vBulletinHook::fetch_hook('reputation_viewown_bit')) ? eval($hook) : false; $templater = vB_Template::create('reputation_reasonbits'); $templater->register('posneg', $posneg); $templater->register('reason', $reason); $reputation_reasonbits .= $templater->render(); }
/** * 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'] ); }
} // 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'); $editorid = construct_edit_toolbar(
/** * 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']); } }
/** * Collect parser options and misc data and fully parse the string into an HTML version- disable images * * @param string Unparsed text * * @return string Parsed text * @param int|str ID number of the forum whose parsing options should be used or a "special" string */ function parse($text, $forumid = 0, $allowsmilie = true, $isimgcheck = false, $parsedtext = '', $parsedhasimages = 3, $cachable = false, $htmlstate = null) { return parent::parse($text, $forumid, false, false, '', false); }
$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)); if ($voted) {
$bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); // post is cachable if option is enabled, last post is newer than max age, and this user // isn't showing a sessionhash $post_cachable = ($vbulletin->options['cachemaxage'] > 0 and TIMENOW - $vbulletin->options['cachemaxage'] * 60 * 60 * 24 <= $threadinfo['lastpost'] and $vbulletin->session->vars['sessionurl'] == ''); $saveparsed = array(); $posts = $db->query_read_slave("\n\t\tSELECT\n\t\t\tpost.*, IF(post.userid = 0, post.username, user.username) AS username,\n\t\t\tpostparsed.pagetext_html, postparsed.hasimages\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 . "postparsed AS postparsed ON(postparsed.postid = post.postid AND postparsed.styleid = " . intval(STYLEID) . " AND postparsed.languageid = " . intval(LANGUAGEID) . ")\n\t\tWHERE post.visible = 1\n\t\t\t{$globalignore}\n\t\t\tAND post.threadid = {$threadinfo['threadid']}\n\t\tORDER BY dateline DESC, postid DESC\n\t\tLIMIT " . ($vbulletin->options['maxposts'] + 1)); while ($post = $db->fetch_array($posts)) { if ($postcounter++ < $vbulletin->options['maxposts']) { exec_switch_bg(); $posttime = vbdate($vbulletin->options['timeformat'], $post['dateline']); $postdate = vbdate($vbulletin->options['dateformat'], $post['dateline'], 1); $username = $post['username']; if ($ignore["{$post['userid']}"]) { $reviewmessage = $ignoreduser; } else { $reviewmessage = $bbcode_parser->parse($post['pagetext'], $foruminfo['forumid'], $post['allowsmilie'], false, $post['pagetext_html'], $post['hasimages'], $post_cachable); if ($post_cachable and $post['pagetext_html'] == '') { $saveparsed[] = "({$post['postid']}, " . intval($threadinfo['lastpost']) . ', ' . intval($bbcode_parser->cached['has_images']) . ", '" . $db->escape_string($bbcode_parser->cached['text']) . "', " . intval(STYLEID) . ", " . intval(LANGUAGEID) . ")"; } } // do word wrap $reviewtitle = $vbulletin->options['wordwrap'] ? fetch_word_wrapped_string($post['title']) : ''; $reviewtitle = fetch_censored_text($reviewtitle); ($hook = vBulletinHook::fetch_hook('newreply_form_reviewbit')) ? eval($hook) : false; eval('$threadreviewbits .= "' . fetch_template('newreply_reviewbit') . '";'); } else { break; } } // save parsed post HTML if (!empty($saveparsed)) {