PDA

View Full Version : Brainache....Reading class_core.php...lost...


Cloudrunner
07-02-2005, 01:37 AM
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,http://www.whatever.com/index.php?somevariable=somevalueMy old way of doing things was simply 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!

Andreas
07-02-2005, 01:43 AM
$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.

Cloudrunner
07-02-2005, 02:30 AM
$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 :D

Revan
07-02-2005, 09:49 AM
$vbulletin->input->clean_gpc('r', 'foobar', TYPE_STR);
if($vbulletin->GPC['foobar'] == 'foobar')
{
// do smth
}
I feel pretty certain this should be

$vbulletin->input->clean_array_gpc('r', array(
'foobar' => TYPE_STR
));
if($vbulletin->GPC['foobar'] == 'foobar')
{
// do smth
}
no?

Andreas
07-02-2005, 10:23 AM
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.

Cloudrunner
07-02-2005, 12:41 PM
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?

Andreas
07-02-2005, 07:50 PM
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.

Cloudrunner
07-02-2005, 08:31 PM
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!

Revan
07-04-2005, 10:07 AM
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:

dwh
08-15-2005, 06:35 AM
r stands for _REQUEST?
p stands for _POST?

Adrian Schneider
08-15-2005, 06:44 AM
r stands for _REQUEST?
p stands for _POST?

yes.