[Phpmyadmin-devel] server_privileges refactoring

Marc Delisle marc at infomarc.info
Sun Jul 1 13:34:54 CEST 2012


Le 2012-06-30 23:38, Thilina Buddika Abeyrathna a écrit :
> On Sat, Jun 30, 2012 at 6:17 PM, Thilina Buddika Abeyrathna <
> thilinaabeyrathna at gmail.com> wrote:
> 
>>
>>
>> On Sat, Jun 30, 2012 at 5:56 PM, Marc Delisle <marc at infomarc.info> wrote:
>>
>>> Le 2012-06-30 08:18, Thilina Buddika Abeyrathna a écrit :
>>>> On Sat, Jun 30, 2012 at 5:31 PM, Marc Delisle <marc at infomarc.info>
>>> wrote:
>>>>
>>>>> Le 2012-06-30 03:04, Thilina Buddika Abeyrathna a écrit :
>>>>>> Hi Marc,
>>>>>> There are two hard coded values in server_privileges.lib.php script
>>> which
>>>>>> username and hostname lengths. (line 849). Can we define those values
>>> in
>>>>> a
>>>>>> config file and access using $GLOBAL['cfg']['username_length'] and
>>>>>>  $GLOBAL['cfg']['hostname_length'], Then it'll maintainable.
>>>>>
>>>>> Hi Thilina,
>>>>> I cannot find this in your repo, please reply by posting a code
>>> snippet.
>>>>>
>>>>
>>>> in server_privileges.lib.php (lin 844)
>>>>     $username_length = 16;
>>>>     $hostname_length = 41;
>>>> My suggestion was, remove the hard corded value and define those hard
>>>> corded values in config file and access
>>>> using  $GLOBAL['cfg']['username_length'] etc.
>>>
>>> Well, these values have been chosen by MySQL itself; I'm not sure what
>>> to do with them, as I don't see why a person installing phpMyAdmin would
>>> need to change them.
>>>
>>> When we add configuration directives, we must have a clear reason.
>>>
>>> Ok Marc, Thank you.
>>
> 
> Hi Marc,
> There are two variables in server_privileges.php file which I couldn't find
> the definitions.
> line  226. (brown color variables)
> ======
> if ($pred_username == 'any') {
>         $username = '';
> }
> switch ($pred_hostname) {
> case 'any':
> =====
> So can you help me to get that.

Thilina,
in the "Login information" panel, for user name and host there is a
drop-down and an input field.

$pred_username is set with the choice selected from the user name drop-down.

$pred_hostname is set with the choice selected from the host name drop-down.

These selectors could be renamed username_selector and
hostname_selector, in the form. Then, the code would refer to them using
$_POST['username_selector'] and $_POST['hostname_selector'], and the
entries could be removed from $post_params.

-- 
Marc Delisle
http://infomarc.info






More information about the Developers mailing list