Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Fix for replacement code problem in vB Code
Steve Machol's Avatar
Steve Machol
Join Date: Nov 2001
Posts: 1,896

 

Show Printable Version Email this Page Subscription
Steve Machol Steve Machol is offline 03-08-2002, 10:00 PM

I'm almost embarrassed to call this a 'hack', particularly sincve it's not even mine! :stupid: Actually the code came from FireFly who PM'd me with the answer to this problem I posted on vb.com:

http://www.vbulletin.com/forum/showt...threadid=41430

The problem arises if you try to use replacement variables in vB Code. Beginning with 2.2.3, this no longer works. However the fix (thanks to Chen!) is simple. Just remove or comment out this line from admin/functions.php:

PHP Code:
$bbcode=str_replace("{""{"$bbcode); // stop people posting replacements in their posts 
Of course remving this line will cause the problem of people using replacement variables in posts. However in my case it's a good trade-off.
Reply With Quote
  #12  
Old 03-10-2002, 12:21 AM
Freddie Bingham's Avatar
Freddie Bingham Freddie Bingham is offline
 
Join Date: Oct 2001
Posts: 506
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It just stops things like {firstaltcolor} from being converted when you type them into a post.
Reply With Quote
  #13  
Old 03-10-2002, 06:06 AM
Mr. X's Avatar
Mr. X Mr. X is offline
 
Join Date: Oct 2001
Location: Iowa
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by smachol
Those are hardcoded into the script and cannot be altered by vB Code. To change them would require further hacking.
Im still confused here. Is this a hack that ONLY changes the Quote code, or is there something Im missing? Afterall its entitled "New code, PHP and quote boxes!". Im so very tired right now..
Reply With Quote
  #14  
Old 03-10-2002, 10:26 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should be able to move the line we told you to delete a bit up, before the parsing of vB codes, and then it'll also solve the problem. I don't have the code in front of me right now though
Reply With Quote
  #15  
Old 03-10-2002, 01:15 PM
Steve Machol's Avatar
Steve Machol Steve Machol is offline
 
Join Date: Nov 2001
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Please post that when you have a change FireFly.
Reply With Quote
  #16  
Old 03-10-2002, 04:47 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nah, if you do this it'll screw PHP code, because every left bracket will be replaced with its HTML entity and the code will be unreadable.
Reply With Quote
  #17  
Old 03-10-2002, 08:28 PM
Mr. X's Avatar
Mr. X Mr. X is offline
 
Join Date: Oct 2001
Location: Iowa
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by FireFly
You should be able to move the line we told you to delete a bit up, before the parsing of vB codes, and then it'll also solve the problem. I don't have the code in front of me right now though
Were you referring to my post or someone elses?
Reply With Quote
  #18  
Old 03-10-2002, 10:00 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by smachol
I'm almost embarrassed to call this a 'hack', particularly sincve it's not even mine! :stupid: Actually the code came from FireFly who PM'd me with the answer to this problem I posted on vb.com:

http://www.vbulletin.com/forum/showt...threadid=41430

The problem arises if you try to use replacement variables in vB Code. Beginning with 2.2.3, this no longer works. However the fix (thanks to Chen!) is simple. Just remove or comment out this line from admin/functions.php:

PHP Code:
$bbcode=str_replace("{""{"$bbcode); // stop people posting replacements in their posts[color=Radon3k][/color] 
Of course remving this line will cause the problem of people using replacement variables in posts. However in my case it's a good trade-off.
What do you mean by "Of course removing this line will cause the problem of people using replacement variables in posts."??

What are replacement variables? Do you need to install this hack, or just comment that line out? I'm a bit confused. Please explain (?)
Reply With Quote
  #19  
Old 03-10-2002, 11:21 PM
Steve Machol's Avatar
Steve Machol Steve Machol is offline
 
Join Date: Nov 2001
Posts: 1,896
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You cvan find out what replacement variable are by looking at the Replacement sets in your Admin CP. And what I meant was if someone uses a replacement variable in a post (like {firstaltcolor} ) this will automatically translate into the color in question if you remove this line.

I'm not sure if it's fixed here or not. If not, then this will show the hex code: {firstaltcolor}
Reply With Quote
  #20  
Old 03-10-2002, 11:25 PM
Radon3k's Avatar
Radon3k Radon3k is offline
 
Join Date: Nov 2001
Posts: 245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm still confused....I'm tryin to understand...My mind is going crazy....
Reply With Quote
  #21  
Old 03-11-2002, 06:30 AM
X-Fan's Avatar
X-Fan X-Fan is offline
 
Join Date: Jan 2002
Location: Adelaide, Australia
Posts: 496
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is this fixed in v2.2.4?
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 01:31 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06815 seconds
  • Memory Usage 2,309KB
  • Queries Executed 25 (?)
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
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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