Remove the pred_username global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
d253986eb5
commit
c481ab304a
@ -8668,7 +8668,6 @@
|
||||
<InvalidArrayOffset>
|
||||
<code><![CDATA[$GLOBALS['new_username']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_hostname']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_username']]]></code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$errorMessage]]></code>
|
||||
@ -8788,7 +8787,6 @@
|
||||
<InvalidArrayOffset>
|
||||
<code><![CDATA[$GLOBALS['new_username']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_hostname']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_username']]]></code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$paramDbName]]></code>
|
||||
@ -8843,7 +8841,6 @@
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['new_username']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_hostname']]]></code>
|
||||
<code><![CDATA[$GLOBALS['pred_username']]]></code>
|
||||
<code><![CDATA[$extraData['db_wildcard_privs']]]></code>
|
||||
<code><![CDATA[$foundRows[]]]></code>
|
||||
<code><![CDATA[$grantValue]]></code>
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
<label for="select_pred_username">{{ t('User name:') }}</label>
|
||||
<span class="options">
|
||||
<select name="pred_username" id="select_pred_username" title="{{ t('User name') }}">
|
||||
<option value="any"{{ pred_username == 'any' ? ' selected' }}>{{ t('Any user') }}</option>
|
||||
<option value="userdefined"{{ pred_username is null or pred_username == 'userdefined' ? ' selected' }}>{{ t('Use text field') }}</option>
|
||||
<option value="any"{{ predefined_username == 'any' ? ' selected' }}>{{ t('Any user') }}</option>
|
||||
<option value="userdefined"{{ predefined_username == 'userdefined' ? ' selected' }}>{{ t('Use text field') }}</option>
|
||||
</select>
|
||||
</span>
|
||||
<input type="text" spellcheck="false" name="username" id="pma_username" class="autofocus" maxlength="{{ username_length }}" title="{{ t('User name') }}"
|
||||
{%- if username is not empty %} value="{{ new_username is not null ? new_username : username }}"{% endif -%}
|
||||
{{- pred_username is null or pred_username == 'userdefined' ? ' required' }}>
|
||||
{{- predefined_username == 'userdefined' ? ' required' }}>
|
||||
|
||||
<div id="user_exists_warning" class="hide">
|
||||
{{ t('An account already exists with the same username but possibly a different hostname.')|notice }}
|
||||
|
||||
@ -379,8 +379,9 @@ class ReplicationGui
|
||||
[$usernameLength, $hostnameLength] = $this->getUsernameHostnameLength();
|
||||
|
||||
$username = '';
|
||||
$predefinedUsername = 'userdefined';
|
||||
if ($postUsername === '') {
|
||||
$GLOBALS['pred_username'] = 'any';
|
||||
$predefinedUsername = 'any';
|
||||
} elseif ($postUsername !== null && $postUsername !== '0') {
|
||||
$username = $GLOBALS['new_username'] ?? $postUsername;
|
||||
}
|
||||
@ -415,7 +416,7 @@ class ReplicationGui
|
||||
'has_username' => $postUsername !== null,
|
||||
'username' => $username,
|
||||
'hostname' => $hostname ?? '',
|
||||
'predefined_username' => $GLOBALS['pred_username'] ?? '',
|
||||
'predefined_username' => $predefinedUsername,
|
||||
'predefined_hostname' => $GLOBALS['pred_hostname'] ?? '',
|
||||
'this_host' => $thisHost ?? null,
|
||||
]);
|
||||
|
||||
@ -595,15 +595,12 @@ class Privileges
|
||||
string|null $user = null,
|
||||
string|null $host = null,
|
||||
): string {
|
||||
$GLOBALS['pred_username'] ??= null;
|
||||
$GLOBALS['pred_hostname'] ??= null;
|
||||
$GLOBALS['new_username'] ??= null;
|
||||
|
||||
[$usernameLength, $hostnameLength] = $this->getUsernameAndHostnameLength();
|
||||
|
||||
if ($this->username !== null && $this->username === '') {
|
||||
$GLOBALS['pred_username'] = 'any';
|
||||
}
|
||||
$predefinedUsername = $this->username === '' ? 'any' : 'userdefined';
|
||||
|
||||
$currentUser = (string) $this->dbi->fetchValue('SELECT USER();');
|
||||
$thisHost = null;
|
||||
@ -645,7 +642,7 @@ class Privileges
|
||||
}
|
||||
|
||||
return $this->template->render('server/privileges/login_information_fields', [
|
||||
'pred_username' => $GLOBALS['pred_username'] ?? null,
|
||||
'predefined_username' => $predefinedUsername,
|
||||
'pred_hostname' => $GLOBALS['pred_hostname'] ?? null,
|
||||
'username_length' => $usernameLength,
|
||||
'hostname_length' => $hostnameLength,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user