Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-09-2005, 11:51 PM
Cash4Cookies Cash4Cookies is offline
 
Join Date: Jun 2004
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Allowed Variables

Hello Everyone!

I had a script running perfectly fine in VBulletin 3.0.x which allowed me to do this:

Basically, the script is offers.php and if you go to offers.php?action=blah then it registers action=blah like PHP would normally do, however, VB blocks this and only allows certain variables go through as *WAS* defined in init.php:

$_allowedvars

Now, I upgraded to VB 3.5.x and I just can't find where on Earth they moved the $_allowedvars so that I can throw all the variables in there.

Anyone know where they moved it?

Yes, I searched numerous times with numerous keywords. Result: nada.

Thanks in advance,
Matt

Sorry for the bump, I just really need this answered. Can anyone help? TIA
Reply With Quote
  #2  
Old 11-10-2005, 08:09 PM
sgtryan sgtryan is offline
 
Join Date: Aug 2005
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is interesting, I would like an answer for this too! :P
Reply With Quote
  #3  
Old 11-10-2005, 08:19 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't know why they would possibly need this.
With GPC, the GLOBALS cleanup becomes useless, so I suppose they removed that code.
Reply With Quote
  #4  
Old 11-10-2005, 08:57 PM
sgtryan sgtryan is offline
 
Join Date: Aug 2005
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Say you are creating a script that integrates with vBulletin.

The script: test.php

Inside of test.php (which is integrated and includes global.php) includes:

Code:
if($action == "blah")
{

echo ("hi");
}
Now, if you go to http://url.com/forum/test.php?action=blah

It only sees test.php without the declartion of "action" being "blah." In the earlier version of VB, you could just add in "action" to the "allowedvars" in init.php and bam, that fixed the problem.

I am just trying to find out where on earth that went in 3.5.x
Reply With Quote
  #5  
Old 11-10-2005, 09:34 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
if ($_GET['action'] == 'blah')
{
    echo 
'hi';

or

PHP Code:
$vbulletin->input->clean_array_gpc('g', array(
    
'do' => TYPE_STR,
    
'threadid' => TYPE_INT,
    
'action' => TYPE_STR
));

if (
$vbulletin->GPC['action'] == 'value')
{
    echo 
'eggnog';

If you are going to use the values for anything other than script nav, you should pass it through the gpc functions first to sanitize the data.
Reply With Quote
  #6  
Old 11-14-2005, 06:26 PM
kbadr kbadr is offline
 
Join Date: Apr 2004
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can $vbulletin->GPC be accessed from a style template, though?

The reason that $_allowedvars was needed in previous versions was that there was VB code that explicitly called "deregister_globals" on anything that was not in the $_allowedvars array.

Somewhere in the new version, similar code is being executed (though not with the deregister_globals function -- I grep'd for it), because the globals I've defined are getting cleared out.
Reply With Quote
  #7  
Old 11-14-2005, 07:26 PM
akanevsky akanevsky is offline
 
Join Date: Apr 2005
Posts: 3,972
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No, you may not access GPC from templates.
You must put
$myvar =& $vbulletin->GPC['myvar'];
if you want to use the variable in a template (note the "&" sign - it establishes a reference rather than copying the variable - for memory saving purposes).

Quote:
Somewhere in the new version, similar code is being executed (though not with the deregister_globals function -- I grep'd for it), because the globals I've defined are getting cleared out.
You should not be defining globals unless it's after you've included global.php.
Reply With Quote
  #8  
Old 11-15-2005, 03:38 AM
sgtryan sgtryan is offline
 
Join Date: Aug 2005
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Problem has been solved.

I placed a $_GET on all of my variables, passes through globals.php just fine.

Thanks SirAdrian.
Reply With Quote
  #9  
Old 11-15-2005, 06:21 AM
Marco van Herwaarden Marco van Herwaarden is offline
 
Join Date: Jul 2004
Posts: 25,415
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There is no reason why you can't use $vbulletin->GPC[myvar] in templates.
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:48 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.03747 seconds
  • Memory Usage 2,243KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete