aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/avatar/driver/upload.php
diff options
context:
space:
mode:
authorjaviexin <javiexin@gmail.com>2015-07-09 16:33:56 +0200
committerjaviexin <javiexin@gmail.com>2015-07-09 16:33:56 +0200
commit4b54df8d45210eed4374d5c4ce22be233c7a34c0 (patch)
tree89f65117f1d09dd24bb7e19546829680cf323813 /phpBB/phpbb/avatar/driver/upload.php
parente0efd5ee576b10be1b826ee3971212a4bdd0b498 (diff)
downloadforums-4b54df8d45210eed4374d5c4ce22be233c7a34c0.tar
forums-4b54df8d45210eed4374d5c4ce22be233c7a34c0.tar.gz
forums-4b54df8d45210eed4374d5c4ce22be233c7a34c0.tar.bz2
forums-4b54df8d45210eed4374d5c4ce22be233c7a34c0.tar.xz
forums-4b54df8d45210eed4374d5c4ce22be233c7a34c0.zip
[ticket/13981] Add events to capture avatar deletion or overwriting
An event to capture overwriting, and another to capture deletion. Includes better error processing. PHPBB3-13981
Diffstat (limited to 'phpBB/phpbb/avatar/driver/upload.php')
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php10
1 files changed, 10 insertions, 0 deletions
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index a1ea339371..cc8662d811 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -139,6 +139,15 @@ class upload extends \phpbb\avatar\driver\driver
$prefix = $this->config['avatar_salt'] . '_';
$file->clean_filename('avatar', $prefix, $row['id']);
+ // If there was an error during upload, then abort operation
+ if (sizeof($file->error))
+ {
+ $file->remove();
+ $error = $file->error;
+ return false;
+ }
+
+ // Calculate new destination
$destination = $this->config['avatar_path'];
// Adjust destination path (no trailing slash)
@@ -177,6 +186,7 @@ class upload extends \phpbb\avatar\driver\driver
$file->move_file($destination, true);
}
+ // If there was an error during move, then clean up leftovers
$error = array_merge($error, $file->error);
if (sizeof($error))
{