Remove the pred_hostname global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
c481ab304a
commit
64f86ad4fe
@ -8667,7 +8667,6 @@
|
||||
</InvalidArgument>
|
||||
<InvalidArrayOffset>
|
||||
<code><![CDATA[$GLOBALS['new_username']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_hostname']]]></code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$errorMessage]]></code>
|
||||
@ -8786,7 +8785,6 @@
|
||||
</InvalidArgument>
|
||||
<InvalidArrayOffset>
|
||||
<code><![CDATA[$GLOBALS['new_username']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_hostname']]]></code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$paramDbName]]></code>
|
||||
@ -8840,7 +8838,6 @@
|
||||
</MixedArrayOffset>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['new_username']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_hostname']]]></code>
|
||||
<code><![CDATA[$extraData['db_wildcard_privs']]]></code>
|
||||
<code><![CDATA[$foundRows[]]]></code>
|
||||
<code><![CDATA[$grantValue]]></code>
|
||||
|
||||
@ -25,17 +25,17 @@
|
||||
<span class="options">
|
||||
<select name="pred_hostname" id="select_pred_hostname" title="{{ t('Host name') }}"
|
||||
{{- this_host is not null and this_host != 'localhost' and this_host != '127.0.0.1' ? ' data-thishost="' ~ this_host ~ '"' }}>
|
||||
<option value="any"{{ pred_hostname == 'any' ? ' selected' }}>{{ t('Any host') }}</option>
|
||||
<option value="localhost"{{ pred_hostname == 'localhost' ? ' selected' }}>{{ t('Local') }}</option>
|
||||
<option value="any"{{ predefined_hostname == 'any' ? ' selected' }}>{{ t('Any host') }}</option>
|
||||
<option value="localhost"{{ predefined_hostname == 'localhost' ? ' selected' }}>{{ t('Local') }}</option>
|
||||
{% if this_host is not empty %}
|
||||
<option value="thishost"{{ pred_hostname == 'thishost' ? ' selected' }}>{{ t('This host') }}</option>
|
||||
<option value="thishost"{{ predefined_hostname == 'thishost' ? ' selected' }}>{{ t('This host') }}</option>
|
||||
{% endif %}
|
||||
<option value="hosttable"{{ pred_hostname == 'hosttable' ? ' selected' }}>{{ t('Use host table') }}</option>
|
||||
<option value="userdefined"{{ pred_hostname == 'userdefined' ? ' selected' }}>{{ t('Use text field') }}</option>
|
||||
<option value="hosttable"{{ predefined_hostname == 'hosttable' ? ' selected' }}>{{ t('Use host table') }}</option>
|
||||
<option value="userdefined"{{ predefined_hostname == 'userdefined' ? ' selected' }}>{{ t('Use text field') }}</option>
|
||||
</select>
|
||||
</span>
|
||||
<input type="text" name="hostname" id="pma_hostname" maxlength="{{ hostname_length }}" value="{{ hostname|default('%') }}" title="
|
||||
{{- t('Host name') }}"{{ pred_hostname == 'userdefined' ? ' required' }}>
|
||||
{{- t('Host name') }}"{{ predefined_hostname == 'userdefined' ? ' required' }}>
|
||||
|
||||
{{ show_hint(t('When Host table is used, this field is ignored and values stored in Host table are used instead.')) }}
|
||||
</div>
|
||||
|
||||
@ -401,9 +401,9 @@ class ReplicationGui
|
||||
}
|
||||
}
|
||||
|
||||
// when we start editing a user, $GLOBALS['pred_hostname'] is not defined
|
||||
if (! isset($GLOBALS['pred_hostname']) && $hostname !== null) {
|
||||
$GLOBALS['pred_hostname'] = match (mb_strtolower($hostname)) {
|
||||
$predefinedHostname = 'any';
|
||||
if ($hostname !== null) {
|
||||
$predefinedHostname = match (mb_strtolower($hostname)) {
|
||||
'localhost', '127.0.0.1' => 'localhost',
|
||||
'%' => 'any',
|
||||
default => 'userdefined',
|
||||
@ -417,7 +417,7 @@ class ReplicationGui
|
||||
'username' => $username,
|
||||
'hostname' => $hostname ?? '',
|
||||
'predefined_username' => $predefinedUsername,
|
||||
'predefined_hostname' => $GLOBALS['pred_hostname'] ?? '',
|
||||
'predefined_hostname' => $predefinedHostname,
|
||||
'this_host' => $thisHost ?? null,
|
||||
]);
|
||||
}
|
||||
|
||||
@ -595,7 +595,6 @@ class Privileges
|
||||
string|null $user = null,
|
||||
string|null $host = null,
|
||||
): string {
|
||||
$GLOBALS['pred_hostname'] ??= null;
|
||||
$GLOBALS['new_username'] ??= null;
|
||||
|
||||
[$usernameLength, $hostnameLength] = $this->getUsernameAndHostnameLength();
|
||||
@ -615,8 +614,9 @@ class Privileges
|
||||
);
|
||||
}
|
||||
|
||||
if (! isset($GLOBALS['pred_hostname']) && $this->hostname !== null) {
|
||||
$GLOBALS['pred_hostname'] = match (mb_strtolower($this->hostname)) {
|
||||
$predefinedHostname = 'any';
|
||||
if ($this->hostname !== null) {
|
||||
$predefinedHostname = match (mb_strtolower($this->hostname)) {
|
||||
'localhost', '127.0.0.1' => 'localhost',
|
||||
'%' => 'any',
|
||||
default => 'userdefined',
|
||||
@ -643,7 +643,7 @@ class Privileges
|
||||
|
||||
return $this->template->render('server/privileges/login_information_fields', [
|
||||
'predefined_username' => $predefinedUsername,
|
||||
'pred_hostname' => $GLOBALS['pred_hostname'] ?? null,
|
||||
'predefined_hostname' => $predefinedHostname,
|
||||
'username_length' => $usernameLength,
|
||||
'hostname_length' => $hostnameLength,
|
||||
'username' => $this->username,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user