vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Fix for replacement code problem in vB Code (https://vborg.vbsupport.ru/showthread.php?t=35894)

Steve Machol 03-08-2002 10:00 PM

Fix for replacement code problem in vB Code
 
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.

neal 03-09-2002 05:33 AM

isn't this corrected in 2.2.3?

Admin 03-09-2002 05:33 AM

No, this is caused by v2.2.3.

neal 03-09-2002 05:36 AM

oh, ok. Thanks then, I'm installing

Mr. X 03-09-2002 05:39 AM

Excellent. The quote looks great now, however Im still confused as to how do do this with PHP and list code.

Scrub 03-09-2002 02:56 PM

I do not understand this!? :confused:

Steve Machol 03-09-2002 03:43 PM

Quote:

Originally posted by Mr. X
Excellent. The quote looks great now, however Im still confused as to how do do this with PHP and list code.
Those are hardcoded into the script and cannot be altered by vB Code. To change them would require further hacking.

Mr. X 03-09-2002 06:52 PM

so it only works on vb.org?

Wayne Luke 03-09-2002 10:01 PM

I think that line of code is part of the cross-site scripting issue that was plugged in 2.2.3. While I don't think it will expose you to the entire problem it does present a weakness.

TECK 03-09-2002 11:38 PM

this is not changed in 223b grrrr...
lol i got it now.. damn i'm slow sometimes.. this line must be removed only if you installed firefly's hack

Freddie Bingham 03-10-2002 12:21 AM

It just stops things like {firstaltcolor} from being converted when you type them into a post.

Mr. X 03-10-2002 06:06 AM

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.. :)

Admin 03-10-2002 10:26 AM

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

Steve Machol 03-10-2002 01:15 PM

Please post that when you have a change FireFly.

Admin 03-10-2002 04:47 PM

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.

Mr. X 03-10-2002 08:28 PM

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?

Radon3k 03-10-2002 10:00 PM

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 (?)

Steve Machol 03-10-2002 11:21 PM

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}

Radon3k 03-10-2002 11:25 PM

I'm still confused....I'm tryin to understand...My mind is going crazy....

X-Fan 03-11-2002 06:30 AM

Is this fixed in v2.2.4?

Steve Machol 03-11-2002 01:38 PM

No it's not 'fixed'. Read Wayne Luke's response above.

Mr. X 03-12-2002 11:59 AM

Can it be cleared whethor or not this hack can be used for the other codes? Im still confused here. All I get is a great quote effect, but just that, and I would like it for the other codes too.

Steve Machol 03-12-2002 02:26 PM

I'm not sure what you're asking or what your are confused about. All this does is allow people replacement variables to be used in posts. In my case I needed this for the quote box. In fact, that's my only use for it.

Mr. X 03-12-2002 11:11 PM

Ok. The hack is called New code, PHP and quote boxes. Well the only thing that changes is the Quote. I would like the same effect for PHP and other codes.

I had a problem when adding the variables, because the color would not change. This thread fixed it. But Im still wondering how to do the rest of the codes. on Vb.org, php code has the same effect, thats what I want to achieve, to have all codes look like the Quote code.

Radon3k 03-23-2002 03:02 AM

Ok so again, cuz I'm smart like that, you install the original hack by FireFly, then you do the update from this page, correct?

Admin 03-23-2002 07:19 AM

Yes.

feldon23 03-23-2002 08:19 AM

Sorry, but this is not working for me AT ALL.

Just installed 2.2.4, all my Admin templates are factory.

I go into admin/functions.php and comment out (even tried removing) the line:

$bbcode=str_replace <http://www.php.net/str_replace>("{", "{", $bbcode); // stop people posting replacements in their posts

and reupload it.


then I go into Custom vBCodes >Modify and try either of these:

<blockquote><font face="verdana,arial,helvetica" size="1" >quote:</font><hr><br><table cellpadding="4"cellspacing="0" border=1 bordercolor="#0A293E" bgcolor="#0E3652"
width="90%" align="center"><tr><td><font size="2">{param}</font></tr></td></table><br><hr></blockquote>

<blockquote><font face="verdana,arial,helvetica" size="1" >quote:</font><hr><br><table cellpadding="4" cellspacing="0" border=1 bordercolor="#5F9EA0" bgcolor="#1C5780" width="90%" align="center"><tr><td><font size="2">{param}</font></tr></td></table><br><hr></blockquote>

it goes absolutely apes*** with shredded table pieces all over the place.

and if I do:

<table cellpadding="4"cellspacing="0" border=1 bordercolor="#0A293E" bgcolor="#0E3652"
width="90%" align="center"><tr><td><font size="2">{param}</font></tr></td></table>

I get a green box.

The only thing that works is this:
<table cellpadding="4" cellspacing="0" border=1 bordercolor="#5F9EA0" bgcolor="#1C5780" width="90%" align="center"><tr><td><font size="2" color=FFFFFF>{param}</font></tr></td></table>

It's like there's a limit on how much HTML I can put in.

Steve Machol 03-23-2002 02:45 PM

Yes, there's a character limit in the vB Code box.

feldon23 03-23-2002 05:49 PM

Is there an easy way to change max characters?

I looked in admin/bbcode.php but changing the numbers to 60 didn't seem enough of a solution.

Radon3k 03-23-2002 08:23 PM

If I comment out that line, it gives me a parse error on like #1348. have no clue as to why it does, but it seems to work fine if I just do the normal hack.

Steve Machol 03-24-2002 12:51 AM

I have no idea why you'd get a parse error unless to entered something wrong in the file. Commenting this line out worked fine for me.

Radon3k 03-24-2002 01:02 AM

hrmm...Well it works normally without commenting it out...So I guess I can leave it like this?

Steve Machol 03-24-2002 02:03 AM

As I said in my first post you only need to do this if you want to use replacement variables in vB Code. If you don't need that function, then you don't need to bother with this.

Radon3k 03-24-2002 02:13 AM

Ah ok, then I'm straight I guess...Nice, thanks! :)

Steve Machol 03-24-2002 02:17 AM

No probs! :)

Admin 03-24-2002 11:37 AM

Quote:

Originally posted by feldon23
Is there an easy way to change max characters?

I looked in admin/bbcode.php but changing the numbers to 60 didn't seem enough of a solution.

Yeah you need to run a query tho:
Code:

ALTER TABLE bbcode CHANGE bbcodereplacement bbcodereplacement TEXT;

Jawelin 03-26-2002 09:14 AM

I got almost confused when saw in admin/functions.php of VB 2.2.4, within the
function bbcodeparse2() two lines (with some other between) like these:
PHP Code:

  //$bbcode=str_replace("{", "{", $bbcode);
.
.
.
    
$bbcode=str_replace("{""{"$bbcode); // stop people posting replacements in their posts 

Questions are:
- Has the problem been solved in 2.2.4 with the above splitting or no ?
- Is cutting out the second line still necessary ?
- How could I generate the problem to see if that bugfix is actually needed by my board ?

Thanks a lot, Steve.

Bye

Admin 03-26-2002 12:22 PM

The line was moved to the end of the function to stop (I think) problems when posting PHP code. But you still need to comment the second line if you want to be able to use replacement variables in your vB Codes.

Jawelin 03-26-2002 01:59 PM

Absolutelly exaustive. Thanks a lot.

Harvey 04-10-2002 03:00 PM

Hi,

this hack has a disadvantage: text attachments are also parsed.

If you have eg. the following description in it (without spaces)
Code:

change in template xxx
{ secondaltcolor}FireFly
to
{ secondaltcolor}Chen

it will be shown as:
change in template xxx
#DFDFDFFireFly
to
#DFDFDFChen


All times are GMT. The time now is 10:44 AM.

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.02453 seconds
  • Memory Usage 1,815KB
  • 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
  • (2)bbcode_code_printable
  • (3)bbcode_php_printable
  • (5)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
  • (40)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