vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   parse_bbcode (https://vborg.vbsupport.ru/showthread.php?t=63412)

nsanden 04-03-2004 06:41 PM

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}");
?>

Xenon 04-03-2004 06:47 PM

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

Boofo 04-03-2004 06:57 PM

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?

Xenon 04-03-2004 07:00 PM

functions_bbcodeparse.php ;)

nsanden 04-03-2004 07:08 PM

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.

Boofo 04-03-2004 07:08 PM

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'])); 


Xenon 04-03-2004 07:12 PM

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

@nsanden: you should require global.php before :)

Boofo 04-03-2004 07:28 PM

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?

nsanden 04-03-2004 07:31 PM

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

nsanden 04-03-2004 07:37 PM

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


All times are GMT. The time now is 11:46 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.01537 seconds
  • Memory Usage 1,737KB
  • 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_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete