aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_upload.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-06-27 14:47:13 +0200
committerIgor Wiedler <igor@wiedler.ch>2012-06-27 14:47:13 +0200
commit1b3cb68c2fdc5224367ddc3a9414c323c7d5bb7f (patch)
tree62898f931c8b82a198a4c0dc7bf4237c7b4e9077 /phpBB/includes/functions_upload.php
parentf273ab16ae68d15832832e2b2c98a3b99c966c97 (diff)
parent85ea062a0536edc46ea1a8893201777f8137e41e (diff)
downloadforums-1b3cb68c2fdc5224367ddc3a9414c323c7d5bb7f.tar
forums-1b3cb68c2fdc5224367ddc3a9414c323c7d5bb7f.tar.gz
forums-1b3cb68c2fdc5224367ddc3a9414c323c7d5bb7f.tar.bz2
forums-1b3cb68c2fdc5224367ddc3a9414c323c7d5bb7f.tar.xz
forums-1b3cb68c2fdc5224367ddc3a9414c323c7d5bb7f.zip
Merge remote-tracking branch 'upstream/develop' into feature/avatars
* upstream/develop: (255 commits) [ticket/10935] Limit number of PM rules per user to 5000 [ticket/10801] Fixed quickmod tools. [ticket/9551] uncomment line and change length to 255 [ticket/10925] Clarify installation requirements for SQLite [ticket/10938] Serve subforum listing on forumlist from template loop [ticket/10640] Change subject length in mcp in subsilver [ticket/10640] Change subject length in MCP [ticket/10640] Do not change default value of truncate_string() [ticket/10640] Change maximum subject length [ticket/10936] remove PCRE and mbstring support check [ticket/10936] fix language key [ticket/10829] Delete T_STYLESHEET_NAME - no longer used. [ticket/10829] $style_name -> $style_path in style class. [ticket/10743] Renaming user->theme [ticket/10743] Changing obtain_cfg_items [ticket/10882] Fix test name - oops. [ticket/10931] Apply strtolower() correctly, i.e. not on false. [ticket/10931] Also test get_bytes() and get_string() with false. [ticket/10931] Make to_numeric function globally available. [ticket/10932] Use included composer.phar in build process ... Conflicts: phpBB/includes/mcp/mcp_warn.php phpBB/install/database_update.php phpBB/styles/prosilver/template/ucp_avatar_options.html
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r--phpBB/includes/functions_upload.php33
1 files changed, 29 insertions, 4 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 71fe627ac8..f70e20e616 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -756,6 +756,31 @@ class fileupload
$filename = $url['path'];
$filesize = 0;
+ $remote_max_filesize = $this->max_filesize;
+ if (!$remote_max_filesize)
+ {
+ $max_filesize = @ini_get('upload_max_filesize');
+
+ if (!empty($max_filesize))
+ {
+ $unit = strtolower(substr($max_filesize, -1, 1));
+ $remote_max_filesize = (int) $max_filesize;
+
+ switch ($unit)
+ {
+ case 'g':
+ $remote_max_filesize *= 1024;
+ // no break
+ case 'm':
+ $remote_max_filesize *= 1024;
+ // no break
+ case 'k':
+ $remote_max_filesize *= 1024;
+ // no break
+ }
+ }
+ }
+
$errno = 0;
$errstr = '';
@@ -784,9 +809,9 @@ class fileupload
$block = @fread($fsock, 1024);
$filesize += strlen($block);
- if ($this->max_filesize && $filesize > $this->max_filesize)
+ if ($remote_max_filesize && $filesize > $remote_max_filesize)
{
- $max_filesize = get_formatted_filesize($this->max_filesize, false);
+ $max_filesize = get_formatted_filesize($remote_max_filesize, false);
$file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']));
return $file;
@@ -812,9 +837,9 @@ class fileupload
{
$length = (int) str_replace('content-length: ', '', strtolower($line));
- if ($length && $length > $this->max_filesize)
+ if ($remote_max_filesize && $length && $length > $remote_max_filesize)
{
- $max_filesize = get_formatted_filesize($this->max_filesize, false);
+ $max_filesize = get_formatted_filesize($remote_max_filesize, false);
$file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']));
return $file;