Changeset 8fa58e7 in github for program/steps/mail/get.inc


Ignore:
Timestamp:
May 17, 2008 1:46:43 PM (5 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
26539d5f
Parents:
e2f958c
Message:

New class rcube_message representing a mail message; changed global $MESSAGE from array to object

File:
1 edited

Legend:

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

    r47124c22 r8fa58e7  
    66 |                                                                       | 
    77 | This file is part of the RoundCube Webmail client                     | 
    8  | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 | 
     8 | Copyright (C) 2005-2008, RoundCube Dev. - Switzerland                 | 
    99 | Licensed under the GNU GPL                                            | 
    1010 |                                                                       | 
     
    2424 
    2525// show loading page 
    26 if ($_GET['_preload']) 
    27   { 
     26if (!empty($_GET['_preload'])) { 
    2827  $url = str_replace('&_preload=1', '', $_SERVER['REQUEST_URI']); 
    2928  $message = rcube_label('loadingdata'); 
     
    3534        "\n</body>\n</html>"; 
    3635  exit; 
    37   } 
     36} 
    3837 
    3938 
    4039// similar code as in program/steps/mail/show.inc 
    41 if ($_GET['_uid']) 
    42   { 
    43   $MESSAGE = array('UID' => get_input_value('_uid', RCUBE_INPUT_GET)); 
    44   $MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID']); 
    45   $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']); 
    46   } 
     40if (!empty($_GET['_uid'])) { 
     41  $RCMAIL->config->set('prefer_html', true); 
     42  $MESSAGE = new rcube_message(get_input_value('_uid', RCUBE_INPUT_GET)); 
     43} 
    4744 
    4845 
    4946// show part page 
    50 if ($_GET['_frame']) 
    51   { 
     47if (!empty($_GET['_frame'])) { 
    5248  $OUTPUT->send('messagepart'); 
    5349  exit; 
    54   } 
     50} 
    5551 
    56 else if ($pid = get_input_value('_part', RCUBE_INPUT_GET)) 
    57   { 
    58   if ($part = $MESSAGE['parts'][$pid]) 
    59     { 
     52else if ($pid = get_input_value('_part', RCUBE_INPUT_GET)) { 
     53  if ($part = $MESSAGE->mime_parts[$pid]) { 
    6054    $ctype_primary = strtolower($part->ctype_primary); 
    6155    $ctype_secondary = strtolower($part->ctype_secondary); 
     
    6862 
    6963    // send download headers 
    70     if ($_GET['_download']) 
    71       { 
     64    if ($_GET['_download']) { 
    7265      header("Cache-Control: private", false); 
    7366      header("Content-Type: application/octet-stream"); 
    74       } 
     67    } 
    7568    else 
    7669      header("Content-Type: $mimetype"); 
    7770 
    7871    // We need to set the following headers to make downloads work using IE in HTTPS mode. 
    79     if (isset($_SERVER['HTTPS'])) 
    80       { 
     72    if (isset($_SERVER['HTTPS'])) { 
    8173      header('Pragma: '); 
    8274      header('Cache-Control: '); 
    83       } 
     75    } 
    8476 
    8577    // deliver part content 
    86     if ($ctype_primary=='text' && $ctype_secondary=='html') 
    87       { 
     78    if ($ctype_primary == 'text' && $ctype_secondary == 'html') { 
    8879      // we have to analyze the whole structure again to find inline objects 
     80      /* what was this good for again ? 
    8981      list($new_parts, $new_attachments) = 
    9082        rcmail_parse_message($MESSAGE['structure'], 
     
    9789        if ($all_parts[$partix]->mime_id == $pid) 
    9890          $part = &$all_parts[$partix]; 
     91      */ 
    9992 
    10093      // get part body if not available 
    10194      if (!$part->body) 
    102         $part->body = $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part); 
     95        $part->body = $MESSAGE->get_part_content($part->mime_id); 
    10396 
    10497      $OUTPUT = new rcube_html_page(); 
    105       $OUTPUT->write(rcmail_print_body($part, intval($_GET['_safe']))); 
    106       } 
    107     else 
    108       { 
     98      $OUTPUT->write(rcmail_print_body($part, $MESSAGE->is_safe)); 
     99    } 
     100    else { 
    109101      header(sprintf('Content-Disposition: %s; filename="%s";', 
    110102                     $_GET['_download'] ? 'attachment' : 'inline', 
     
    112104 
    113105      // turn off output buffering and print part content 
    114       $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part, true); 
    115       } 
     106      $IMAP->get_message_part($MESSAGE->uid, $part->mime_id, $part, true); 
     107    } 
    116108 
    117109    exit; 
    118     } 
    119110  } 
     111} 
    120112 
    121113// print message 
    122 else 
    123   { 
    124   $ctype_primary = strtolower($MESSAGE['structure']->ctype_primary); 
    125   $ctype_secondary = strtolower($MESSAGE['structure']->ctype_secondary); 
    126   $mimetype = sprintf('%s/%s', $ctype_primary, $ctype_secondary); 
    127  
     114else { 
    128115  // send correct headers for content type 
    129116  header("Content-Type: text/html"); 
    130  
    131   $cont = '';  
    132   list($MESSAGE['parts']) = rcmail_parse_message($MESSAGE['structure'], 
    133                                                  array('safe' => intval($_GET['_safe']), 
    134                                                  'get_url' => $GET_URL.'&_part=%s')); 
    135117 
    136118  $cont = "<html>\n<head><title></title>\n</head>\n<body>"; 
     
    142124 
    143125  exit; 
    144   } 
     126} 
    145127 
    146128 
Note: See TracChangeset for help on using the changeset viewer.