vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Phrase BBCODE & HTML (https://vborg.vbsupport.ru/showthread.php?t=104193)

PennylessZ28 01-01-2006 09:00 PM

Phrase BBCODE & HTML
 
This is my method for phrasing BBCODE in the user profile field. I want to allow HTML to pass through aswell.

PHP Code:

if ($userinfo['field1'])
{
if (!
is_object($bbcode_parser))
{
    require_once(
DIR '/includes/class_bbcode.php');
    
$bbcode_parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());
}
$userinfo['field1'] = $bbcode_parser->parse($userinfo['field1'],0true);


I know that to phrase bbcode you do something like this

PHP Code:

require_once(DIR '/includes/class_bbcode.php'); 
$parser =& new vB_BbCodeParser($vbulletinfetch_tag_list()); 
$parsed_text $parser->do_parse($text$do_html$do_smilies$do_bbcode$do_imgcode$do_nl2br$cachable); 

The parameters for method do_parse() are:
  • $text = Text to be parsed
  • $do_html = Whether to allow HTML or not (Default = false)
  • $do_smilies = Whether to parse smilies or not (Default = true)
  • $do_bbcode = Whether to parse BB code (Default = true)
  • $do_imgcode = Whether to parse the [img] BB code or not, independant of $do_bbcode (Default = true)
  • $do_nl2br = Whether to automatically replace new lines with HTML line breaks or not (Default = true)
    This should be set to false if you allow HTML.
  • $cachable = Whether the post text is cachable or not (Default = false)
So I can use BBCODE in the fields fine, but if I use HTML it comes out screwed up.

PennylessZ28 01-03-2006 12:40 AM

oh you don't say??

Guest190829 01-03-2006 12:44 AM

PHP Code:

$parsed_text $parser->do_parse($texttruetruetruetrue,truetrue); 

Try that, and theres security risks for allowing HTML...

The Chief 01-04-2006 05:29 AM

Quote:

Originally Posted by Danny.VBT
$parsed_text = $parser->do_parse($text, true, true, true, true,true, true);

ok lets say I would like an input field on my Memberinfo page to enable HTML. So that members can just type in some HTML in the input fields and something would parse it so that when you visit the member's profile page you see the right stuff rather then just seeing the code.

Can this be done? If so, please show me how, I am a PHP newb...

Thanks!

restless 01-09-2006 05:18 AM

PHP Code:

// 
// START PHP CODE
 
if ($userinfo['field1']) 

if (!
is_object($bbcode_parser)) 

    require_once(
DIR '/includes/class_bbcode.php'); 
    
$bbcode_parser =& new vB_BbCodeParser($vbulletinfetch_tag_list());  

$userinfo['field1'] = $bbcode_parser->parse($userinfo['field1'],0true); 
$userinfo['field1'] = html_entity_decode($userinfo['field1']);
}   

// END PHP CODE 
// 

works for me: http://vagrantcafe.com/forum/carter

gibhut 01-19-2006 07:01 PM

What i did was made a new Function for parsing bbcode
take the orginal do_parse function in the class_bbcode.php and copy it. i pasted it and named it do_bulletin_parse
and made this small change in it
Code:

// ********************* REMOVE HTML CODES ***************************
                if (!$do_html)
                {
                        //$text = htmlspecialchars_uni($text);
                }
                $html_allowed = $do_html;

                $text = $this->parse_whitespace_newlines($text, $do_nl2br);

$body = $bbcode_parser->do_bulletin_parse($body, true, true, true, true,true, true);


All times are GMT. The time now is 05:01 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01248 seconds
  • Memory Usage 1,738KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete