mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-10 13:28:55 +00:00
[ticket/15289] Improve error messages
PHPBB3-15289
This commit is contained in:
parent
e27e51bdbf
commit
4c9670363c
2 changed files with 10 additions and 8 deletions
|
@ -215,6 +215,9 @@ class acp_storage
|
||||||
|
|
||||||
foreach ($new_options as $def_k => $def_v)
|
foreach ($new_options as $def_k => $def_v)
|
||||||
{
|
{
|
||||||
|
$provider = $this->provider_collection->get_by_class($this->get_new_provider($storage_name));
|
||||||
|
$def_title = $this->lang->lang('STORAGE_ADAPTER_' . strtoupper($provider->get_name()) . '_OPTION_' . strtoupper($def_k));
|
||||||
|
|
||||||
$value = $this->get_new_def($storage_name, $def_k);
|
$value = $this->get_new_def($storage_name, $def_k);
|
||||||
|
|
||||||
switch ($def_v['type'])
|
switch ($def_v['type'])
|
||||||
|
@ -222,21 +225,21 @@ class acp_storage
|
||||||
case 'email':
|
case 'email':
|
||||||
if (!filter_var($value, FILTER_VALIDATE_EMAIL))
|
if (!filter_var($value, FILTER_VALIDATE_EMAIL))
|
||||||
{
|
{
|
||||||
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_EMAIL_INCORRECT_FORMAT');
|
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_EMAIL_INCORRECT_FORMAT', $def_title, $storage_title);
|
||||||
}
|
}
|
||||||
case 'text':
|
case 'text':
|
||||||
case 'password':
|
case 'password':
|
||||||
$maxlength = isset($def_v['maxlength']) ? $def_v['maxlength'] : 255;
|
$maxlength = isset($def_v['maxlength']) ? $def_v['maxlength'] : 255;
|
||||||
if (strlen($value) > $maxlength)
|
if (strlen($value) > $maxlength)
|
||||||
{
|
{
|
||||||
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_TEXT_TOO_LONG');
|
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_TEXT_TOO_LONG', $def_title, $storage_title);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'radio':
|
case 'radio':
|
||||||
case 'select':
|
case 'select':
|
||||||
if (!in_array($value, array_values($def_v['options'])))
|
if (!in_array($value, array_values($def_v['options'])))
|
||||||
{
|
{
|
||||||
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_SELECT_NOT_AVAILABLE');
|
$messages[] = $this->lang->lang('STORAGE_FORM_TYPE_SELECT_NOT_AVAILABLE', $def_title, $storage_title);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,12 +54,11 @@ $lang = array_merge($lang, array(
|
||||||
'STORAGE_ADAPTER_LOCAL_OPTION_PATH' => 'Path',
|
'STORAGE_ADAPTER_LOCAL_OPTION_PATH' => 'Path',
|
||||||
|
|
||||||
// Form validation
|
// Form validation
|
||||||
// Todo" more descriptive form errors showing storage name and field name
|
|
||||||
'STORAGE_UPDATE_SUCCESSFUL' => 'All storages were successfuly updated.',
|
'STORAGE_UPDATE_SUCCESSFUL' => 'All storages were successfuly updated.',
|
||||||
'STORAGE_NO_CHANGES' => 'No changes has been made.',
|
'STORAGE_NO_CHANGES' => 'No changes has been made.',
|
||||||
'STORAGE_PROVIDER_NOT_EXISTS' => 'Provider selected for %s dont exist.',
|
'STORAGE_PROVIDER_NOT_EXISTS' => 'Provider selected for %s doesn\'t exist.',
|
||||||
'STORAGE_PROVIDER_NOT_AVAILABLE' => 'Provider selected for %s is not available.',
|
'STORAGE_PROVIDER_NOT_AVAILABLE' => 'Provider selected for %s is not available.',
|
||||||
'STORAGE_FORM_TYPE_EMAIL_INCORRECT_FORMAT' => 'Incorrect email',
|
'STORAGE_FORM_TYPE_EMAIL_INCORRECT_FORMAT' => 'Incorrect email for %s of %s.',
|
||||||
'STORAGE_FORM_TYPE_TEXT_TOO_LONG' => 'Text is too long',
|
'STORAGE_FORM_TYPE_TEXT_TOO_LONG' => 'Text is too long for %s of %s.',
|
||||||
'STORAGE_FORM_TYPE_SELECT_NOT_AVAILABLE' => 'Selected value is not available',
|
'STORAGE_FORM_TYPE_SELECT_NOT_AVAILABLE' => 'Selected value is not available for %s of %s.',
|
||||||
));
|
));
|
||||||
|
|
Loading…
Add table
Reference in a new issue