Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2017-06-02 21:06:47 +0300
committerAleksander Machniak <alec@alec.pl>2017-06-02 21:07:41 +0300
commitfe4c6260620af16c9d1edc00aa40ebbaf5426778 (patch)
tree3a1cb307fba85353204fded23d20d24f0e110269 /plugins
parentfa566b6b1e1377f408ca956594d4dfbb9f085c20 (diff)
Code optimization, update changelog
Diffstat (limited to 'plugins')
-rw-r--r--plugins/zipdownload/composer.json2
-rw-r--r--plugins/zipdownload/zipdownload.php21
2 files changed, 10 insertions, 13 deletions
diff --git a/plugins/zipdownload/composer.json b/plugins/zipdownload/composer.json
index 3d86619a5..9c936ec40 100644
--- a/plugins/zipdownload/composer.json
+++ b/plugins/zipdownload/composer.json
@@ -3,7 +3,7 @@
"type": "roundcube-plugin",
"description": "Adds an option to download all attachments to a message in one zip file, when a message has multiple attachments. Also allows the download of a selection of messages in one zip file. Supports mbox and maildir format.",
"license": "GPLv3+",
- "version": "3.2",
+ "version": "3.3",
"authors": [
{
"name": "Thomas Bruederli",
diff --git a/plugins/zipdownload/zipdownload.php b/plugins/zipdownload/zipdownload.php
index 157b53a8f..383d40063 100644
--- a/plugins/zipdownload/zipdownload.php
+++ b/plugins/zipdownload/zipdownload.php
@@ -182,8 +182,7 @@ class zipdownload extends rcube_plugin
}
}
}
-
-
+
/**
* Create and get display name of attachment part to add on zip file
*
@@ -205,22 +204,20 @@ class zipdownload extends rcube_plugin
}
}
- $displayname = $this->_convert_filename($filename);
+ $displayname = $this->_convert_filename($filename);
+
/**
* Adding a number before dot of extension on a name of file with same name on zip
* Ext: attach(1).txt on attach filename that has a attach.txt filename on same zip
*/
- if (in_array($displayname, $this->names)) {
- $attachNumber = 1;
+ if (isset($this->name[$displayname])) {
list($filename, $ext) = preg_split("/\.(?=[^\.]*$)/", $displayname);
- foreach ($this->names as $name) {
- if (preg_match("/{$filename}\((\d+)\)\.{$ext}/", $name, $match)) {
- $attachNumber = ((int) $match[1]) + 1;
- }
- }
- $displayname = $filename . '(' .$attachNumber . ').' . $ext;
+ $displayname = $filename . '(' . ($this->names[$displayname]++) . ').' . $ext;
+ $this->names[$displayname] = 1;
+ }
+ else {
+ $this->names[$displayname] = 1;
}
- $this->names[] = $displayname;
return $displayname;
}