mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 14:00:31 +02:00
remove hardcoded size unit for PHP_SIZE_OVERRUN error (Bug #29935)
git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9464 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
@@ -594,7 +594,18 @@ class fileupload
|
||||
// PHP Upload filesize exceeded
|
||||
if ($file->get('filename') == 'none')
|
||||
{
|
||||
$file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
|
||||
$max_filesize = @ini_get('upload_max_filesize');
|
||||
$unit = 'MB';
|
||||
|
||||
if (!empty($max_filesize))
|
||||
{
|
||||
$unit = strtolower(substr($max_filesize, -1, 1));
|
||||
$max_filesize = (int) $max_filesize;
|
||||
|
||||
$unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
|
||||
}
|
||||
|
||||
$file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
|
||||
return $file;
|
||||
}
|
||||
|
||||
@@ -670,7 +681,18 @@ class fileupload
|
||||
// PHP Upload filesize exceeded
|
||||
if ($file->get('filename') == 'none')
|
||||
{
|
||||
$file->error[] = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
|
||||
$max_filesize = @ini_get('upload_max_filesize');
|
||||
$unit = 'MB';
|
||||
|
||||
if (!empty($max_filesize))
|
||||
{
|
||||
$unit = strtolower(substr($max_filesize, -1, 1));
|
||||
$max_filesize = (int) $max_filesize;
|
||||
|
||||
$unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
|
||||
}
|
||||
|
||||
$file->error[] = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
|
||||
return $file;
|
||||
}
|
||||
|
||||
@@ -818,7 +840,18 @@ class fileupload
|
||||
switch ($errorcode)
|
||||
{
|
||||
case 1:
|
||||
$error = (@ini_get('upload_max_filesize') == '') ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], @ini_get('upload_max_filesize'));
|
||||
$max_filesize = @ini_get('upload_max_filesize');
|
||||
$unit = 'MB';
|
||||
|
||||
if (!empty($max_filesize))
|
||||
{
|
||||
$unit = strtolower(substr($max_filesize, -1, 1));
|
||||
$max_filesize = (int) $max_filesize;
|
||||
|
||||
$unit = ($unit == 'k') ? 'KB' : (($unit == 'g') ? 'GB' : 'MB');
|
||||
}
|
||||
|
||||
$error = (empty($max_filesize)) ? $user->lang[$this->error_prefix . 'PHP_SIZE_NA'] : sprintf($user->lang[$this->error_prefix . 'PHP_SIZE_OVERRUN'], $max_filesize, $user->lang[$unit]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
|
Reference in New Issue
Block a user