From d0cdc5553a15de8b8cb9b26da24cbf4085b0813c Mon Sep 17 00:00:00 2001 From: javiexin Date: Thu, 9 Jul 2015 15:31:28 +0200 Subject: [ticket/13980] Uploaded avatar not removed when new is uploaded Remove the previously uploaded avatar when a new one with a different extension is uploaded, using existing delete method PHPBB3-13980 --- phpBB/phpbb/avatar/driver/upload.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php index eae96cd794..73147a85a0 100644 --- a/phpBB/phpbb/avatar/driver/upload.php +++ b/phpBB/phpbb/avatar/driver/upload.php @@ -161,14 +161,11 @@ class upload extends \phpbb\avatar\driver\driver return false; } + // Delete current avatar if not overwritten $ext = substr(strrchr($row['avatar'], '.'), 1); if ($ext && $ext !== $file->get('extension')) { - $filename = $this->phpbb_root_path . $this->config['avatar_path'] . '/' . $this->config['avatar_salt'] . '_' . $row['id'] . '.' . $ext; - if (file_exists($filename)) - { - @unlink($filename); - } + $this->delete($row); } return array( -- cgit v1.2.1