Changeset 5998438 in github


Ignore:
Timestamp:
Feb 14, 2008 6:49:30 PM (5 years ago)
Author:
till <till@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
3a084db
Parents:
7eaf7ad
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/steps/mail/upload.inc

    r5349b78 r5998438  
    3737$response = ''; 
    3838 
    39 foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) 
     39if (is_array($_FILES['_attachments']['tmp_name'])) 
    4040  { 
    41   $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); 
    42   if (move_uploaded_file($filepath, $tmpfname)) 
     41  foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) 
    4342    { 
    44     $id = count($_SESSION['compose']['attachments']); 
    45     $_SESSION['compose']['attachments'][] = array('name' => $_FILES['_attachments']['name'][$i], 
     43    $tmpfname = tempnam($temp_dir, 'rcmAttmnt'); 
     44    if (move_uploaded_file($filepath, $tmpfname)) 
     45      { 
     46      $id = count($_SESSION['compose']['attachments']); 
     47      $_SESSION['compose']['attachments'][] = array('name' => $_FILES['_attachments']['name'][$i], 
    4648                                                  'mimetype' => $_FILES['_attachments']['type'][$i], 
    4749                                                  'path' => $tmpfname); 
    4850 
    49     if (is_file($CONFIG['skin_path'] . '/images/icons/remove-attachment.png')) 
    50       $button = sprintf( 
    51         '<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', 
    52         $CONFIG['skin_path'], 
    53         Q(rcube_label('delete'))); 
    54     else 
    55       $button = Q(rcube_label('delete')); 
     51      if (is_file($CONFIG['skin_path'] . '/images/icons/remove-attachment.png')) 
     52        $button = sprintf( 
     53          '<img src="%s/images/icons/remove-attachment.png" alt="%s" border="0" style="padding-right:2px;vertical-align:middle" />', 
     54          $CONFIG['skin_path'], 
     55          Q(rcube_label('delete'))); 
     56      else 
     57        $button = Q(rcube_label('delete')); 
    5658 
    57     $content = sprintf( 
    58       '<a href="#delete" onclick="return %s.command(\'remove-attachment\', \'rcmfile%d\', this)" title="%s">%s</a>%s', 
    59       JS_OBJECT_NAME, 
    60       $id, 
    61       Q(rcube_label('delete')), 
    62       $button, 
    63       Q($_FILES['_attachments']['name'][$i])); 
     59      $content = sprintf( 
     60        '<a href="#delete" onclick="return %s.command(\'remove-attachment\', \'rcmfile%d\', this)" title="%s">%s</a>%s', 
     61        JS_OBJECT_NAME, 
     62        $id, 
     63        Q(rcube_label('delete')), 
     64        $button, 
     65        Q($_FILES['_attachments']['name'][$i])); 
    6466 
    65     $OUTPUT->command('add2attachment_list', "rcmfile$id", $content); 
    66     } 
    67   else // upload failed 
    68     { 
    69     $err = $_FILES['_attachments']['error'][$i]; 
    70     if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) 
    71       $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); 
    72     else 
    73       $msg = rcube_label('fileuploaderror'); 
     67      $OUTPUT->command('add2attachment_list', "rcmfile$id", $content); 
     68      } 
     69    else // upload failed 
     70      { 
     71      $err = $_FILES['_attachments']['error'][$i]; 
     72      if ($err == UPLOAD_ERR_INI_SIZE || $err == UPLOAD_ERR_FORM_SIZE) 
     73        $msg = rcube_label(array('name' => 'filesizeerror', 'vars' => array('size' => show_bytes(parse_bytes(ini_get('upload_max_filesize')))))); 
     74      else 
     75        $msg = rcube_label('fileuploaderror'); 
    7476     
    75     $OUTPUT->command('display_message', $msg, 'error'); 
     77      $OUTPUT->command('display_message', $msg, 'error'); 
     78      } 
    7679    } 
    7780  } 
    78  
    7981 
    8082// send html page with JS calls as response 
Note: See TracChangeset for help on using the changeset viewer.