1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/10345] Use the plural function in some more places.

I added two function avatar_explanation_string() and avatar_error_wrong_size()
for easier handling of the "pixels"-languages, as they are used quite often.

PHPBB3-10345
This commit is contained in:
Joas Schilling
2011-09-20 01:33:33 +02:00
committed by Oleg Pudeyev
parent 88ae40a4b1
commit 179662e949
26 changed files with 169 additions and 101 deletions

View File

@@ -2039,7 +2039,7 @@ function avatar_remote($data, &$error)
{
if ($width > $config['avatar_max_width'] || $height > $config['avatar_max_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $width, $height);
$error[] = avatar_error_wrong_size($width, $height);
return false;
}
}
@@ -2048,7 +2048,7 @@ function avatar_remote($data, &$error)
{
if ($width < $config['avatar_min_width'] || $height < $config['avatar_min_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $width, $height);
$error[] = avatar_error_wrong_size($width, $height);
return false;
}
}
@@ -2388,7 +2388,7 @@ function avatar_process_user(&$error, $custom_userdata = false, $can_upload = nu
{
if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
$error[] = avatar_error_wrong_size($data['width'], $data['height']);
}
}
@@ -2398,7 +2398,7 @@ function avatar_process_user(&$error, $custom_userdata = false, $can_upload = nu
{
if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
$error[] = avatar_error_wrong_size($data['width'], $data['height']);
}
}
}
@@ -2444,6 +2444,29 @@ function avatar_process_user(&$error, $custom_userdata = false, $can_upload = nu
return (sizeof($error)) ? false : true;
}
function avatar_error_wrong_size($width, $height)
{
global $config, $user;
return $user->lang('AVATAR_WRONG_SIZE',
$user->lang('PIXELS', (int) $config['avatar_min_width']),
$user->lang('PIXELS', (int) $config['avatar_min_height']),
$user->lang('PIXELS', (int) $config['avatar_max_width']),
$user->lang('PIXELS', (int) $config['avatar_max_height']),
$user->lang('PIXELS', (int) $width),
$user->lang('PIXELS', (int) $height));
}
function avatar_explanation_string()
{
global $config, $user;
return $user->lang('AVATAR_EXPLAIN',
$user->lang('PIXELS', (int) $config['avatar_max_width']),
$user->lang('PIXELS', (int) $config['avatar_max_height']),
round($config['avatar_filesize'] / 1024));
}
//
// Usergroup functions
//