vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do you convert your 3.0 hack to 3.5 ? (https://vborg.vbsupport.ru/showthread.php?t=96105)

deathemperor 09-12-2005 06:30 AM

How do you convert your 3.0 hack to 3.5 ?
 
this is an example of what I'm doing:

PHP Code:

    $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

Quote:

Originally Posted by MarcoH64
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

Quote:

Originally Posted by Paul M
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

Quote:

Originally Posted by deathemperor
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' +_+

merk 09-14-2005 04:01 AM

Your method works, but personally I replaced variables with the GPC array reference instead of relying on globalize at all.


All times are GMT. The time now is 12:54 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.01071 seconds
  • Memory Usage 1,736KB
  • 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
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete