PDA

View Full Version : Fix for replacement code problem in vB Code


Steve Machol
09 Mar 2002, 05:48
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/showthread.php?s=&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:

$bbcode=str_replace("{", "{", $bbcode); // stop people posting replacements in their postsOf 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
09 Mar 2002, 06:33
isn't this corrected in 2.2.3?

Chen
09 Mar 2002, 06:33
No, this is caused by v2.2.3.

neal
09 Mar 2002, 06:36
oh, ok. Thanks then, I'm installing

Mr. X
09 Mar 2002, 06:39
Excellent. The quote looks great now, however Im still confused as to how do do this with PHP and list code.

Scrub
09 Mar 2002, 15:56
I do not understand this!? :confused:

Steve Machol
09 Mar 2002, 16:43
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
09 Mar 2002, 19:52
so it only works on vb.org?

Wayne Luke
09 Mar 2002, 23:01
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
10 Mar 2002, 00:38
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
10 Mar 2002, 01:21
It just stops things like {firstaltcolor} from being converted when you type them into a post.

Mr. X
10 Mar 2002, 07:06
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.. :)

Chen
10 Mar 2002, 11:26
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
10 Mar 2002, 14:15
Please post that when you have a change FireFly.

Chen
10 Mar 2002, 17:47
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
10 Mar 2002, 21:28
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
10 Mar 2002, 23:00
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/showthread.php?s=&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:

$bbcode=str_replace("{", "{", $bbcode); // stop people posting replacements in their postsOf 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
11 Mar 2002, 00:21
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
11 Mar 2002, 00:25
I'm still confused....I'm tryin to understand...My mind is going crazy....

X-Fan
11 Mar 2002, 07:30
Is this fixed in v2.2.4?

Steve Machol
11 Mar 2002, 14:38
No it's not 'fixed'. Read Wayne Luke's response above.

Mr. X
12 Mar 2002, 12:59
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
12 Mar 2002, 15:26
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
13 Mar 2002, 00:11
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
23 Mar 2002, 04:02
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?

Chen
23 Mar 2002, 08:19
Yes.

feldon23
23 Mar 2002, 09:19
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
23 Mar 2002, 15:45
Yes, there's a character limit in the vB Code box.

feldon23
23 Mar 2002, 18:49
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
23 Mar 2002, 21:23
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
24 Mar 2002, 01:51
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
24 Mar 2002, 02:02
hrmm...Well it works normally without commenting it out...So I guess I can leave it like this?

Steve Machol
24 Mar 2002, 03:03
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
24 Mar 2002, 03:13
Ah ok, then I'm straight I guess...Nice, thanks! :)

Steve Machol
24 Mar 2002, 03:17
No probs! :)

Chen
24 Mar 2002, 12:37
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:
ALTER TABLE bbcode CHANGE bbcodereplacement bbcodereplacement TEXT;

Jawelin
26 Mar 2002, 10:14
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:

//$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

Chen
26 Mar 2002, 13:22
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
26 Mar 2002, 14:59
Absolutelly exaustive. Thanks a lot.

Harvey
10 Apr 2002, 16:00
Hi,

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

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

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

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

212rikanmofo
19 Apr 2002, 19:12
i want to install that quote box hack by firefly, but do i need to run this hack to? im running vb 2.2.5...

Steve Machol
19 Apr 2002, 21:25
Don't rightly know. It depends on whether or not that hack uses vB Code.

Chen
20 Apr 2002, 07:12
Yes you do.

FleaBag
18 May 2002, 15:15
Thanks for this, enables me to hack 2.2.5 much more! :D

FleaBag
19 Jun 2002, 20:08
Helped me on 2.2.6, thanks. :)

Chen
20 Jun 2002, 06:09
You everywhere!

FleaBag
20 Jun 2002, 10:17
I'm starting to notice a pattern here...

Link14716
22 Jun 2002, 14:28
*Installs*

Thanks for this. :D

fonzerelli_79
23 Jun 2002, 23:40
dont know why but when i upgraded from 2.20 to 2.26 and reapllied the changes (removed the line, reapplied the hack etc) it doesnt work and i get an error instead

Parse error: parse error in /manutdchat.com/forums/admin/ functions.php on line 2384

(the line above is the last line on the file)

Fatal error: Call to undefined function: vbdate() in manutdchat.com/forums/admin/sessions.php on line 358

;)

Steve Machol
24 Jun 2002, 02:51
A parse error usually indicates a typo or some other error in editing. Start with a fresh functions.php and try applying the hack again.

Sinecure
27 Jun 2002, 02:50
Yeah, i had this problem with 2.2.6, worked well, thanks :)

cbn
15 Jul 2002, 18:13
Hi,

I've been directed to this thread from this thread (http://207.68.162.250/cgi-bin/linkrd?_lang=EN&lah=a546b8f8868906f4ecb2316ea42c8fc1&lat=1026754753&hm___action=http%3a%2f%2fwww%2evbulletin%2eorg%2fforum%2fshowthread%2ephp%3fthre adid%3d41096%26goto%3dnewpost)...

however, I'm still confused.

I need to be able to use a [tag] of some sort so that whenever I edit a post, the [tag] code is there instead of the replacement HTML code.

Say I create a replacement:

[dad] => <a href="http://www.commanderbond.net/Categories/9.html">Die Another Day</a>

So, I then post a topic:

Check out the lastest Bond news here at [dad]

Say I want to then edit the post, at the moment, all I get is:

Check out the lastest Bond news here a <a href="http://www.commanderbond.net/Categories/9.html">Die Another Day</a>

How can I get it to display:

Check out the lastest Bond news here at [dad]

...when editing a post...?

Chen
16 Jul 2002, 07:35
You can't, you need to make [dad] a vB Code.

Xenon
16 Jul 2002, 11:17
or he can make small modifications to your /me hack chen ;)

FleaBag
03 Sep 2002, 03:18
Works with 2.2.7. :D

Chris M
29 Oct 2002, 23:12
Gamer:mad: - http://www.vbulletin.org/forum/showthread.php?s=&action=showpost&postid=316171

Satan

FleaBag
29 Oct 2002, 23:19
So you're infuriated about me posting in every hack I have installed - but it'd OK for you to come behind me and post the same message over and over when you don't even have the hacks installed? Hmmm...

Kids...

FleaBag
29 Oct 2002, 23:23
And add to that the fact you've managed to post something as basic as "cool" in practically every hack that has got released.

Erwin
29 Oct 2002, 23:25
Alright, let's take this offline - move to PM if you have to, but don't use this support thread as your private forum to argue with one another (I am referring to both Gamersforum and hellsatan).

As a note: it is okay to post a note saying that the installation has worked in a hack thread - that is fine. The hack author likes to hear feedback about his own hacks. Posting that the hack works for 2.2.8 is in general fine too. I have no real problems with Gamerforum's posts actually (I do keep track of the members here. :) ) In future, if members find something wrong with another member's post, do report the post - a mod will have a look at it.

DrkFusion
29 Oct 2002, 23:25
By doing that you can clearly see that the similar message has been posted like so, and maybe you can see that the hacks that you posted for that, have only 1 - 4 modifications to files, where the coding has not changed from 2.2.1-2.2.8, and in the thread others have implied that it works for 2.2.7, or 2.2.8, as you being a the 'adult' should be know majority of the code for files hasn't been changed since 2.2.1, and somtimes even after 2.0.2, and be able to probably add more to the "Great Works with 2.2.8" phrase. Sure comments are good, but the same thing all the time, seems like a form of spam.

I don't want to start no fight between, me, you, satan, and n9ne, but possibly you may want to save the "Great Works with 2.2.9" posts for problems, and different types of ackknowledgements.

-Arunan

FleaBag
29 Oct 2002, 23:27
Hey all it needed was someone to ask me to stop, and you did. But I think Satan, the queen of spam at vB.org is being slightly hypocritical.

The_Huntress
10 Aug 2003, 22:52
Question: was this fixed in 2.3.0?

Xenon
19 Aug 2003, 21:31
no as it's not really a bug.

it's just a thing some might want it enabled, some disabled