On Fri, Apr 6, 2012 at 5:21 PM, Marc Delisle <marc@infomarc.info> wrote:
Le 2012-04-06 07:38, Ammar Yasir a écrit :
> On Tue, Apr 3, 2012 at 8:23 PM, Marc Delisle <marc@infomarc.info> wrote:
>
>> Le 2012-04-02 18:39, Ammar Yasir a écrit :
>>> Hi,
>>> Can we have more clarity on improving reference to global variables. Is
>> the
>>> following snippet an example of the same where?
>>> (From tbl_select.php, $_POST parameters are referenced through $GLOBALS)
>>> $post_params = array(
>>>     'ajax_request',
>>>     'collations',
>>>     'db',
>>>     'distinct',
>>>     'fields',
>>>     'func',
>>>     'max_number_of_fields',
>>>     'names',
>>>     'order',
>>>     'orderField',
>>>     'param',
>>>     'session_max_rows',
>>>     'table',
>>>     'types',
>>>     'where',
>>> );
>>> foreach ($post_params as $one_post_param) {
>>>     if (isset($_POST[$one_post_param])) {
>>>         $GLOBALS[$one_post_param] = $_POST[$one_post_param];
>>>     }
>>> }
>>
>> Ammar,
>> this snippet is code added recently, to be able to remove the
>> grab_globals.lib.php library.
>>
>> tbl_select.php uses globals instead of directly referencing
>> $_POST['foo'] so this snippet was a way to keep the script working until
>> better refactoring.
>>
>> However, many scripts are using other global variables as a way to
>> communicate between them or between functions, and we should try to
>> minimize this behavior.
>>
>> Is the use of $sql_query variable as a GET variable for sql.php  an
> example of the same?
> (communication between scripts)

GET and POST variables are always about communication between scripts,
right?

I meant that some functions are either using the global keyword or
$GLOBALS to reach some global variables. Also, procedural code in
included files are using global variables.

Okay, thanks for clarifying. I submitted my proposal for Refactoring: table search, db search and multi-table query.  I know it's very late but any comments will be very helpful.

--
Marc Delisle
http://infomarc.info

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Phpmyadmin-devel mailing list
Phpmyadmin-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel