[geeklog-devtalk] Re: geeklog-devtalk digest, Vol 1 #258 - 3 msgs

Wim Niemans ri remy at pbsolo.nl
Sun Feb 29 08:13:22 EST 2004


The COM_applyFilter is a great addition.
However, in order to avoid code-looping thru GET and POST variables,
as described by Blaine hereunder, there could be an addition:
COM_getFilteredHttp(str name) (or a similar name)
which does this looping before calling COM_applyFilter. In the
application code it is only one instruction, which makes the
application code more readable. It still gives the freedom to do
filtering otherwise.
Any core code can start with the call for any variable used. Side-
effect is than a better documentation.

Cheers,
wim niemans

On 28 Feb 2004 at 12:00, geeklog-devtalk-request at lists.geeklog.net wrote:


> I often use the same variable name for GET and POST for something like

> "what operation" is being performed. Sometimes you have links which

> trigger an operation but in the same application there may be a form. I

> have been using $op to indicate the operation (add/delete/edit etc ...)

> and use code like this:

>

> if (isset($HTTP_POST_VARS['op']) ) {

> $op = clubApplyFilter($HTTP_POST_VARS['op']);

> } elseif (isset($HTTP_GET_VARS['op']) ) {

> $op = clubApplyFilter($HTTP_GET_VARS['op']);

> } else {

> $op = '';

> }

>

> I first check the POST for a request and then the GET string. This is a

> repeatitive piece of code as I may have other common used variables like

> recid, mode, page, sortoption etc. Example: Page navigation needs to pass

> page# and Sort options in the URL string but I also need to pass these

> variable in forms if I want to return the user to same view.

>

> I have been thinking, it would be nice to be have a common function that

> would filter all the POST and GET vars. It is possible to walk the arrays

> and maybe send it a list of variables to clean - using array_walk().

>






More information about the geeklog-devtalk mailing list