View Full Version : How do you convert your 3.0 hack to 3.5 ?
deathemperor
09-12-2005, 06:30 AM
this is an example of what I'm doing:
$vbulletin->input->clean_array_gpc('r', array(
'name' => TYPE_STR,
'email' => TYPE_STR,
'subject' => TYPE_STR,
'message' => TYPE_STR
));
$name = $vbulletin->GPC['name'];
$email = $vbulletin->GPC['email'];
$subject = $vbulletin->GPC['subject'];
$message = $vbulletin->GPC['message'];
because in 3.0 the varible is created automatically by globalize(), so I manually create the varible for vb3.5 (the above example). I'm just not sure if I should do so. Because the other ways it would take me more time to convert.
what is your opinions ?
Marco van Herwaarden
09-12-2005, 09:07 AM
Please see the HOW-TO section for 3.5
PS I don't understand your remark about 3.0 creating variables automatic, please provide examples.
Andreas
09-12-2005, 09:38 AM
He means the Variables created by globalize()
Marco van Herwaarden
09-12-2005, 11:45 AM
Well they sre still created, only part of an array now.
Paul M
09-12-2005, 12:02 PM
Well they sre still created, only part of an array now.Yes, but that means the variable name in all the subsequent code is wrong - leaving you a choice of either doing the above and creating the variables, or changing that variable name in every occurance (search/replace is not always very safe for this). It's a major PITA and I'm not sure why they don't create the variable name anymore.
deathemperor
09-13-2005, 03:57 PM
Yes, but that means the variable name in all the subsequent code is wrong - leaving you a choice of either doing the above and creating the variables, or changing that variable name in every occurance (search/replace is not always very safe for this). It's a major PITA and I'm not sure why they don't create the variable name anymore.
This is what I meant. but Paul what is your solution for this ? replace all old varibles with the new array ?
Paul M
09-13-2005, 04:02 PM
This is what I meant. but Paul what is your solution for this ? replace all old varibles with the new array ?Yes, I do a confirmed search & replace atm, but that's because it's only on small hacks.
For a bigger one I'm looking to convert I'm considering writing a small function to call after calling the gpc cleanup, that converts everything in the gpc array to a variable as well.
Marco van Herwaarden
09-13-2005, 05:01 PM
I think (but could be wrong) that security is the reason for this construction.
When a script starts it will unset the whole array, making sure that no external source can insert values.
deathemperor
09-14-2005, 03:16 AM
thanks for the answer, but is it ok if I use like the example in my first post ? or should it be 'reference' ?
else I would have to 'find and replace' +_+
Your method works, but personally I replaced variables with the GPC array reference instead of relying on globalize at all.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.