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 07-02-2005, 01:37 AM
Cloudrunner's Avatar
Cloudrunner Cloudrunner is offline
 
Join Date: May 2003
Location: Butte, MT
Posts: 635
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Brainache....Reading class_core.php...lost...

Might be a simple answer, but I'm all sortsa confused at this point...I use the $_REQUEST['whatever'] for navigation throughout my scripts, with the new $vbulletin->GPC stuff, how EXACTLY does one run the $_REQUEST array through the cleaning and then call / assign the resulting variable? For example,
HTML Code:
http://www.whatever.com/index.php?somevariable=somevalue
My old way of doing things was simply
PHP Code:
if (empty($_REQUEST['somevariable'])){
    
$_REQUEST['somevariable'] = 'someothervalue';

How would I run this example now with the $vbulletin->GPC?

Thanks in advance for any help that is given!
Reply With Quote
  #2  
Old 07-02-2005, 01:43 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
$vbulletin->input->clean_gpc('r''foobar'TYPE_STR);
if(
$vbulletin->GPC['foobar'] == 'foobar')
{
  
// do smth

But if you are just using this for action switches, it's not worth the overhead for cleaning anway, as you are not going to process the input further.
Reply With Quote
  #3  
Old 07-02-2005, 02:30 AM
Cloudrunner's Avatar
Cloudrunner Cloudrunner is offline
 
Join Date: May 2003
Location: Butte, MT
Posts: 635
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
PHP Code:
$vbulletin->input->clean_gpc('r''foobar'TYPE_STR);
if(
$vbulletin->GPC['foobar'] == 'foobar')
{
  
// do smth

But if you are just using this for action switches, it's not worth the overhead for cleaning anway, as you are not going to process the input further.
Gotcha, Thank you kindly, now I think I got it figgered out
Reply With Quote
  #4  
Old 07-02-2005, 09:49 AM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
PHP Code:
$vbulletin->input->clean_gpc('r''foobar'TYPE_STR);
if(
$vbulletin->GPC['foobar'] == 'foobar')
{
  
// do smth

I feel pretty certain this should be
PHP Code:
$vbulletin->input->clean_array_gpc('r', array(
    
'foobar' => TYPE_STR
));
if(
$vbulletin->GPC['foobar'] == 'foobar')
{
  
// do smth

no?
Reply With Quote
  #5  
Old 07-02-2005, 10:23 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want to just clean 1 Variable, it does not make much sense to call clean_array_gpc()
But of course you can also use this.
Reply With Quote
  #6  
Old 07-02-2005, 12:41 PM
Cloudrunner's Avatar
Cloudrunner Cloudrunner is offline
 
Join Date: May 2003
Location: Butte, MT
Posts: 635
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
If you want to just clean 1 Variable, it does not make much sense to call clean_array_gpc()
But of course you can also use this.
So here's another question....

I have a huge list of inputs, if I want these to be seen within a function, I have to list them in the global statement within the new function. With this new way of globalizing/cleaning them, can I run the clean statement and that will be readable within the function without having to declare them in the global statement since they will be in the $vbulletin object?
Reply With Quote
  #7  
Old 07-02-2005, 07:50 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

As the cleaned values are keys in array GPC which itself is a property of Class vB_Registry (for which an Object $vbulletin is being createded by init.php), you only have to declare $vbulletin as global.
Reply With Quote
  #8  
Old 07-02-2005, 08:31 PM
Cloudrunner's Avatar
Cloudrunner Cloudrunner is offline
 
Join Date: May 2003
Location: Butte, MT
Posts: 635
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
As the cleaned values are keys in array GPC which itself is a property of Class vB_Registry (for which an Object $vbulletin is being createded by init.php), you only have to declare $vbulletin as global.
gotcha, thanks!
Reply With Quote
  #9  
Old 07-04-2005, 10:07 AM
Revan's Avatar
Revan Revan is offline
 
Join Date: Jan 2004
Location: Norway
Posts: 1,671
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
If you want to just clean 1 Variable, it does not make much sense to call clean_array_gpc()
But of course you can also use this.
Oh, right. My bad, I didn't read your function name thorough enough so I thought you called array_gpc :nervous:
Reply With Quote
  #10  
Old 08-15-2005, 06:35 AM
dwh's Avatar
dwh dwh is offline
 
Join Date: Feb 2002
Posts: 278
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

r stands for _REQUEST?
p stands for _POST?
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 07:44 PM.


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.04370 seconds
  • Memory Usage 2,263KB
  • Queries Executed 11 (?)
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_html
  • (5)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete