Changeset 2356 in subversion


Ignore:
Timestamp:
Mar 17, 2009 11:04:05 AM (4 years ago)
Author:
thomasb
Message:

Refactoring of the attachments core plugins:

  • let the application manage the compose-attachments array
  • unify input and output parameters
  • get rid of local temp files, directly pass file contents
  • codestyle improvements
Location:
branches/devel-api
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-api/plugins/database_attachments/database_attachments.php

    r2336 r2356  
    2020    private $cache_prefix = "db_attach"; 
    2121 
    22  
    23     function _key($filepath){ 
     22    /** 
     23     * Helper method to generate a unique key for the given attachment file 
     24     */ 
     25    private function _key($filepath) 
     26    { 
    2427        return  $this->cache_prefix.md5(mktime().$filepath.$_SESSION['user_id']);  
    2528    } 
    2629 
    27     // Save a newly uploaded attachment 
    28     function upload($args){ 
    29         $args['status'] = TRUE; 
     30    /** 
     31     * Save a newly uploaded attachment 
     32     */ 
     33    function upload($args) 
     34    { 
     35        $args['status'] = false; 
    3036        $rcmail = rcmail::get_instance(); 
    31         $key = $this->_key($args['filepath']); 
    32         $data = base64_encode(file_get_contents($args['filepath']));   
     37        $key = $this->_key($args['path']); 
     38        $data = base64_encode(file_get_contents($args['path'])); 
    3339 
    3440        $status = $rcmail->db->query( 
    3541            "INSERT INTO ".get_table_name('cache')." 
    36             (created, user_id, cache_key, data) 
    37             VALUES (".$rcmail->db->now().", ?, ?, ?)",           
     42             (created, user_id, cache_key, data) 
     43             VALUES (".$rcmail->db->now().", ?, ?, ?)", 
    3844            $_SESSION['user_id'], 
    3945            $key, 
    40             $data);    
    41         if($status){ 
     46            $data); 
     47             
     48        if ($status) { 
    4249            $args['id'] = $key; 
    43             $_SESSION['compose']['attachments'][$key] = array( 
    44                 'name' => $_FILES['_attachments']['name'][$args['index']], 
    45                 'mimetype' => rc_mime_content_type($args['filepath'], $_FILES['_attachments']['type'][0]), 
    46                 'path' => "stored in database", 
    47             ); 
    48         } else { 
    49             $args['status'] = FALSE; 
     50            $args['status'] = true; 
     51            unset($args['path']); 
    5052        } 
     53         
    5154        return $args; 
    5255    } 
    5356 
    54     // Save an attachment from a non-upload source (draft or forward) 
    55     function save($args){ 
    56         $args['status'] = TRUE; 
     57    /** 
     58     * Save an attachment from a non-upload source (draft or forward) 
     59     */ 
     60    function save($args) 
     61    { 
     62        $args['status'] = false; 
    5763        $rcmail = rcmail::get_instance(); 
    5864 
    59         $key = $this->_key($args['filename']); 
    60         $data = base64_encode($args['attachment']);   
     65        $key = $this->_key($args['name']); 
     66        $data = base64_encode($args['data']); 
    6167 
    6268        $status = $rcmail->db->query( 
    6369            "INSERT INTO ".get_table_name('cache')." 
    64             (created, user_id, cache_key, data) 
    65             VALUES (".$rcmail->db->now().", ?, ?, ?)",           
     70             (created, user_id, cache_key, data) 
     71             VALUES (".$rcmail->db->now().", ?, ?, ?)", 
    6672            $_SESSION['user_id'], 
    6773            $key, 
    68             $data);    
    69         $args['id'] = $key; 
    70         if (!$status) 
    71         { 
    72             $args['status'] = FALSE; 
     74            $data); 
     75         
     76        if ($status) { 
     77            $args['id'] = $key; 
     78            $args['status'] = true; 
    7379        } 
    7480 
     
    7682    } 
    7783 
    78     // Remove an attachment from storage 
    79     // This is triggered by the remove attachment button on the compose screen 
    80     function remove($args){ 
    81         $args['status'] = TRUE; 
     84    /** 
     85     * Remove an attachment from storage 
     86     * This is triggered by the remove attachment button on the compose screen 
     87     */ 
     88    function remove($args) 
     89    { 
     90        $args['status'] = false; 
    8291        $rcmail = rcmail::get_instance(); 
    8392        $status = $rcmail->db->query( 
    8493            "DELETE FROM ".get_table_name('cache')." 
    85             WHERE  user_id=? 
    86             AND    cache_key=?", 
     94             WHERE  user_id=? 
     95             AND    cache_key=?", 
    8796            $_SESSION['user_id'], 
    8897            $args['id']); 
    8998     
    90         if(!$status){ 
    91             $args['status'] = false; 
     99        if ($status) { 
     100            $args['status'] = true; 
    92101        } 
     102         
    93103        return $args; 
    94104    } 
    95105 
    96     // When composing an html message, image attachments may be shown 
    97     // For this plugin, $this->get_attachment will check the file and 
    98     // place it on disk 
    99     function display($args){ 
     106    /** 
     107     * When composing an html message, image attachments may be shown 
     108     * For this plugin, $this->get_attachment will check the file and 
     109     * return it's contents 
     110     */ 
     111    function display($args) 
     112    { 
    100113        return $this->get_attachment($args); 
    101114    } 
    102115 
    103     // When displaying or sending the attachment the file must be temporarily 
    104     // copied to disk.  This function is also called by the display_attachment hook. 
    105     function get_attachment($args){ 
    106         $args['status'] = TRUE; 
    107         $args['erase_after_send'] = TRUE; 
     116    /** 
     117     * When displaying or sending the attachment the file contents are fetched 
     118     * using this method. This is also called by the display_attachment hook. 
     119     */ 
     120    function get_attachment($args) 
     121    { 
    108122        $rcmail = rcmail::get_instance(); 
    109         if (!is_array($_SESSION['compose']['attachments'][$args['id']])){ 
    110             $args['status'] = FALSE; 
    111         } 
    112         else{ 
    113           $sql_result = $rcmail->db->query( 
     123         
     124        $sql_result = $rcmail->db->query( 
    114125            "SELECT cache_id, data 
    115126             FROM ".get_table_name('cache')." 
     
    119130            $args['id']); 
    120131 
    121           if ($sql_arr = $rcmail->db->fetch_assoc($sql_result)) { 
    122               $cache_data = base64_decode($sql_arr['data']); 
    123               $temp_dir = unslashify($rcmail->config->get('temp_dir')); 
    124               $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 
    125               file_put_contents($tmp_path, $cache_data); 
    126               $_SESSION['compose']['attachments'][$args['id']]['path'] = $tmp_path; 
    127               $_SESSION['plugins']['database_attachments']['tmp_files'][] = $tmp_path; 
    128               $args['attachment']['path'] = $tmp_path; 
    129           } else { 
    130             $args['status'] = FALSE; 
    131           } 
    132  
     132        if ($sql_arr = $rcmail->db->fetch_assoc($sql_result)) { 
     133            $args['data'] = base64_decode($sql_arr['data']); 
     134            $args['status'] = true; 
    133135        } 
     136         
    134137        return $args; 
    135138    } 
    136     // Delete all temp files associated with this user 
    137     function cleanup($args){ 
     139     
     140    /** 
     141     * Delete all temp files associated with this user 
     142     */ 
     143    function cleanup($args) 
     144    { 
    138145        $rcmail = rcmail::get_instance(); 
    139146        $rcmail->db->query( 
    140147            "DELETE FROM ".get_table_name('cache')." 
    141             WHERE  user_id=? 
    142             AND cache_key like '{$this->cache_prefix}%'", 
    143                 $_SESSION['user_id']); 
    144  
    145         // When sending, attachments are copied to disk and should now be cleaned up 
    146         // Note that the cleanup must happen during the same php script execution 
    147         // as the send so that we can be sure it's the same machine in load ballanced  
    148         // environments. 
    149         if (is_array($_SESSION['plugins']['database_attachments']['tmp_files'])){ 
    150             foreach ($_SESSION['plugins']['database_attachments']['tmp_files'] as $i=>$filename){ 
    151                 if(file_exists($filename)){ 
    152                     unlink($filename); 
    153                 } 
    154                 unset($_SESSION['plugins']['database_attachments']['tmp_files']); 
    155             } 
    156         } 
    157         return $args; 
     148             WHERE  user_id=? 
     149             AND cache_key like '{$this->cache_prefix}%'", 
     150            $_SESSION['user_id']); 
    158151    } 
    159152} 
  • branches/devel-api/plugins/filesystem_attachments/filesystem_attachments.php

    r2336 r2356  
    1111 * Developers may wish to extend this class when creating attachment 
    1212 * handler plugins: 
    13  * 
    14  * require_once('plugins/filesystem_attachments/filesystem_attachments.php'); 
    15  * class myCustom_attachments extends filesystem_attachments 
     13 *   require_once('plugins/filesystem_attachments/filesystem_attachments.php'); 
     14 *   class myCustom_attachments extends filesystem_attachments 
    1615 * 
    1716 * @author Ziba Scott <ziba@umich.edu> 
     
    2120class filesystem_attachments extends rcube_plugin 
    2221{ 
    23  
     22    public $task = 'mail'; 
     23     
    2424    function init() 
    2525    { 
     
    4343    } 
    4444 
    45     // Save a newly uploaded attachment 
    46     function upload($args){ 
    47         $args['status'] = TRUE; 
     45    /** 
     46     * Save a newly uploaded attachment 
     47     */ 
     48    function upload($args) 
     49    { 
     50        $args['status'] = false; 
    4851        $rcmail = rcmail::get_instance(); 
     52         
    4953        // use common temp dir for file uploads 
    5054        $temp_dir = unslashify($rcmail->config->get('temp_dir')); 
    5155        $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); 
    52         $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $tmpfname; 
    53         if (move_uploaded_file($args['filepath'], $tmpfname)) { 
    54             $id = count($_SESSION['compose']['attachments']); 
    55             $args['id'] = $id; 
    56  
    57             $_SESSION['compose']['attachments'][] = array( 
    58                 'name' => $_FILES['_attachments']['name'][$args['index']], 
    59                 'mimetype' => rc_mime_content_type($tmpfname, $_FILES['_attachments']['type'][0]), 
    60                 'path' => $tmpfname, 
    61             ); 
     56         
     57        if (move_uploaded_file($args['path'], $tmpfname)) { 
     58            $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1; 
     59            $args['path'] = $tmpfname; 
     60            $args['status'] = true; 
    6261 
    6362            // Note the file for later cleanup 
    6463            $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $tmpfname; 
    6564        } 
    66         else{ 
    67             $args['status'] = FALSE; 
    68         } 
     65 
    6966        return $args; 
    7067    } 
    7168 
    72     // Save an attachment from a non-upload source (draft or forward) 
    73     function save($args){ 
    74         $args['status'] = TRUE; 
     69    /** 
     70     * Save an attachment from a non-upload source (draft or forward) 
     71     */ 
     72    function save($args) 
     73    { 
     74        $args['status'] = false; 
    7575        $rcmail = rcmail::get_instance(); 
    7676        $temp_dir = unslashify($rcmail->config->get('temp_dir')); 
    7777        $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); 
    7878 
    79         // Note the file for later cleanup 
    80         $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $tmp_path; 
    81  
    82         if ($fp = fopen($tmp_path, 'w')) 
    83         { 
    84             fwrite($fp, $args['attachment']); 
     79        if ($fp = fopen($tmp_path, 'w')) { 
     80            fwrite($fp, $args['data']); 
    8581            fclose($fp); 
     82             
     83            $args['id'] = count($_SESSION['plugins']['filesystem_attachments']['tmp_files'])+1; 
     84            $args['path'] = $tmp_path; 
     85            $args['status'] = true; 
     86             
     87            // Note the file for later cleanup 
     88            $_SESSION['plugins']['filesystem_attachments']['tmp_files'][] = $tmp_path; 
    8689        } 
    87         else{ 
    88             $args['status'] = FALSE; 
    89         } 
    90  
    91         $args['tmp_path'] = $tmp_path; 
    92         $args['id'] = count($_SESSION['compose']['attachments']); 
    9390 
    9491        return $args; 
    9592    } 
    9693 
    97     // Remove an attachment from storage 
    98     // This is triggered by the remove attachment button on the compose screen 
    99     function remove($args){ 
    100         $args['status'] = TRUE; 
    101         $id = $args['id']; 
    102         if (is_array($_SESSION['compose']['attachments'][$id])) 
    103         { 
    104             @unlink($_SESSION['compose']['attachments'][$id]['path']); 
    105         } else { 
    106             $args['status'] = TRUE; 
    107         } 
     94    /** 
     95     * Remove an attachment from storage 
     96     * This is triggered by the remove attachment button on the compose screen 
     97     */ 
     98    function remove($args) 
     99    { 
     100        $args['status'] = @unlink($args['path']); 
    108101        return $args; 
    109102    } 
    110103 
    111     // When composing an html message, image attachments may be shown 
    112     // For this plugin, the file is already in place, just check for 
    113     // the existance of the proper metadata 
    114     function display($args){ 
    115         $args['status'] = TRUE; 
    116         if (!is_array($_SESSION['compose']['attachments'][$args['id']])){ 
    117             $args['status'] = FALSE; 
    118         } 
     104    /** 
     105     * When composing an html message, image attachments may be shown 
     106     * For this plugin, the file is already in place, just check for 
     107     * the existance of the proper metadata 
     108     */ 
     109    function display($args) 
     110    { 
     111        $args['status'] = file_exists($args['path']); 
    119112        return $args; 
    120113    } 
    121114 
    122     // This attachment plugin doesn't require any steps to put the file 
    123     // on disk for use.  This stub function is kept here to make this  
    124     // class handy as a parent class for other plugins which may need it. 
    125     function get_attachment($args){ 
     115    /** 
     116     * This attachment plugin doesn't require any steps to put the file 
     117     * on disk for use.  This stub function is kept here to make this  
     118     * class handy as a parent class for other plugins which may need it. 
     119     */ 
     120    function get_attachment($args) 
     121    { 
    126122        return $args; 
    127123    } 
    128     // Delete all temp files associated with this user 
    129     function cleanup($args){ 
     124     
     125    /** 
     126     * Delete all temp files associated with this user 
     127     */ 
     128    function cleanup($args) 
     129    { 
    130130        // $_SESSION['compose']['attachments'] is not a complete record of 
    131131        // temporary files because loading a draft or starting a forward copies 
  • branches/devel-api/program/steps/mail/attachments.inc

    r2336 r2356  
    2929if ($RCMAIL->action=='remove-attachment') 
    3030{ 
    31   $plugin = rcmail::get_instance()->plugins->exec_hook('remove_attachment',array('id'=>substr($_POST['_file'],7))); 
    32   if ($plugin['status']) 
    33   { 
    34     $id = $plugin['id']; 
    35     if (is_array($_SESSION['compose']['attachments'][$id])) 
    36     { 
     31  $id = 'undefined'; 
     32  if (preg_match('/^rcmfile(\w+)$/', $_POST['_file'], $regs)) 
     33    $id = $regs[1]; 
     34  if ($attachment = $_SESSION['compose']['attachments'][$id]) 
     35    $attachment = $RCMAIL->plugins->exec_hook('remove_attachment', $attachment); 
     36  if ($attachment['status']) { 
     37    if (is_array($_SESSION['compose']['attachments'][$id])) { 
    3738      unset($_SESSION['compose']['attachments'][$id]); 
    3839      $OUTPUT->command('remove_from_attachment_list', "rcmfile$id"); 
    39       $OUTPUT->send(); 
    4040    } 
    4141  } 
     42   
     43  $OUTPUT->send(); 
    4244  exit; 
    4345} 
     
    4547if ($RCMAIL->action=='display-attachment') 
    4648{ 
    47   $plugin = rcmail::get_instance()->plugins->exec_hook('display_attachment',array('id'=>substr($_GET['_file'],7))); 
    48   if ($plugin['status']) 
    49   { 
    50     $id = $plugin['id']; 
    51     $apath = $_SESSION['compose']['attachments'][$id]['path']; 
    52     header('Content-Type: ' . $_SESSION['compose']['attachments'][$id]['mimetype']); 
    53     header('Content-Length: ' . filesize($apath)); 
    54     readfile($apath); 
    55     // plugins that don't use disk storage will want this temp file removed after use 
    56     if($plugin['erase_after_send']){ 
    57         unlink($apath); 
    58     } 
     49  $id = 'undefined'; 
     50  if (preg_match('/^rcmfile(\w+)$/', $_GET['_file'], $regs)) 
     51    $id = $regs[1]; 
     52  if ($attachment = $_SESSION['compose']['attachments'][$id]) 
     53    $attachment = $RCMAIL->plugins->exec_hook('display_attachment', $attachment); 
     54     
     55  if ($attachment['status']) { 
     56    $size = $attachment['data'] ? strlen($attachment['data']) : @filesize($attachment['path']); 
     57    header('Content-Type: ' . $attachment['mimetype']); 
     58    header('Content-Length: ' . $size); 
     59     
     60    if ($attachment['data']) 
     61      echo $attachment['data']; 
     62    else if ($attachment['path']) 
     63      readfile($attachment['path']); 
    5964  } 
    6065  exit; 
     
    7580if (is_array($_FILES['_attachments']['tmp_name'])) { 
    7681  foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) { 
    77     $plugin = rcmail::get_instance()->plugins->exec_hook('upload_attachment',array('filepath'=>$filepath,'index'=>$i)); 
    78     if ($plugin['status']) { 
    79       $id = $plugin['id']; 
     82     
     83    $attachment = array( 
     84      'path' => $filepath, 
     85      'name' => $_FILES['_attachments']['name'][$i], 
     86      'mimetype' => rc_mime_content_type($tmpfname, $_FILES['_attachments']['type'][$i]) 
     87    ); 
     88 
     89    $attachment = $RCMAIL->plugins->exec_hook('upload_attachment', $attachment); 
     90    if ($attachment['status']) { 
     91      $id = $attachment['id']; 
     92       
     93      // store new attachment in session 
     94      unset($attachment['status']); 
     95      $_SESSION['compose']['attachments'][$id] = $attachment; 
     96       
    8097      if (is_file($icon = $CONFIG['skin_path'] . '/images/icons/remove-attachment.png')) { 
    8198        $button = html::img(array( 
     
    94111        'title' => rcube_label('delete'), 
    95112      ), $button); 
    96        
    97       $content .= Q($_FILES['_attachments']['name'][$i]); 
     113 
     114      $content .= Q($attachment['name']); 
    98115       
    99116      $OUTPUT->command('add2attachment_list', "rcmfile$id", $content); 
  • branches/devel-api/program/steps/mail/compose.inc

    r2336 r2356  
    613613function rcmail_save_attachment(&$message, $pid) 
    614614{ 
    615   global $RCMAIL; 
    616  
    617615  $part = $message->mime_parts[$pid]; 
    618616   
    619   $attachment = $message->get_part_content($pid); 
    620   $plugin = rcmail::get_instance()->plugins->exec_hook('save_attachment',array('attachment'=>$attachment,'filename'=>$part->filename)); 
    621   if ($plugin['status']) 
    622   { 
    623     return array( 
    624         'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, 
    625         'name' => $part->filename, 
    626         'path' => $plugin['tmp_path'], 
    627         'content_id' => $part->content_id, 
    628         'id' => $plugin['id'] 
    629     ); 
    630   } else { 
    631     return FALSE; 
    632   } 
     617  $attachment = array( 
     618    'name' => $part->filename, 
     619    'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, 
     620    'content_id' => $part->content_id, 
     621    'data' => $message->get_part_content($pid), 
     622  ); 
     623   
     624  $attachment = rcmail::get_instance()->plugins->exec_hook('save_attachment', $attachment); 
     625  if ($attachment['status']) { 
     626    unset($attachment['data'], $attachment['status']); 
     627    return $attachment; 
     628  } 
     629 
     630  return false; 
    633631} 
    634632 
     
    710708            'href' => "#delete", 
    711709            'title' => rcube_label('delete'), 
    712             'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%d', this)", JS_OBJECT_NAME, $id)), 
     710            'onclick' => sprintf("return %s.command('remove-attachment','rcmfile%s', this)", JS_OBJECT_NAME, $id)), 
    713711          $button) . Q($a_prop['name'])); 
    714712    } 
  • branches/devel-api/program/steps/mail/sendmail.inc

    r2336 r2356  
    296296 
    297297// add stored attachments, if any 
    298 if (is_array($_SESSION['compose']['attachments'])) 
    299   foreach ($_SESSION['compose']['attachments'] as $id => $attachment) 
    300   { 
     298if (is_array($_SESSION['compose']['attachments'])) { 
     299  foreach ($_SESSION['compose']['attachments'] as $id => $attachment) { 
    301300    // This hook gives attachment handlers a chance to place the file on disk 
    302     $plugin = rcmail::get_instance()->plugins->exec_hook('get_attachment', array('id' => $id,'attachment'=>$attachment)); 
    303     $attachment = $plugin['attachment']; 
    304     $dispurl = '/\ssrc\s*=\s*[\'"]?\S+display-attachment\S+file=rcmfile' . $id . '[\'"]?/'; 
     301    $attachment = $RCMAIL->plugins->exec_hook('get_attachment', $attachment); 
     302 
     303    $dispurl = '/\ssrc\s*=\s*[\'"]?\S+display-attachment\S+file=rcmfile' . $attachment['id'] . '[\'"]?/'; 
    305304    $match = preg_match($dispurl, $message_body); 
    306     if ($isHtml && ($match > 0)) 
    307     { 
     305    if ($isHtml && ($match > 0)) { 
    308306      $message_body = preg_replace($dispurl, ' src="'.$attachment['name'].'"', $message_body); 
    309307      $MAIL_MIME->setHTMLBody($message_body); 
    310       $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name']); 
    311     } 
    312     else 
    313     { 
     308      if ($attachment['data']) 
     309        $MAIL_MIME->addHTMLImage($attachment['data'], $attachment['mimetype'], $attachment['name'], false); 
     310      else 
     311        $MAIL_MIME->addHTMLImage($attachment['path'], $attachment['mimetype'], $attachment['name'], true); 
     312    } 
     313    else { 
    314314      $ctype = str_replace('image/pjpeg', 'image/jpeg', $attachment['mimetype']); // #1484914 
     315      $file = $attachment['data'] ? $attachment['data'] : $attachment['path']; 
    315316 
    316317      // .eml attachments send inline 
    317       $MAIL_MIME->addAttachment($attachment['path'], 
     318      $MAIL_MIME->addAttachment($file, 
    318319        $ctype,  
    319         $attachment['name'], true,  
     320        $attachment['name'], 
     321        ($attachment['data'] ? false : true), 
    320322        ($ctype == 'message/rfc822' ? $transfer_encoding : 'base64'), 
    321323        ($ctype == 'message/rfc822' ? 'inline' : 'attachment'), 
    322324        $message_charset, '', '',  
    323         $CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL, 
    324         $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL 
    325         ); 
    326     } 
    327     if($plugin['erase_after_send']){ 
    328         unlink($plugin['attachment']['path']); 
    329     } 
    330   } 
     325        $CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL, 
     326        $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL 
     327      ); 
     328    } 
     329  } 
     330} 
    331331 
    332332// add submitted attachments 
    333 if (is_array($_FILES['_attachments']['tmp_name'])) 
    334   foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) 
    335     { 
     333if (is_array($_FILES['_attachments']['tmp_name'])) { 
     334  foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) { 
    336335    $ctype = $files['type'][$i]; 
    337336    $ctype = str_replace('image/pjpeg', 'image/jpeg', $ctype); // #1484914 
    338337     
    339338    $MAIL_MIME->addAttachment($filepath, $ctype, $files['name'][$i], true, 
    340         $ctype == 'message/rfc822' ? $transfer_encoding : 'base64', 
    341         'attachment', $message_charset, '', '',  
    342         $CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL, 
    343         $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL 
    344         ); 
    345     } 
    346  
     339      $ctype == 'message/rfc822' ? $transfer_encoding : 'base64', 
     340      'attachment', $message_charset, '', '',  
     341      $CONFIG['mime_param_folding'] ? 'quoted-printable' : NULL, 
     342      $CONFIG['mime_param_folding'] == 2 ? 'quoted-printable' : NULL 
     343    ); 
     344  } 
     345} 
    347346 
    348347// encoding settings for mail composing 
Note: See TracChangeset for help on using the changeset viewer.