Changeset 7f37b87 in github


Ignore:
Timestamp:
Jul 31, 2009 5:13:11 AM (4 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
1fcad15
Parents:
269fb82
Message:

Cleanup temporary attachment files when killing session + fix indentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/filesystem_attachments/filesystem_attachments.php

    ra640647 r7f37b87  
    4141        // Delete all temp files associated with this user 
    4242        $this->add_hook('cleanup_attachments', array($this, 'cleanup')); 
     43        $this->add_hook('kill_session', array($this, 'cleanup')); 
    4344    } 
    4445 
     
    7475    { 
    7576        $args['status'] = false; 
    76          
    77         if (!$args['path']) { 
    78             $rcmail = rcmail::get_instance(); 
     77 
     78        if (!$args['path']) { 
     79            $rcmail = rcmail::get_instance(); 
    7980            $temp_dir = unslashify($rcmail->config->get('temp_dir')); 
    80             $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 
     81            $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 
    8182 
    82             if ($fp = fopen($tmp_path, 'w')) { 
    83                 fwrite($fp, $args['data']); 
    84                 fclose($fp); 
    85                 $args['path'] = $tmp_path; 
    86             } else 
    87                 return $args; 
    88         } 
     83            if ($fp = fopen($tmp_path, 'w')) { 
     84                fwrite($fp, $args['data']); 
     85                fclose($fp); 
     86                $args['path'] = $tmp_path; 
     87            } else 
     88                return $args; 
     89        } 
    8990         
    90         $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1; 
     91        $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1; 
    9192        $args['status'] = true; 
    9293             
Note: See TracChangeset for help on using the changeset viewer.