aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_compress.php
diff options
context:
space:
mode:
authorFyorl <gaelreth@gmail.com>2012-08-05 22:11:14 +0100
committerFyorl <gaelreth@gmail.com>2012-08-05 22:13:35 +0100
commit011b494bc55224e59872621ea09c0f69baed2744 (patch)
treedc225d0b9f23ef270ab1e2af09dc8ea2e39fd572 /phpBB/includes/functions_compress.php
parent3390712ed7097fb11d564fb6bd82d74c6b8e3731 (diff)
downloadforums-011b494bc55224e59872621ea09c0f69baed2744.tar
forums-011b494bc55224e59872621ea09c0f69baed2744.tar.gz
forums-011b494bc55224e59872621ea09c0f69baed2744.tar.bz2
forums-011b494bc55224e59872621ea09c0f69baed2744.tar.xz
forums-011b494bc55224e59872621ea09c0f69baed2744.zip
[ticket/11044] Preserve the file extension in unique filenames
PHPBB3-11044
Diffstat (limited to 'phpBB/includes/functions_compress.php')
-rw-r--r--phpBB/includes/functions_compress.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php
index 869ed21cea..80c0242517 100644
--- a/phpBB/includes/functions_compress.php
+++ b/phpBB/includes/functions_compress.php
@@ -138,8 +138,16 @@ class compress
{
if (isset($this->filelist[$name]))
{
+ $start = $name;
+ $ext = '';
$this->filelist[$name]++;
- return $name . '.' . $this->filelist[$name];
+
+ if (($pos = strrpos($name, '.')) !== false) {
+ $start = substr($name, 0, $pos);
+ $ext = substr($name, $pos);
+ }
+
+ return $start . '_' . $this->filelist[$name] . $ext;
}
$this->filelist[$name] = 0;