summaryrefslogtreecommitdiff
path: root/roundcubemail
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-07-31 09:13:11 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2009-07-31 09:13:11 +0000
commite81a296bc6dd66a370bda752aa4886f8e6a619cb (patch)
tree2b026a65dabc54413e83eebf2852de4910c87087 /roundcubemail
parentacb45af886419a744639d555bfe80b883fa00231 (diff)
Cleanup temporary attachment files when killing session + fix indentation
git-svn-id: https://svn.roundcube.net/trunk@2824 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail')
-rw-r--r--roundcubemail/plugins/filesystem_attachments/filesystem_attachments.php25
1 files changed, 13 insertions, 12 deletions
diff --git a/roundcubemail/plugins/filesystem_attachments/filesystem_attachments.php b/roundcubemail/plugins/filesystem_attachments/filesystem_attachments.php
index f4b9b6d7d..fcdcea7a5 100644
--- a/roundcubemail/plugins/filesystem_attachments/filesystem_attachments.php
+++ b/roundcubemail/plugins/filesystem_attachments/filesystem_attachments.php
@@ -40,6 +40,7 @@ class filesystem_attachments extends rcube_plugin
// Delete all temp files associated with this user
$this->add_hook('cleanup_attachments', array($this, 'cleanup'));
+ $this->add_hook('kill_session', array($this, 'cleanup'));
}
/**
@@ -73,21 +74,21 @@ class filesystem_attachments extends rcube_plugin
function save($args)
{
$args['status'] = false;
-
- if (!$args['path']) {
- $rcmail = rcmail::get_instance();
+
+ if (!$args['path']) {
+ $rcmail = rcmail::get_instance();
$temp_dir = unslashify($rcmail->config->get('temp_dir'));
- $tmp_path = tempnam($temp_dir, 'rcmAttmnt');
+ $tmp_path = tempnam($temp_dir, 'rcmAttmnt');
- if ($fp = fopen($tmp_path, 'w')) {
- fwrite($fp, $args['data']);
- fclose($fp);
- $args['path'] = $tmp_path;
- } else
- return $args;
- }
+ if ($fp = fopen($tmp_path, 'w')) {
+ fwrite($fp, $args['data']);
+ fclose($fp);
+ $args['path'] = $tmp_path;
+ } else
+ return $args;
+ }
- $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1;
+ $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1;
$args['status'] = true;
// Note the file for later cleanup