aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_upload.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-05-14 02:51:56 +0200
committerNils Adermann <naderman@naderman.de>2010-05-14 02:51:56 +0200
commitcf8995210625b31988dd9ae98435bf183ee799e3 (patch)
tree297e2ecfcff8e49c725ca3fd469326067d66ad47 /phpBB/includes/functions_upload.php
parent0ed69d91b2ec7b4b2e86acbc1a9d65b09cad71c1 (diff)
parent478708346e2b046ae474ffb0c2e451a2690ddd2b (diff)
downloadforums-cf8995210625b31988dd9ae98435bf183ee799e3.tar
forums-cf8995210625b31988dd9ae98435bf183ee799e3.tar.gz
forums-cf8995210625b31988dd9ae98435bf183ee799e3.tar.bz2
forums-cf8995210625b31988dd9ae98435bf183ee799e3.tar.xz
forums-cf8995210625b31988dd9ae98435bf183ee799e3.zip
Merge branch 'develop-olympus' into develop
* develop-olympus: [ticket/7717] Localise default extension groups for attachments [ticket/9598] checkdnsrr() is now available on Windows with PHP 5.3 or later. Change if block order to always call checkdnsrr() if the function is available. [ticket/9173] No longer limit scope of numbers we store in the config table on [ticket/9536] Small improvement for query against user/session tables when managing users from the ACP. [ticket/9526] If an admin changes a user's 'user_allow_viewonline' flag to 'hide me' the admin usually wants that user to be hidden immediately. We therefore have to update his session if one exists. [ticket/9518] Correctly create new connection on PostgreSQL when new connection is forced. [ticket/9514] Correctly delete big datasets when deleting a forum including topics/posts on non-MySQL databases. [ticket/6726] Added localhost/127.0.0.1 note to database server hostname explanation in install language. [feature/remote_upload-filesize] Also check HTTP content-length before actually starting the file transfer. [feature/remote_upload-filesize] When transferring files from a remote webserver, abort the transfer as soon as the allowed filesize has been exceeded. [ticket/9176] Take current board timezone settings into account when setting board date format.
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r--phpBB/includes/functions_upload.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 054af29045..51fed45ebd 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -775,7 +775,18 @@ class fileupload
{
if ($get_info)
{
- $data .= @fread($fsock, 1024);
+ $block = @fread($fsock, 1024);
+ $filesize += strlen($block);
+
+ if ($this->max_filesize && $filesize > $this->max_filesize)
+ {
+ $max_filesize = get_formatted_filesize($this->max_filesize, false);
+
+ $file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']));
+ return $file;
+ }
+
+ $data .= $block;
}
else
{
@@ -791,6 +802,18 @@ class fileupload
{
$upload_ary['type'] = rtrim(str_replace('content-type: ', '', strtolower($line)));
}
+ else if ($this->max_filesize && stripos($line, 'content-length: ') !== false)
+ {
+ $length = (int) str_replace('content-length: ', '', strtolower($line));
+
+ if ($length && $length > $this->max_filesize)
+ {
+ $max_filesize = get_formatted_filesize($this->max_filesize, false);
+
+ $file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit']));
+ return $file;
+ }
+ }
else if (stripos($line, '404 not found') !== false)
{
$file = new fileerror($user->lang[$this->error_prefix . 'URL_NOT_FOUND']);