Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-03-2004, 07:41 PM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default parse_bbcode

Hi, i'm new to hacking/modifying VB. Can someone tell me why the following code returns {i}test{/i}: (Note: i changed [ ] to { } so this forum doesnt parse it)

<?php
require_once("forums/includes/functions.php");
require_once("forums/includes/functions_bbcodeparse.php");
echo parse_bbcode("{i}test{/i}");
?>
Reply With Quote
  #2  
Old 04-03-2004, 07:47 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

parse_bbcode parses code depending on the signature settings, or specific forumsettings

if you want to explicitly parse some code, you have to use parse_bbcode2
Reply With Quote
  #3  
Old 04-03-2004, 07:57 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon
parse_bbcode parses code depending on the signature settings, or specific forumsettings

if you want to explicitly parse some code, you have to use parse_bbcode2
What file do you need to include to use parse_bbcode2?
Reply With Quote
  #4  
Old 04-03-2004, 08:00 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

functions_bbcodeparse.php
Reply With Quote
  #5  
Old 04-03-2004, 08:08 PM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks Xenon,

<?php
require_once("forums/includes/functions.php");
require_once("forums/includes/functions_bbcodeparse.php");
echo parse_bbcode2('test', 0, 0, 0, 1, 0, 1);
?>

I wish i could say that worked but I get an error saying call to a member of a non-existant object. Looked into it, seems it tries to use the DB_Sql_vb class in db_mysql.php... So i figured if i instantiated that class and included config.php and db_mysql.php maybe the problem would go away...

<?php

require_once('forums/includes/config.php');
require_once('forums/includes/db_mysql.php');

$DB_site = new DB_Sql_vb;

$DB_site->appname = 'vBulletin';
$DB_site->appshortname = 'vBulletin (' . VB_AREA . ')';
$DB_site->database = $dbname;

$DB_site->connect($servername, $dbusername, $dbpassword, $usepconnect);

require_once("forums/includes/functions.php");
require_once("forums/includes/functions_bbcodeparse.php");

echo parse_bbcode2('test', 0, 0, 0, 1, 0, 1);

?>

When i do that i get the VB error:

There seems to have been a slight problem with the database.
Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.
Reply With Quote
  #6  
Old 04-03-2004, 08:08 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When I tried that with this it gave me an error:

PHP Code:
    require_once('./includes/functions_bbcodeparse.php');
    
$profilefield['value'] = parse_bbcode2(unhtmlspecialchars($profilefield['value'])); 
Reply With Quote
  #7  
Old 04-03-2004, 08:12 PM
Xenon's Avatar
Xenon Xenon is offline
 
Join Date: Oct 2001
Location: Bavaria
Posts: 12,878
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

bob, you may look at the signature of that function first

@nsanden: you should require global.php before
Reply With Quote
  #8  
Old 04-03-2004, 08:28 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Xenon
bob, you may look at the signature of that function first

@nsanden: you should require global.php before
I looked in the functions_bbcodeparse.php and tried to add the numbers after it but it still gave me the error. It only worked when I took out the unhtmlspecialchars and I don't want to turn on html to filter those. Am I doing something wrong?
Reply With Quote
  #9  
Old 04-03-2004, 08:31 PM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You actually got it to work? Can you show me your working code?

I still can't get it to work...

http://www.savingadvice.com/forums/test.php
http://www.savingadvice.com/forums/test.php?source=1
Reply With Quote
  #10  
Old 04-03-2004, 08:37 PM
nsanden nsanden is offline
 
Join Date: Nov 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Wow i take that back! Finally works!!! Appreciate the help guys.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:37 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.04403 seconds
  • Memory Usage 2,252KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete