aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_upload.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-11-12 10:33:40 +0100
committerIgor Wiedler <igor@wiedler.ch>2012-11-12 10:33:40 +0100
commit5e52216b5e14ced69326813e748fc56be6e28a69 (patch)
tree4e47bd9290da80da48aaf30308e7d03965a904f6 /phpBB/includes/functions_upload.php
parent0971d3f975ebaa8c2874115bd82b308b244783f2 (diff)
parent504158ceaba18bb8bc61d54504a2c870d0eb0407 (diff)
downloadforums-5e52216b5e14ced69326813e748fc56be6e28a69.tar
forums-5e52216b5e14ced69326813e748fc56be6e28a69.tar.gz
forums-5e52216b5e14ced69326813e748fc56be6e28a69.tar.bz2
forums-5e52216b5e14ced69326813e748fc56be6e28a69.tar.xz
forums-5e52216b5e14ced69326813e748fc56be6e28a69.zip
Merge remote-tracking branch 'upstream/develop' into ticket/11015
* upstream/develop: (666 commits) [ticket/11077] Remove code from old global announcements system [ticket/11189] Replace DEBUG_EXTRA with DEBUG [ticket/11189] Always log critical errors when in cron or in image output [ticket/11187] Added a blank array to fix errors in functional tests [ticket/10780] Make L_COLON available in the installer. [ticket/11183] Remove $load_extensions and weird dl() calls [ticket/10970] Added extra documentation to parse_dynamic_path. [ticket/10939] Added documentation for phpbb_request::file [ticket/10865] Use code tags for install/database_update.php. [ticket/10865] Should have been a slash. [ticket/10780] Use L_COLON on LDAP page. [ticket/10780] Use L_COLON on search backend ACP pages. [ticket/10780] Use L_COLON for "download all attachments". [ticket/10780] Use colon from language in ucp_pm_compose.php where possible. [ticket/10780] Replace colons in phpBB/adm/style/acp_ext_details.html. [ticket/10780] Replace colon usage in adm template output with {L_COLON} [ticket/10780] Replace colon usage in template output with {L_COLON} [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [develop-olympus] [ticket/11181] Bump PHP requirement to 5.3.3 (from 5.3.2) [ticket/10172] Show prosilver birthday list even if there are no birthdays. ... Conflicts: phpBB/common.php phpBB/download/file.php phpBB/includes/db/dbal.php phpBB/includes/db/firebird.php phpBB/includes/db/mssql.php phpBB/includes/db/mssql_odbc.php phpBB/includes/db/mssqlnative.php phpBB/includes/db/mysql.php phpBB/includes/db/mysqli.php phpBB/includes/db/oracle.php phpBB/includes/db/postgres.php phpBB/includes/db/sqlite.php phpBB/includes/extension/manager.php phpBB/install/database_update.php
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r--phpBB/includes/functions_upload.php45
1 files changed, 25 insertions, 20 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index d4c6b42cf4..b467aa93d1 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -566,10 +566,11 @@ class fileupload
*/
function form_upload($form_name)
{
- global $user;
+ global $user, $request;
- unset($_FILES[$form_name]['local_mode']);
- $file = new filespec($_FILES[$form_name], $this);
+ $upload = $request->file($form_name);
+ unset($upload['local_mode']);
+ $file = new filespec($upload, $this);
if ($file->init_error)
{
@@ -578,9 +579,9 @@ class fileupload
}
// Error array filled?
- if (isset($_FILES[$form_name]['error']))
+ if (isset($upload['error']))
{
- $error = $this->assign_internal_error($_FILES[$form_name]['error']);
+ $error = $this->assign_internal_error($upload['error']);
if ($error !== false)
{
@@ -590,7 +591,7 @@ class fileupload
}
// Check if empty file got uploaded (not catched by is_uploaded_file)
- if (isset($_FILES[$form_name]['size']) && $_FILES[$form_name]['size'] == 0)
+ if (isset($upload['size']) && $upload['size'] == 0)
{
$file->error[] = $user->lang[$this->error_prefix . 'EMPTY_FILEUPLOAD'];
return $file;
@@ -631,17 +632,17 @@ class fileupload
*/
function local_upload($source_file, $filedata = false)
{
- global $user;
+ global $user, $request;
- $form_name = 'local';
+ $upload = array();
- $_FILES[$form_name]['local_mode'] = true;
- $_FILES[$form_name]['tmp_name'] = $source_file;
+ $upload['local_mode'] = true;
+ $upload['tmp_name'] = $source_file;
if ($filedata === false)
{
- $_FILES[$form_name]['name'] = utf8_basename($source_file);
- $_FILES[$form_name]['size'] = 0;
+ $upload['name'] = utf8_basename($source_file);
+ $upload['size'] = 0;
$mimetype = '';
if (function_exists('mime_content_type'))
@@ -655,16 +656,16 @@ class fileupload
$mimetype = 'application/octetstream';
}
- $_FILES[$form_name]['type'] = $mimetype;
+ $upload['type'] = $mimetype;
}
else
{
- $_FILES[$form_name]['name'] = $filedata['realname'];
- $_FILES[$form_name]['size'] = $filedata['size'];
- $_FILES[$form_name]['type'] = $filedata['type'];
+ $upload['name'] = $filedata['realname'];
+ $upload['size'] = $filedata['size'];
+ $upload['type'] = $filedata['type'];
}
- $file = new filespec($_FILES[$form_name], $this);
+ $file = new filespec($upload, $this);
if ($file->init_error)
{
@@ -672,9 +673,9 @@ class fileupload
return $file;
}
- if (isset($_FILES[$form_name]['error']))
+ if (isset($upload['error']))
{
- $error = $this->assign_internal_error($_FILES[$form_name]['error']);
+ $error = $this->assign_internal_error($upload['error']);
if ($error !== false)
{
@@ -709,6 +710,7 @@ class fileupload
}
$this->common_checks($file);
+ $request->overwrite('local', $upload, phpbb_request_interface::FILES);
return $file;
}
@@ -1001,7 +1003,10 @@ class fileupload
*/
function is_valid($form_name)
{
- return (isset($_FILES[$form_name]) && $_FILES[$form_name]['name'] != 'none') ? true : false;
+ global $request;
+ $upload = $request->file($form_name);
+
+ return (!empty($upload) && $upload['name'] !== 'none');
}